about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMartin Weinelt <mweinelt@users.noreply.github.com>2024-05-30 13:55:26 +0200
committerGitHub <noreply@github.com>2024-05-30 13:55:26 +0200
commit4c43cdf564cd687dce9191b9633cf22641946d80 (patch)
treef8818fd4c9b6d7805348f312904e9918849df42c /nixos
parent90b70f368d5136b51e709ab2129c7952dcf70033 (diff)
parent884a0835efc440d597c302057b7af52b88adb66f (diff)
Merge pull request #315855 from mweinelt/networkd-dhcp-server-static-reliable-client
nixos/tests/networkd: make client reliable in dhcpserver-static-leases test
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/systemd-networkd-dhcpserver-static-leases.nix32
1 files changed, 22 insertions, 10 deletions
diff --git a/nixos/tests/systemd-networkd-dhcpserver-static-leases.nix b/nixos/tests/systemd-networkd-dhcpserver-static-leases.nix
index 2ff074b18cf48..fda9f35cbe104 100644
--- a/nixos/tests/systemd-networkd-dhcpserver-static-leases.nix
+++ b/nixos/tests/systemd-networkd-dhcpserver-static-leases.nix
@@ -24,6 +24,8 @@ import ./make-test-python.nix ({ lib, ... }: {
           "01-eth1" = {
             name = "eth1";
             networkConfig = {
+              # IPForward prevents dynamic address configuration
+              IPForward = true;
               DHCPServer = true;
               Address = "10.0.0.1/24";
             };
@@ -39,20 +41,30 @@ import ./make-test-python.nix ({ lib, ... }: {
     client = {
       virtualisation.vlans = [ 1 ];
       systemd.services.systemd-networkd.environment.SYSTEMD_LOG_LEVEL = "debug";
+      systemd.network = {
+        enable = true;
+        links."10-eth1" = {
+          matchConfig.OriginalName = "eth1";
+          linkConfig.MACAddress = "02:de:ad:be:ef:01";
+        };
+        networks."40-eth1" = {
+          matchConfig.Name = "eth1";
+          networkConfig = {
+            DHCP = "ipv4";
+            IPv6AcceptRA = false;
+          };
+          # This setting is important to have the router assign the
+          # configured lease based on the client's MAC address. Also see:
+          # https://github.com/systemd/systemd/issues/21368#issuecomment-982193546
+          dhcpV4Config.ClientIdentifier = "mac";
+          linkConfig.RequiredForOnline = "routable";
+        };
+      };
       networking = {
-        useNetworkd = true;
         useDHCP = false;
         firewall.enable = false;
-        interfaces.eth1 = {
-          useDHCP = true;
-          macAddress = "02:de:ad:be:ef:01";
-        };
+        interfaces.eth1 = lib.mkForce {};
       };
-
-      # This setting is important to have the router assign the
-      # configured lease based on the client's MAC address. Also see:
-      # https://github.com/systemd/systemd/issues/21368#issuecomment-982193546
-      systemd.network.networks."40-eth1".dhcpV4Config.ClientIdentifier = "mac";
     };
   };
   testScript = ''