New in KB: Ethernet interface name changes on reboot

  • 19 April 2022
  • 0 replies
  • 193 views

  • Anonymous
  • 0 replies

The predictable naming scheme on interface is disabled due to the line below in grub configuration

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

as a result the system with more than one network interface cards can change for example eth0 can become eth5 or eth3 can become eth2 and so on across reboots. 

Reference for getting back legacy scheme here.

Note: Following activity requires sudo access/run as root user.

Inside  /etc/udev/rules.d/70-persistent-net.rules, change the entry like this with proper mac address:-
Include all physical network interfaces:- for example(assuming the system as 6 interfaces). Here eth0 with mac address 28:05:Ca:d8:fc:1a has active link.

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="28:05:Ca:d8:fc:1a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="31:e1:71:6b:68:ad", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="ether1"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="31:a1:71:6b:68:ae", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="ether2"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="30:b1:71:6b:68:af", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="ether3"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="28:cf:37:0d:0e:c0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="ether4"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="18:df:37:0d:0e:38", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="ether5"
Create a symlink:-ln -s /dev/null /etc/systemd/network/99-default.link
udevadm triggerudevadm control --reloadupdate-initramfs -u

Reboot the system to see if the interface name is set as expected.

In case of LACP bonding simply use etherN name for all interfaces, reboot and run ethbonding command to configure bond interfaces.

To verify bonding is working or not you can ssh to the machine & run the command below

cat /proc/net/bonding/bondN  

unplug one of the cable and see if ssh connection is still working.

Another approach (for non-bonded setup )beside above would be only keeping one interface and detaching excess interfaces from the system.

 


0 replies

Be the first to reply!

Reply