I built a new firewall under Debian 12. The machine has eight network ports, and during configuration I accidentally used the same name for a couple of the ports in the files under /etc/systemd/network/*.link. I ended up with two link files referencing two different MAC addresses but naming each of them as WAN0, and once systemd got that configuration it wouldn't let it go.
From what I could find online, normally I would just issue systemctl daemon-reload
followed by a update-initramfs -u
and after a reboot systemd should have had the updated information... but no dice this time. The way I finally discovered the problem was when I noticed under ifconfig that my wan0 port was pointing to the wrong MAC address (even though the link files had been corrected).
After several hours of fighting with it, I finally managed to get it to work by renumbering all of my link files, and now the information for each port matches up correctly. But my real question here is WHY did systemd refuse to read updated link files? Is there another step I should have taken which was mysteriously never mentioned in any of the dozens of web pages I looked at trying to fix this? I really need to understand the proper process for getting it to correctly use these files so I can maintain the machine in the future.
(God I miss the reliability of udev already)
I assume you're using
systemd-networkd
so did you try usingnetworkctl
to reload and reconfigure your networks? By usingstatus
you can see which files are being used by your interface. I hope this points you to an explanation.I did run across it and tried doing a reload, but it looks like according to the help file that doesn't do anything with the link files? I tried
networkctl status
but that doesn't show any info about what files are being used so I'm not sure what you're seeing? It only gives me a list of the IPs used by each interface, plus some log info at the end of ppp0 going up and down while I was setting it up. If it helps, this is what one of my link files looks like...sudo networkctl status
gives you a general overview of all your network settings but indeed, it doesn't show the files used. You can dosudo networkctl
to see a list of all your network devices and whether they are managed bysystemd-networkd
or not. For example, the 3rd device is the one I'm using to connect to the internet. The 7th device is a VPN I'm using.Just using
status
gives you the overview of all your IP addresses and DNS settings.What you probably want is the following
sudo networkctl status $INTERFACE
. Here you see the Link file and Network file used by the interface.You probably have the same
.link
files as me because they are the default ones. The.network
files I use are custom though, for example:I hope this helps you a bit.
Ah that's handy to know the status can show more detail for individual interfaces! I still use /etc/network/interfaces to set up each port so systemd shows them all unmanaged. Maybe some day I'll try switching to that kind of setup.
Where do you find default link files at? There's nothing relevant under /usr/share/doc/systemd/. I had to do a lot of online reading to find an example of selecting them by the MAC address, and the
NamePolicy=
line was critical to making it actually work.I don't suppose you happen to know of a way for systemd to manage a DSL connection (CenturyLink)? The old pppd setup seems to be getting hammered by systemd for some reason even though there's no service file for it, but ppp0 refuses to try connecting on the new server until I can log in, stop it, and restart it again. It's like it is trying to connect way too early in the boot and gets locked up.