Ubuntu – Changing Network Interfaces name Ubuntu 16.04


I tried to change network interfaces name on this new Ubuntu 16.04 LTS version but doesn't have the /etc/udev/rules.d/70-persistent-net.rules.

So, I tried to use /lib/udev/write_net_rules but it not exist.

Why do I need this modification? Because I'm using a tool to Simulate virtual platforms that use flex licensing and the authentication need to be in eth0 interface name.

Any suggestion?

The command ip link returns:

user@laptop:~$ ip link 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp6s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
link/ether b8:2a:xx:yy:xx:yy brd ff:ff:ff:ff:ff:ff
3: wlp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
link/ether 5c:e0:xx:yy:xx:yy brd ff:ff:ff:ff:ff:ff

user@laptop:~$ ifconfig 
enp6s0    Link encap:Ethernet  HWaddr b8:2a:xx:yy:xx:yy  
lo        Link encap:Local Loopback  
wlp7s0    Link encap:Ethernet  HWaddr 5c:e0:xx:yy:xx:yy  

(Some information were ignored and suppressed)

I already tried some links:

Best Answer

There is a lot of misleading information about how to change network names in recent versions of Ubuntu. Some information points to systemd.link, which is just wrong because Ubuntu (as of 16.04) does not use this part of systemd.

Actually, changing interface name works nearly like it used to, with two small differences: First, the file /etc/udev/rules.d/70-persistent-net.rules now has to be created manually. This has the advantage that you do not have to worry about any script overwriting this file and can simply add the lines that you need (you do not need any comments either). Second - and this is the change that cost me a lot of time to figure it out - the format changed slightly compared to Ubuntu 14.04 LTS:

The line for fixing the interface name of the NIC with MAC address "02:01:02:03:04:05" to "eth0" is now:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:01:02:03:04:05", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0"

This line looks nearly the same as in Ubuntu 14.04 LTS with one slight difference: In Ubuntu 14.04, there was the additional condition KERNEL=="eth*". For some reason, this does not work in Ubuntu 16.04 LTS. If this additional condition is present, the whole line is ignored and you are back to the default behavior (as specified in 80-net-setup-link.rules).

Related Question