From ca2f13f7653c248c1773d2fb6ebfb48fcdf40509 Mon Sep 17 00:00:00 2001 From: clerie <git@clerie.de> Date: Sun, 16 Mar 2025 18:29:21 +0100 Subject: [PATCH] hosts/nonat: Migrate to systemd-network --- hosts/nonat/configuration.nix | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/hosts/nonat/configuration.nix b/hosts/nonat/configuration.nix index 2f2483d..741055c 100644 --- a/hosts/nonat/configuration.nix +++ b/hosts/nonat/configuration.nix @@ -13,19 +13,27 @@ boot.loader.grub.device = "/dev/vda"; networking.useDHCP = false; - # Network - networking.interfaces.ens18.ipv4.addresses = [ - { address = "141.24.46.169"; prefixLength = 24; } - ]; - networking.interfaces.ens18.ipv6.addresses = [ - { address = "2001:638:904:ffca::6"; prefixLength = 64; } - ]; - networking.defaultGateway = { address = "141.24.46.1"; interface = "ens18"; }; - networking.defaultGateway6 = { address = "2001:638:904:ffca::1"; interface = "ens18"; }; + systemd.network.enable = true; - networking.interfaces.ens19.ipv4.addresses = [ - { address = "192.168.10.1"; prefixLength = 24; } - ]; + systemd.network.networks."10-wan" = { + matchConfig.Name = "ens18"; + address = [ + "2001:638:904:ffca::6/64" + "141.24.46.169/24" + ]; + routes = [ + { Gateway = "141.24.46.1"; } + { Gateway = "2001:638:904:ffca::1"; } + ]; + linkConfig.RequiredForOnline = "routable"; + }; + systemd.network.networks."10-nat-netz-mercury" = { + matchConfig.Name = "ens19"; + address = [ + "192.168.10.1/24" + ]; + linkConfig.RequiredForOnline = "no"; + }; networking.nat = { enableIPv6 = true;