Introduction to Persistent Network Interface Names
I’ve seen this go wrong when working with Linux laptops: network interface names changing after a reboot or when adding/removing hardware. It can cause issues with network configuration and scripting. Luckily, Linux distributions have adopted a system of persistent network interface names to address this problem.
Understanding Persistent Network Interface Names
The real trick is that persistent network interface names are generated based on hardware properties like the MAC address or physical location of the device. This ensures the interface name remains the same even after a reboot or hardware changes. To see the current interface names on your system, use the ip link command:
ip link show
This will display a list of all network interfaces on your system, including their names and properties. Don’t bother with the output if you’re not familiar with it - just look for the interface names, like eth0 or wlan0.
Configuring Persistent Network Interface Names
In practice, configuring persistent network interface names can be done using netctl or NetworkManager, depending on your distribution. On Arch Linux, for example, you can use netctl to create a network profile with a specific interface name:
netctl start eth0
Alternatively, NetworkManager can be used to configure the interface name through its GUI or command-line interface:
nmcli connection modify eth0 ipv4.method manual
This is where people usually get burned: some distributions, like Debian and Ubuntu, use udev rules to generate persistent network interface names. To check the udev rules on your system, run:
udevadm test /sys/class/net/eth0
If you need more information, the systemd documentation is a good place to start.
Troubleshooting Tips
If you encounter issues with persistent network interface names, I usually start with checking the system logs for errors or warnings related to network configuration. You can also use tools like ip and nmcli to diagnose and troubleshoot network issues. For example, ip link show can help you identify the current interface names and properties.
See also
- Taming Log Noise with systemd's Built-in Journalctl Filters and Priorities
- Taming Wildcard DNS Queries with systemd-resolved and resolv.conf
- Taming Log Noise with journalctl and a Little Help from jq
- Taming the Container Chaos: Managing Persistent Volumes with Podman and systemd
- Taming systemd Restart Behavior: When Services Just Won't Stay Down