- Red Hat Enterprise Linux 4. (RHEL 4)
- Red Hat Enterprise Linux 5. (RHEL 5)
- Red Hat Enterprise Linux 6. (RHEL 6)
- Red Hat Enterprise Linux 7. (RHEL 7)
- The Network Interface MAC address is changing after each reboot.
- How to assign a permanent MAC address to the bonding interface in RHEL ?
- Force the bond interface to take a MAC address of the slave.
Assigning permanent MAC address for an Ethernet interface.
Please keep in mind that ethX style naming will not work on Rhel 7. this is described here:
If you are not trying to rename your Rhel 7 network devices to ethX style, please see below resolution.
MACADDR=directive and specify the required MAC address to the
/etc/sysconfig/network-scripts/ifcfg-ethXnetwork configuration. So that this value will be taken as the permanent MAC address of the network interface. If
HWADDR=directive is present in the network configuration file then make sure to replace it with
MACADDR=directive and its corresponding value as follows:
# cat /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 BOOTPROTO=dhcp HWADDR=00:17:a4:77:09:20 ONBOOT=yes TYPE=Ethernet USERCTL=no IPV6INIT=no PEERDNS=yes NM_CONTROLLED=no
HWADDR directive is changed with
# cat /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 BOOTPROTO=dhcp MACADDR=00:17:a4:77:77:25 ONBOOT=yes TYPE=Ethernet USERCTL=no IPV6INIT=no PEERDNS=yes NM_CONTROLLED=no
Assigning permanent MAC address for a bonding network interface.
- Forcing a bond to get its MAC address from a specific slave, MACADDR directive has to be added with the MAC address of the required slave to
# cat /etc/sysconfig/network-scripts/ifcfg-eno1 DEVICE=eno1 NAME=eno1 TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes NM_CONTROLLED=no # cat /etc/sysconfig/network-scripts/ifcfg-eno2 DEVICE=eno2 NAME=eno2 TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes NM_CONTROLLED=no # cat /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 NAME=bond0 TYPE=Bond MACADDR=a0:36:9f:0f:b1:70 ONBOOT=yes BOOTPROTO=dhcp NM_CONTROLLED=no BONDING_OPTS="mode=active-backup primary=eno1 miimon=100"
- After performing the necessary changes in the network configuration files make sure to
rebootthe system for the MAC address to take effect.
<MAC-address> is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:FF. This directive is useful for machines with multiple NICs to ensure that the interfaces are assigned to the correct device names regardless of the configured load order for each NIC's module, This directive should not be used in conjunction with
<MAC-address> is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:FF. This directive is used to assign a MAC address to an interface, overriding the one assigned to the physical NIC, This directive should not be used in conjunction with
- Red Hat Enterprise Linux
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.