Finally a fix DHCP+VLANs thanks to systemd-networkd
All checks were successful
Check Flake / check-flake (push) Successful in 3m31s

This commit is contained in:
Zuckerberg 2025-07-21 21:05:09 -07:00
parent 948984af2d
commit dc02438a63

View File

@ -58,43 +58,26 @@
}; };
swapDevices = [ ]; swapDevices = [ ];
systemd.network.enable = true;
networking = { networking = {
dhcpcd.enable = false; useNetworkd = true;
dhcpcd.enable = true;
vlans = { vlans = {
main = {
id = 1;
interface = "eth1";
};
iot = { iot = {
id = 2; id = 2;
interface = "eth1"; interface = "eth1";
}; };
}; };
interfaces.eth1.ipv4.addresses = [{ # Shouldn't be needed but it is. DHCP only works for a day or so while without these.
address = "192.168.1.2"; # This ensures that each interface is configured with DHCP
prefixLength = 21; interfaces."main".useDHCP = true;
}]; interfaces."iot".useDHCP = true;
interfaces.iot.ipv4.addresses = [{
address = "192.168.9.8";
prefixLength = 22;
}];
defaultGateway = "192.168.1.1";
nameservers = [ "1.1.1.1" "8.8.8.8" ];
}; };
# networking = {
# vlans = {
# iot = {
# id = 2;
# interface = "eth1";
# };
# };
# defaultGateway = {
# interface = "eth1";
# address = "192.168.1.1";
# metric = 10; # always use this route as default gateway
# };
# };
powerManagement.cpuFreqGovernor = "powersave"; powerManagement.cpuFreqGovernor = "powersave";
} }