I'm trying to rename a network interface on an Ubuntu 16.04 VPS, but am unable to do so. Systemd names my primary network interface enp0s3. I want to rename this interface to eth0.
According to the systemd.link documentation I created a file called
/etc/systemd/network/10-eth0.link with the following content:
[Match] MACAddress=08:00:27:f7:57:e5 [Link] Name=eth0
The MAC address matches the one given in the
ip a output for the interface. I also renamed the enp0s3 entries to eth0 in the
/etc/network/interfaces file. Although, when I reboot the machine, the interface is still named enp0s3.
The following entries in the
dmesg output are interesting to me:
e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 08:00:27:f7:57:e5
e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
e1000 0000:00:03.0 enp0s3: renamed from eth0
So apparently, it starts out as eth0, but is then renamed back to enp0s3 again. I am not sure why?
When I try to debug the link file, I get the following output:
$ sudo udevadm test-builtin net_setup_link /etc/systemd/network/10-eth0.link calling: test-builtin === trie on-disk === tool version: 229 file size: 6841778 bytes header size 80 bytes strings 1755242 bytes nodes 5086456 bytes Load module index timestamp of 'etc/systemd/network' changed Parsed configuration file /lib/systemd/network/99-default.link Parsed configuration file /etc/systemd/network/10-eth0.link Created link configuration context. unable to open device '/sys/etc/systemd/network/10-eth0.link' Unload module index Unloaded link configuration context.
The line about it being unable to open the device seems odd. I'm not sure why it's trying that, there is no etc directory under /sys at all, should I create it?
Any insights into why my interface name doesn't stick is very welcome.