diff options
author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2024-05-30 12:29:36 +0200 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2024-05-30 12:29:36 +0200 |
commit | 884a0835efc440d597c302057b7af52b88adb66f (patch) | |
tree | 1617b72e44a049187e06ec6b83290e18ee566c53 /nixos | |
parent | 340d46ceac0640399b3618b52874ce6f5dbf30cf (diff) |
nixos/tests/networkd: make client reliable in dhcpserver-static-leases test
Migrate the client to a native networkd configuration and reduce unrelated log spam.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/systemd-networkd-dhcpserver-static-leases.nix | 32 |
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 = '' |