Networking Ubuntu – Renaming Network Interface in Ubuntu 16.04 with systemd Fails

16.04networkingserver

I'm using a headless Ubuntu 16.04 LTS Server with two physical network cards, which are named enp5s0f0 and enp5s0f1.

I would like to rename these interfaces, and followed this example. I therefore created the file /lib/systemd/network/70-myinterface.link (the original source does not seem to work) like this (I set the correct mac address):

[Match]
MACAddress=12:34:56:78:9a:bc

[Link]
Name=dmz0

and rebooted the server. Unfortunately the interface did not get renamed, even though udevadm shows that my configuration file is used:

$ udevadm info /sys/class/net/enp5s0f1
P: /devices/pci0000:00/0000:00:02.0/0000:01:00.0/0000:02:02.0/0000:05:00.1/net/enp5s0f1
E: DEVPATH=/devices/pci0000:00/0000:00:02.0/0000:01:00.0/0000:02:02.0/0000:05:00.1/net/enp5s0f1
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=80003ES2LAN Gigabit Ethernet Controller (Copper)
E: ID_MODEL_ID=0x1096
E: ID_NET_DRIVER=e1000e
E: ID_NET_LINK_FILE=/lib/systemd/network/70-myinterface.link  <-- my file
E: ID_NET_NAME_MAC=enx123456789abc
E: ID_NET_NAME_PATH=enp5s0f1
E: ID_OUI_FROM_DATABASE=Intel Corporation
E: ID_PATH=pci-0000:05:00.1
E: ID_PATH_TAG=pci-0000_05_00_1
E: ID_PCI_CLASS_FROM_DATABASE=Network controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
E: ID_VENDOR_FROM_DATABASE=Intel Corporation
E: ID_VENDOR_ID=0x8086
E: IFINDEX=3
E: INTERFACE=enp5s0f1
E: SUBSYSTEM=net
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/enp5s0f1
E: TAGS=:systemd:
E: USEC_INITIALIZED=1900192

Do you have any idea why the renaming did not work?

Best Answer

This may or may not help .. I would check /etc/udev/rules.d and see if you have 70-persistent-net.rules. You should be able to rename them using that file

Mine looks like this:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="e0:cb:ee:d7:ff:9a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

If you have the entries for your cards in this file you can change the name to what ever you want by changing the "NAME=TheNameYouWant"