From 25ae4332f4d45e3517b3cbbcd57f1475e1edf9bc Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Fri, 4 Dec 2026 20:52:41 +0000 Subject: [PATCH] stinger: move to networkd stinger runs dhcpcd in stage 2. dhcpcd treats Nebula's interface as one of its own, and when it stops it removes the address and route Nebula gave it, so any switch that restarts dhcpcd takes stinger off Nebula until Nebula is restarted. Separately, nothing names stinger's NIC eth0 any more since its networking moved to the host module, so after a reboot it comes up as enp1s0 and matches none of its configuration. Moved stinger to networkd, which leaves interfaces without a matching .network file, such as Nebula's, alone. The host module already writes its addresses and VLAN as networkd units, and Tang runs the same networkd configuration in initrd. networkd handles router advertisements itself and stops accepting them when forwarding is on, which OTBR turns on, so eth0 and iot accept them explicitly and the accept_ra sysctl for eth0 is gone. On iot, OTBR's backbone, networkd installs the routes other border routers advertise, which OTBR's accept_ra sysctls did under the kernel. resolved stays off so DNS still goes through dnsmasq. A .link file matching the NIC's MAC address names it eth0 again. udev applies it in initrd as well as stage 2, so the name holds from boot. Test plan: - Built stinger's toplevel: 10-eth0.link matches its MAC and names it eth0, and 40-eth0 and 40-iot carry the static addresses with IPv6AcceptRA=true - CI --- .../stinger.pop.neb.jakehillion.me/default.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/hosts/stinger.pop.neb.jakehillion.me/default.nix b/hosts/stinger.pop.neb.jakehillion.me/default.nix index 1b7c0ed3..84659905 100644 --- a/hosts/stinger.pop.neb.jakehillion.me/default.nix +++ b/hosts/stinger.pop.neb.jakehillion.me/default.nix @@ -38,15 +38,27 @@ }; # Networking + networking.useNetworkd = true; custom.networking.host = { enable = true; interface = "eth0"; }; - # Force-accept RAs on eth0 despite forwarding=1 (set by OTBR for the - # Thread mesh). Without this, eth0 ignores RAs and never SLAACs. - boot.kernel.sysctl."net.ipv6.conf.eth0.accept_ra" = 2; + # The kernel names the NIC enp1s0. Stage 2's .link files are also used in + # initrd, so it is eth0 from boot. + systemd.network.links."10-eth0" = { + matchConfig.PermanentMACAddress = config.custom.network.self.mac; + linkConfig.Name = "eth0"; + }; + # networkd stops accepting RAs when forwarding is on, which OTBR turns on + # for the Thread mesh. On iot, OTBR's backbone, networkd also installs the + # routes other border routers advertise. + systemd.network.networks = { + "40-eth0".networkConfig.IPv6AcceptRA = true; + "40-iot".networkConfig.IPv6AcceptRA = true; + }; # Use local dnsmasq as caching resolver + services.resolved.enable = false; networking.nameservers = lib.mkForce [ "127.0.0.1" ]; # Configure dnsmasq as local caching DNS resolver -- 2.56.1