fix NIC naming: use udev rules instead of .link files
systemd.network.links didn't generate files; use udev extraRules to pin NIC names to MACs. Also disable networking.useDHCP catch-all that silently misconfigured the LAN NIC when it got a wrong name. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
94d5b6a2a1
commit
8560c11afa
2 changed files with 9 additions and 15 deletions
|
|
@ -29,7 +29,7 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
# Basic networking
|
# Basic networking
|
||||||
networking.useDHCP = lib.mkDefault true;
|
networking.useDHCP = lib.mkForce false;
|
||||||
|
|
||||||
# Allow fred to act as a remote Nix builder (trusted users can import
|
# Allow fred to act as a remote Nix builder (trusted users can import
|
||||||
# unsigned store paths sent by the build client).
|
# unsigned store paths sent by the build client).
|
||||||
|
|
|
||||||
|
|
@ -72,23 +72,17 @@ in
|
||||||
"net.ipv6.conf.all.disable_ipv6" = 1;
|
"net.ipv6.conf.all.disable_ipv6" = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
# --- Interface configuration ---
|
|
||||||
systemd.network = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
# Pin interface names to MAC addresses so they never swap across boots.
|
# Pin interface names to MAC addresses so they never swap across boots.
|
||||||
# Without this, "eth0" is an unpredictable kernel name that depends on
|
# Without this, "eth0" is an unpredictable kernel name that depends on
|
||||||
# device probe order — if the NICs swap, the entire LAN/WAN config breaks.
|
# device probe order — if the NICs swap, the entire LAN/WAN config breaks.
|
||||||
links = {
|
services.udev.extraRules = ''
|
||||||
"10-wan" = {
|
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="6c:0b:84:0c:4c:58", NAME="eth0"
|
||||||
matchConfig.MACAddress = "6c:0b:84:0c:4c:59";
|
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="6c:0b:84:0c:4c:59", NAME="eno1"
|
||||||
linkConfig.Name = "eno1";
|
'';
|
||||||
};
|
|
||||||
"20-lan" = {
|
# --- Interface configuration ---
|
||||||
matchConfig.MACAddress = "6c:0b:84:0c:4c:58";
|
systemd.network = {
|
||||||
linkConfig.Name = "eth0";
|
enable = true;
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
networks = {
|
networks = {
|
||||||
"10-wan" = {
|
"10-wan" = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue