Ubuntu: Renaming virtio network devices in Ubuntu 16.04 is not working


I am trying to rename some virtio ethernet devices on an Ubuntu 16.04 VM. I've done this successfully many times on non-Ubuntu systems with physical interfaces and older Ubuntu systems. Yet, despite following the advice from Renaming network interface in Ubuntu 16.04 with systemd fails and seeing Persistent network interface naming and kvm it still is not being renamed. This is on an openstack VM, but that really shouldn't matter very much.

I have tried using udev (my normal approach):

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="fa:16:3e:bf:be:d0", NAME="enet"  SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="fa:16:3e:64:fb:74", NAME="snet"  

I have tried using systemd.link files (with and without 99-default.link being symlinked to /dev/null):

[Match]  MACAddress=fa:16:3e:bf:be:d0    [Link]  Name=enet  


[Match]  MACAddress=fa:16:3e:64:fb:74    [Link]  Name=snet  

I have tried with both udev and systemd links. I have certainly run sudo update-initramfs -u

Both systemd and udev acknowledge the new name to some extent

systemctl says:

  sys-devices-pci0000:00-0000:00:03.0-virtio0-net-ens3.device       loaded active plugged   Virtio network device    sys-devices-pci0000:00-0000:00:03.0-virtio0-net-enet.device       loaded active plugged   Virtio network device    sys-devices-pci0000:00-0000:00:04.0-virtio1-net-ens4.device       loaded active plugged   Virtio network device    sys-devices-pci0000:00-0000:00:04.0-virtio1-net-snet.device       loaded active plugged   Virtio network device  

udevadm info /sys/class/net/ens3

P: /devices/pci0000:00/0000:00:03.0/virtio0/net/ens3  E: DEVPATH=/devices/pci0000:00/0000:00:03.0/virtio0/net/ens3  E: ID_BUS=pci  E: ID_MODEL_FROM_DATABASE=Virtio network device  E: ID_MODEL_ID=0x1000  E: ID_NET_DRIVER=virtio_net  E: ID_NET_LINK_FILE=/etc/systemd/network/80-etr-net-names.link  E: ID_NET_NAME_MAC=enxfa163ebfbed0  E: ID_NET_NAME_PATH=enp0s3  E: ID_NET_NAME_SLOT=ens3  E: ID_PATH=virtio-pci-0000:00:03.0  E: ID_PATH_TAG=virtio-pci-0000_00_03_0  E: ID_PCI_CLASS_FROM_DATABASE=Network controller  E: ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller  E: ID_VENDOR_FROM_DATABASE=Red Hat, Inc  E: ID_VENDOR_ID=0x1af4  E: IFINDEX=2  E: INTERFACE=ens3  E: SUBSYSTEM=net  E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/enet /sys/subsystem/net/devices/ens3  E: TAGS=:systemd:  E: USEC_INITIALIZED=1532927  

But somehow, the device maintains the ensX name. I am not running NetworkManager

2: ens3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000      link/ether fa:16:3e:bf:be:d0 brd ff:ff:ff:ff:ff:ff  3: ens4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000      link/ether fa:16:3e:64:fb:74 brd ff:ff:ff:ff:ff:ff  


You might be in luck because Linux Kernel version 4.9.9 was just released on Thursday (Feb 9, 2017) with improvements to Virtio among many others. You can read about it here (softpedia.com - Linux kernel 4.9.9 released with many updated drivers x86).

To install the latest kernel version you can follow the instructions here (How do I update kernel to the latest mainline version?) but replace 4.9.8 with 4.9.9.

As an aside there are improvements for Intel i915 and AMDGPU display drivers and Nouveau drivers for nVidia cards. Anyone with unsolvable bugs in those areas should seriously consider installing the new Linux Kernel version.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »