Originally published June 28, 2016 @ 11:28 am
A suspected bug with certain versions of VMware ESX causes cloned Linux VMs to obtain a sequentially-number NIC. For example, if the parent VM had eth0, the clone will have eth1, and the clone of that clone will have eth2, etc. This can cause issues with centralized configuration management, among other things.
To change the NIC name to the default eth0, you need to do two things: edit the relevant ifcfg-eth*
and edit 70-persistent-net.rules
. Here’s an example:
# ifconfig -a | grep ^eth eth2 Link encap:Ethernet HWaddr 00:50:56:84:4F:B6
Edit the ifcfg-eth[0-9] that handles the eth2 NIC (it may or may not be called ifcfg-eth2: you’ll have to look inside).
cd /etc/sysconfig/network-scripts /bin/mv ifcfg-eth2 ifcfg-eth0 sed -i 's/eth2/eth0/g' ifcfg-eth0
The next step is to edit the udev rules:
vi /etc/udev/rules.d/70-persistent-net.rules # Remove any extraneous lines, leaving only those # that correspond to the actual NICs and assign # correct eth names
Finally and unfortunately, reboot the server. A slightly hacky way of renaming the NIC does not require a reboot, but does cause a brief loss of network connectivity (so do it from console). And keep in mind, this would not survive the reboot. You will still need to do the steps above:
ifconfig eth2 down ip link set eth2 name eth0 ifconfig eth0 up
Experienced Unix/Linux System Administrator with 20-year background in Systems Analysis, Problem Resolution and Engineering Application Support in a large distributed Unix and Windows server environment. Strong problem determination skills. Good knowledge of networking, remote diagnostic techniques, firewalls and network security. Extensive experience with engineering application and database servers, high-availability systems, high-performance computing clusters, and process automation.