Howto – Set static network interface names in Linux with Systemd

Sometimes Linux admins have the need to write startup scripts for which they require static network interface names. On systems where systemd is used this can be accomplished by below procedure.

To change the names of the network interfaces, we need to create a configuration file for each network interface.

/etc/systemd/network/01-eth4000.link
/etc/systemd/network/02-eth4.link
/etc/systemd/network/03-eth31.link
/etc/systemd/network/04-eth32.link
/etc/systemd/network/05-eth33.link

Each network interface configuration file needs to contain the mac address and interface name.

[Match]
MACAddress=00:50:56:ac:07:30

[Link]
Name=eth33

After creating the configuration files, and modifying the interfaces file to bring up the correct interfaces, we need to make this change persistent by updating the initial ramdisk.

$ update-initramfs -u

The network interfaces will now be renamed the next reboot.

Published by

Unknown's avatar

Ronny Van den Broeck

I'm a network and system engineer for more than 20 years now. During this period I became a pro in hunting down one's and zero's, with an eager mindset to help people accomplish the same or abstract them away from the matrix.

Leave a comment