nixos/lxd: use networkd for DHCP/RA

Enables networkd instead of dhcpcd for DHCP/RA. It offers a solid base
for network configuration, that is much more extensible than dhcpcd and
also better maintained than our bespoke `networking.interfaces` modules.

Closes: #287269
This commit is contained in:
Martin Weinelt 2024-02-08 17:20:04 +01:00
parent 6f5673f731
commit 73e19e1a8d
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
2 changed files with 32 additions and 4 deletions

View File

@ -13,8 +13,22 @@
./lxd.nix
];
networking.useDHCP = false;
networking.interfaces.eth0.useDHCP = true;
networking = {
dhcdpcd.enable = false;
useDHCP = false;
};
systemd.network = {
enable = true;
networks."50-eth0" = {
matchConfig.Name = "eth0";
networkConfig = {
DHCP = "ipv4";
IPv6AcceptRA = true;
};
linkConfig.RequiredForOnline = "routable";
};
};
system.stateVersion = "@stateVersion@"; # Did you read the comment?
}

View File

@ -26,6 +26,20 @@
'';
# Network
networking.useDHCP = false;
networking.interfaces.enp5s0.useDHCP = true;
networking = {
dhcdpcd.enable = false;
useDHCP = false;
};
systemd.network = {
enable = true;
networks."50-enp5s0" = {
matchConfig.Name = "enp5s0";
networkConfig = {
DHCP = "ipv4";
IPv6AcceptRA = true;
};
linkConfig.RequiredForOnline = "routable";
};
};
}