How to Rename ethernet interface to eth0 in Linux

Today again I am going to discuss 1 more issue which I faced recently with Oracle Enterprise Linux – 6.3, maybe there are many who might have faced this already.

So let me discuss the problem first.

What’d caused the issue?
— I copied my VM Ware Machine- A from my current laptop to different laptop and when I started it, my default eth0 was not coming up.
— So I decided to delete this from VM Ware Setting and add a new Adapter and I did the same and started my Machine, I did not realize but I did this 2-3 times.
— So finally what I got this is my ethernet name was changed to eth3 though my configuration file which was ifcfg-eth0 before, was mistakenly deleted by me. The situation was like below:


Even though I tried starting my network but it was not coming up.

What I did to sort out my problem:

I created ifcfg-eth0 file manually, and the configuration file of eth0 was like the below:


I again tried to restart my network and it started this time, however, the ifconfig was still showing eth3, however, the configuration file eth0 was picked up.


Now, my motive was to change the name eth3 to eth0, for anyone it could be eth1 to eth0 or eth2-eth0, for me it was like eth3 to eth1.

Renaming your network interface to eth0:

Oracle Enterprise Linux, with many others, stores the network interface hardware configuration using udev. The network interface configuration is stored in the file /etc/udev/rules.d/70-persistent-net.rules. Open this file with editor (vim) and start editing. You’ll see configuration lines, like:


As you can see, the system now has the configuration for four interfaces: eth0,eth1,eth2 and eth3. The eth0,eth1 and eth2 line contain the hardware (MAC) address of the old network card, the fourth line is the new one.  Because your network configuration scripts (where IP address settings are stored) are bound to a specific device (eth0) and the system doesn’t know about eth1, it can’t bring it up. To fix this, simply rename “eth3″ to “eth0″ in the NAME field, and remove or comment other lines.


Updating hardware MAC address in networking script:

Apart from the hardware configuration, there is also a networking configuration for the interface. This configuration is stored in /etc/sysconfig/network-scripts/ifcfg-eth0. In this file the IP address configuration is bound to the specific interface. This file most of the times also contains a specific hardware address, the MAC address of the interface the IP address should bind to. Look for the “HWADDR” line and update its value to the one you wrote down earlier from the udev configuration.


Reboot the system to update ethernet numbering.

Now check ifconfig and you will get what you expect.


That’s It.

Hope it helps.

One thought on “How to Rename ethernet interface to eth0 in Linux

  1. You are so cool! I don’t believe I’ve truly read through a single thing like this before. So nice to find someone with some genuine thoughts on this topic. Really.. thanks for starting this up. This site is one thing that is required on the web, someone with a bit of originality!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: