MAC Address changes between interfaces during each reboot in centos 7.6
Posted: 2019/05/07 10:44:17
We have tried to rename the interfaces from default naming to traditional ethX style using the following approaches.
Approach 1
1) Added net.ifnames=0 biosdevname=0 in /etc/default/grub and ran grub2-mkconfig
2) renamed /etc/sysconfig/network-scripts/ifcfg-en* files to /etc/sysconfig/network-scripts/ifcfg-eth*
3) changed the NAME and DEVICE to eth0 /etc/sysconfig/network-scripts/ifcfg-eth0, NAME and DEVICE to eth1 /etc/sysconfig/network-scripts/ifcfg-eth1 - etc
Approach 2
1) Added net.ifnames=0 in /etc/default/grub and ran grub2-mkconfig
2) Added HWADDR in /etc/sysconfig/network-scripts/ifcfg-eth* files
3) Instead of HWADDR, tried by setting MACADDR in ifcfg-eth* files
Approach 3
1) Added net.ifnames=0 in /etc/default/grub and ran grub2-mkconfig
2) Added the following udev rules in /etc/udev/rules.d/60-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="mac1", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="mac2", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="mac3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="mac4", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
In this approach we could see the following erros in systemd-udev.service status.
Apr 20 05:32:38 HOSTNAME systemd-udevd: error changing net interface name eth0 to eth1: File exists
Apr 20 05:32:38 HOSTNAME systemd-udevd: error changing net interface name eth1 to eth0: File exists
The MAC addresses are getting swapped between interfaces during each reboot. Couldn't get any solution from Internet.
Is there any approach available to have permanent MAC Addr & interface name mapping across reboots.
Approach 1
1) Added net.ifnames=0 biosdevname=0 in /etc/default/grub and ran grub2-mkconfig
2) renamed /etc/sysconfig/network-scripts/ifcfg-en* files to /etc/sysconfig/network-scripts/ifcfg-eth*
3) changed the NAME and DEVICE to eth0 /etc/sysconfig/network-scripts/ifcfg-eth0, NAME and DEVICE to eth1 /etc/sysconfig/network-scripts/ifcfg-eth1 - etc
Approach 2
1) Added net.ifnames=0 in /etc/default/grub and ran grub2-mkconfig
2) Added HWADDR in /etc/sysconfig/network-scripts/ifcfg-eth* files
3) Instead of HWADDR, tried by setting MACADDR in ifcfg-eth* files
Approach 3
1) Added net.ifnames=0 in /etc/default/grub and ran grub2-mkconfig
2) Added the following udev rules in /etc/udev/rules.d/60-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="mac1", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="mac2", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="mac3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="mac4", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
In this approach we could see the following erros in systemd-udev.service status.
Apr 20 05:32:38 HOSTNAME systemd-udevd: error changing net interface name eth0 to eth1: File exists
Apr 20 05:32:38 HOSTNAME systemd-udevd: error changing net interface name eth1 to eth0: File exists
The MAC addresses are getting swapped between interfaces during each reboot. Couldn't get any solution from Internet.
Is there any approach available to have permanent MAC Addr & interface name mapping across reboots.