Adjusting RHEL, CentOS network device names


The interface name of network devices can change if the mac address of a physical or virtual network card changes.
A common cause of this condition is a mother board replacement, a network adapter replacement or cloning of a virtual machine.

On RHEL6 or CentOS 6, two files must be modified to rename an ethernet device from ethX back to ethY (eth1 to eth0).

First, modify the udev rule for network devices which is located in /etc/udev/rules.d/70-persistent-net.rules
Copy the new mac address to the line for the eth0 rule, then delete the new rule for eth1.

# Example
 SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:50:56:b2:23:e0″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

 

Next, modify the network configuration for eth0 located in /etc/sysconfig/network-scripts/ifcfg-eth0

Replace the old ip address with the new one and the old mac address with the new mac address.
To validate the changes, restart the interface or reboot the server.

Leave a comment