keeping eth0 as ETH0.

July 7th, 2012 by Andrea Matesi 5538 Views


Sometimes the easiness to add/remove hardware components with virtualization brings plenty of confusion with Linux ethX interfaces.

Someday, I removed a network interface from a VM, then I added another I/F and what happened was that my new I/F got the "eth1" name tag (instead of the expected eth0).

The Easy solution.

To prevent this from happening again, the easiest thing to do, before shutting down the VM, is:

rm -f /etc/udev/rules.d/70-persistent-net.rules

Then you can shutdown your VM and remove your virtualized eth I/Fs safely.

Once you add a new eth I/F and boot your Linux system, this new I/F will automatically get the "eth0" name.

The Radical solution.

What if you wish to "fix the elections?" (ie. make sure your actual eth0 stays always ETH0, no-matter-what).

The first thing would be to find what driver is used by your eth interface with ethtool:

ethtool -i eth0

ethtool -i eth0

In this case the result you'd be interested would be the driver (ie. "hv_netvsc" or "e1000").

Next you'll have to find your I/F's MAC Address, which is usually just a matter of running ifconfig eth0:

ifconfig eth0

ifconfig eth0

Take note of your driver and MAC Address.

Now you'll need to edit some files.

The first one is the persistent network rules from udev.

On CentOS 5.x the file was /etc/udev/rules.d/60-net.rules, on CentOS 6.x it is /etc/udev/rules.d/70-persistent-net.rules

Open it up with your favourite editor, then make sure it is similar to the following:

# eth0 = intel e1000
KERNEL=="eth*", SYSFS{address}=="00:0d:60:aa:bb:cc", NAME="eth0"

(from one of my SRC - check below):"...Note that in the MAC address, the hexadecimal digits should be in lowercase, otherwise udev fails to match them properly with the network interface."

Then edit /etc/modprobe.conf and specify an alias which relates your driver to eth0 like so:

# intel e1000 alias (specify driver name)
alias eth0 e1000

Edit also the following:


And make sure the "HWADDR=00:0D:60:84:6A:DF" statement contains your I/F's MAC Address. This way, if the devices are swapped, you'll receive an error.

That would be all.


Senior Professional Network and Computer Systems Engineer during work hours and father when home.

Andrea strives to deliver outstanding customer service and heaps of love towards his family.

In this Ad-sponsored space, Andrea shares his quest for "ultimate" IT knowledge, meticulously brought to you in an easy to read format.

Rate this post

Posted in LINUX, System Administration | 1 Comment »

One response to “keeping eth0 as ETH0.”

  1. AngelicaNo Gravatar says:

    Hey there! This is my first visit to your blog!
    We are a team of volunteers and starting a new
    project in a community in the same niche.
    Your blog provided us useful information to work on.
    You have done a wonderful job!