Change network device name from eth1 back to eth0.

The interface name of a network device increases if the mac address of the physical or virtual network card changes. A common case is if you made a clone of a virtual machine for example via VMware or KVM or replaced a physical network card in a non virtualized server.

If it’s a CentOS 6 machine you need to change 2 files to rename the interface for example from eth1 back to eth0.

One file is the udev rule for network devices which is located here:

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

Copy the new mac address to the line of your eth0 rule and delete the new rule for eth1.

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:50:56:b2:23:e0″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

Modify the network configuration located under:

/etc/sysconfig/network-scripts/ifcfg-eth0

and replace the old ip with the new one and the old mac address with the new mac address.

To be sure everything works fine reboot your machine.

26 thoughts on “Change network device name from eth1 back to eth0.

  1. Pingback: I am agungsep » Blog Archive » Mengubah nama network device dari eth1 menjadi eth0 kembali di CentOS 6

  2. hudony

    Thank you, I was modifying the udev rule but with no success. Removing (you can only remove it instead of modifying it) the HWADDR line in the ifcfg* scripts did it.

    Thanks!

    Reply
  3. Pingback: Why eth1 instead of eth0 in CentOS | The Ring

  4. Pingback: NetFPGA Regression Test: nf_test.py | 程序员达达

  5. Akhilesh

    I do not see 70-persistent-net.rules file in rules.d folder. I see 70-persistent-cd.rules which looks different. I have rebooted my linux machine (centOS 6.3) multiple times but it is not there.

    Reply
    1. Dominik Zajac Post author

      O.k. For me that file was present on every CentOS 6 machine with an network card attached. If you’re in a virtual environment check if the virtual network card is attached and the kernel module for that card is available. What type of machine is it. Maybe you can share some more details on the configuration to trace it down.

      Reply
  6. bigred

    Ran into same problem when cloning CentOS 6.5 VM in VirtualBox. This info basically fixed it. In the .rules file, I found it a tad easier/safer, to just whack the eth0-related lines and then simply rename the identical (except HW addr) ‘eth1’ entry name to ‘eth0’. I didn’t need to do anything regarding old and new IP addrs. Thanks!!

    Reply
  7. Pingback: Alterar placa de rede eth1 para eth0 no CentOS | Alex Feleol

Leave a Reply

Your email address will not be published. Required fields are marked *