udev Centos change ens to eth

change name to eth0 (pdf)

If your kernel names your network interfaces ens192 or ens224 or anything else you dislike,
You could do this to rename them:

1. Change the ifcfg file of the interface to the desired name
Also change the reference in the file accordingly to the new name

2. Get the mac address of the interface

3. Add a line to /etc/udev/rules.d/70-persistent-ipoib.rules
Only change the mac addres, the original name and the desired name.

4. reboot

1. cd /etc/sysconfig/network-scripts
mv ifcfg-ens192 ifcfg-eth0
sed -i s/ens192/eth0/ ifcfg-eth0

2. ifconfig eth0 |grep ether|awk '{print $2}'
00:0c:29:46:d2:8a

3. cd /etc/udev/rules.d/
vi 70-persistent-ipoib.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:46:d2:8a", ATTR{type}=="1", KERNEL=="ens192", NAME="eth0"

4. reboot

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.