mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-31 17:20:53 +02:00
chore: rework lisa's networking to use networkd
This commit is contained in:
parent
c4c4b8db9e
commit
ed2d612b5e
1 changed files with 63 additions and 36 deletions
|
@ -26,44 +26,65 @@
|
||||||
services.fail2ban.enable = true;
|
services.fail2ban.enable = true;
|
||||||
|
|
||||||
networking.hostName = "lisa";
|
networking.hostName = "lisa";
|
||||||
networking.useDHCP = false;
|
|
||||||
networking.interfaces.ens20.useDHCP = false;
|
|
||||||
networking.interfaces.ens20.mtu = 1420;
|
|
||||||
networking.interfaces.ens20.ipv4.addresses = [
|
|
||||||
{
|
|
||||||
address = "212.129.40.11";
|
|
||||||
prefixLength = 32;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
networking.interfaces.ens18.useDHCP = true;
|
|
||||||
networking.defaultGateway.interface = "ens20";
|
|
||||||
networking.defaultGateway.address = "212.129.40.11";
|
|
||||||
networking.interfaces.ens19.useDHCP = false;
|
|
||||||
networking.interfaces.ens19.ipv6.addresses = [
|
|
||||||
{
|
|
||||||
address = "2a01:e0a:5f9:9681:5880:c9ff:fe9f:3dfb";
|
|
||||||
prefixLength = 120;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
networking.hostId = "fbb334ae";
|
networking.hostId = "fbb334ae";
|
||||||
services.zfs.autoSnapshot.enable = true;
|
|
||||||
services.zfs.autoScrub.enable = true;
|
|
||||||
|
|
||||||
networking.wireguard.interfaces = {
|
networking.useNetworkd = true;
|
||||||
wg0 = {
|
systemd.network = {
|
||||||
ips = [ "fd85:27e8:fc9::6/128" ];
|
enable = true;
|
||||||
listenPort = 51820;
|
|
||||||
privateKeyFile = "/root/wg-private";
|
|
||||||
|
|
||||||
peers = [
|
networks = {
|
||||||
|
"10-wan" = {
|
||||||
|
matchConfig.Name = "ens20";
|
||||||
|
address = [ "212.129.40.11/32" ];
|
||||||
|
routes = [
|
||||||
{
|
{
|
||||||
allowedIPs = [ "fd85:27e8:fc9::/48" ];
|
routeConfig = {
|
||||||
publicKey = "ZO8j0AwssAERtyJQO+o11pWAFKzkxTI5hmqHsfEy5Bo=";
|
Gateway = "212.129.40.11";
|
||||||
endpoint = "core01.rz.ens.wtf:51820";
|
Destination = "0.0.0.0/0";
|
||||||
persistentKeepalive = 25;
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
linkConfig.RequiredForOnline = "routable";
|
||||||
|
};
|
||||||
|
"20-wan" = {
|
||||||
|
matchConfig.Name = "ens18";
|
||||||
|
networkConfig.DHCP = "yes";
|
||||||
|
linkConfig.RequiredForOnline = "routable";
|
||||||
|
};
|
||||||
|
wg0 = {
|
||||||
|
matchConfig.Name = "wg0";
|
||||||
|
address = [
|
||||||
|
"10.100.45.1/24"
|
||||||
|
"fc00::1/64"
|
||||||
|
];
|
||||||
|
networkConfig = {
|
||||||
|
IPMasquerade = "ipv4";
|
||||||
|
IPForward = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
netdevs = {
|
||||||
|
"50-wg0" = {
|
||||||
|
netdevConfig = {
|
||||||
|
Kind = "wireguard";
|
||||||
|
Name = "wg0";
|
||||||
|
MTUBytes = "1300";
|
||||||
|
};
|
||||||
|
wireguardConfig = {
|
||||||
|
PrivateKeyFile = "/srv/wg-private";
|
||||||
|
ListenPort = 51821;
|
||||||
|
};
|
||||||
|
wireguardPeers = [
|
||||||
|
{
|
||||||
|
wireguardPeerConfig = {
|
||||||
|
PublicKey = "axigTezuClSoQlxWvpdzXKXUDjrrQlswE50ox0uDLR0=";
|
||||||
|
AllowedIPs = [ "10.100.45.2/32" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -74,8 +95,14 @@
|
||||||
MaxAuthTries 20
|
MaxAuthTries 20
|
||||||
'';
|
'';
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 51821 ];
|
networking.firewall.allowedTCPPorts = [
|
||||||
networking.firewall.allowedUDPPorts = [ 51821 ];
|
51820
|
||||||
|
51821
|
||||||
|
];
|
||||||
|
networking.firewall.allowedUDPPorts = [
|
||||||
|
51820
|
||||||
|
51821
|
||||||
|
];
|
||||||
|
|
||||||
system.stateVersion = "21.11";
|
system.stateVersion = "21.11";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue