MAC Address changes between interfaces during each reboot in centos 7.6
MAC Address changes between interfaces during each reboot in centos 7.6
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.
Last edited by tsrini on 2019/05/07 11:10:50, edited 1 time in total.
Re: MAC Address changes between interfaces during each reboot in centos 7.6
I had to change the name of one interface, and I did it in /etc/udev/rules.d/70-persistent-ipoib.rules:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="01:12:23:34:45:56", ATTR {type}=="1", KERNEL=="eth*", NAME="public"
Link: https://www.schrodinger.com/kb/1649
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="01:12:23:34:45:56", ATTR {type}=="1", KERNEL=="eth*", NAME="public"
Link: https://www.schrodinger.com/kb/1649
Re: MAC Address changes between interfaces during each reboot in centos 7.6
This apporach only works in Centos 6 .tunk wrote: ↑2019/05/07 10:53:45I had to change the name of one interface, and I did it in /etc/udev/rules.d/70-persistent-ipoib.rules:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="01:12:23:34:45:56", ATTR {type}=="1", KERNEL=="eth*", NAME="public"
Link: https://www.schrodinger.com/kb/1649
Re: MAC Address changes between interfaces during each reboot in centos 7.6
Forgot to say it's on a 7.6 system.
Re: MAC Address changes between interfaces during each reboot in centos 7.6
This approach may work for system with single interface.But in our case system contains 4 interfaces.Have you tested with multiple interfaces?
Re: MAC Address changes between interfaces during each reboot in centos 7.6
I've only changed one NIC (eth0), and HWADDR was added to the config file.
The other NIC (em4) was left unchanged (again with HWADDR).
networkmanager is disabled.
The other NIC (em4) was left unchanged (again with HWADDR).
networkmanager is disabled.
Re: MAC Address changes between interfaces during each reboot in centos 7.6
I don't know if it will work, but here's what I would try:
- disable networkmanager (if not already done)
- update /etc/udev/rules.d/70-persistent-ipoib.rules with the four NICs
- add HWADDR to the four config files
- disable networkmanager (if not already done)
- update /etc/udev/rules.d/70-persistent-ipoib.rules with the four NICs
- add HWADDR to the four config files
Re: MAC Address changes between interfaces during each reboot in centos 7.6
First remove all interfaces, then add.
Re: MAC Address changes between interfaces during each reboot in centos 7.6
Now it is working fine.
But there is a problem.These changes has to be done during installation process .We thought to rename the interfaces from ifcfg-en* to ifcfg-eth* based ip addr command or ifindex attribute.But it seems we can't rely on these methods.Is there any unique attribute that can be considered for correct order during the renaming process?
But there is a problem.These changes has to be done during installation process .We thought to rename the interfaces from ifcfg-en* to ifcfg-eth* based ip addr command or ifindex attribute.But it seems we can't rely on these methods.Is there any unique attribute that can be considered for correct order during the renaming process?