Skip to main content

Rename interfaces on Ubuntu 14.04

On my virtual machines I use many network interfaces, each one connected to a different vlan. I usually rename the interfaces on the guest machine with a meaningful name referring to its vlan, like eth40 for the interface that is connected to vlan 40. Until now I used to use ifrename package on my debian guests, but on Ubuntu 14.04 this packakge is not very long distributed.

To achive this I used an udev rule. Simply create the file /etc/udev/rules.d/70-persistent-net.rules with the following content, one line for each interface you want to rename:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b2:b3:31:58:96:59", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth40"

 

 

Now, change your /etc/network/interfaces file accordingly, reboot the guest and your interfaces should have changed.