CentOS 7 / Ubuntu 16.04 LTS Switching / Swapping NIC problem

Due to kernel changes in Ubuntu 16.04 they now use different naming conventions for NICs and if your NICs are on same bus, depending on who initializes first they get first name eno1, the second one is also given eno1 but since they can't be same names, they are given generic renameX where X can be any number. To Fix this there are 2 methods:

Method 1

Create a file at /etc/udev/rules.d/70-persistent-net.rules and list both devices with new name Example, NAME="" can be anything you want, eth1, enp5, whatever. ATTR{address}=="" has to be the NIC's MAC address, you can see it by using ifconfig and checking out HWaddr label

This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:67:46:3f:ef", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eno1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:67:46:3f:ee", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0"

Reboot and check if the NICs have names you specified above.

Proceed normally as you would with editing interfaces file with the name you chose above.

Method 2

Edit your /etc/default/grub changing the line to

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

From 

GRUB_CMDLINE_LINUX=""

Do 

$ sudo update-grub

Then reboot. Now it should use old convention for naming NICs, eth0, eth1, etc.

$ grub2-mkconfig –o /boot/grub2/grub.cfg


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 4149