Debian 9 (Stretch) – Systemd network interface names

One of the effects of introducing Systemd into Debian is that the traditional naming convention for network interfaces has changed. No more is your Ethernet interface called eth0, instead it has a name based on its MAC address.

It’s still possible to use the old naming convention by creating a Systemd configuration file for each interface under /etc/systemd/network/. Each filename should start with a number lower than 99. The default configuration file starts with ’99’, the new config should run before that one.

The system config files can be found in /lib/systemd/network/, and are overlaid on top of the files in /etc/systemd/network/

For example, create the file: /etc/systemd/network/10-eth0.link which contains:
[Match]
MACAddress=01:02:03:04:05:06

[Link]
Name=eth0

For more info about the options available for the Match and Link sections, see the man page.

Update your initramfs which is used during boot-up to configure your system.
update-initramfs -u

After the next reboot, the Ethernet interface with MAC address 01:02:03:04:05:06 will be called eth0.

USB Ethernet devices

Annoyingly the configuration of USB Ethernet devices is interfered with by udev, so that the above Systemd config file will not have any effect. To prevent this, either delete or comment out the contents of the file /lib/udev/rules.d/73-usb-net-by-mac.rules and restart udev.

The USB Ethernet device will now be named based on the Systemd configuration file above.

WiFi Cards

I had some difficulty using the MACAddress Match option with my WiFi card, so I instead matched on the basis of card type:
$ cat /etc/systemd/network/10-wlan0.link
[Match]
Type=wlan

[Link]
Name=wlan0