I am using CentOS 6.2 with VMware. I often have to clone my systems. Every time I clone it is adds a new rule to 70-persistent-net.rules file like so.

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:0c:f1:5e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

I never have more than one interface in my systems so this gets really annoying. I know there is way to change the rule to be PCI bus dependent and not MAC dependent, because I have done that already once but I cannot find anywhere on how to do it.

I understand the reasons behind this implementation of udev rules. It makes perfect sense on physical systems but on VMs it becomes an annoyance. Please help.


5 Answers 5


This should be enough for what you want:

DRIVERS=="?*", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
  • This worked. I tried to match it on PCI bus ID but that did not help. Hovewer I do not think this solution will work if I add second network interface.
    – xsaero00
    Jun 13, 2012 at 23:39
  • Found more information on how to do it here linuxfromscratch.org/blfs/view/development/chapter07/…
    – xsaero00
    Jun 13, 2012 at 23:56
  • I ended up deleting all other rules in 70-persistent-net.rules file and having just one like so ACTION=="add", SUBSYSTEM=="net", BUS=="pci", KERNELS=="0000:02:00.0", NAME="eth0"
    – xsaero00
    Jun 13, 2012 at 23:59

Identify the device by PCI address instead. Something like:

SUBSYSTEM=="net", BUS=="PCI", ID=="0000:04:00.0", ...

Running CentOS 6.5 on Virtualbox I achieved nirvana like this:

1) Inhibit /lib/udev/rules.d/75-persistent-net-generator.rules from overwriting /etc/udev/rules.d/70-persistent-net.rules - simply create an empty /etc/udev/rules.d/75-persistent-net-generator.rules

2) Edit /etc/udev/rules.d/70-persistent-net.rules:

# Map ethernet devices according to kernel enumeration
# this should match the adaptor numbering in the virtualbox console 
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{type}=="1", KERNEL=="eth0*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{type}=="1", KERNEL=="eth1*", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{type}=="1", KERNEL=="eth2*", NAME="eth2"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{type}=="1", KERNEL=="eth3*", NAME="eth3"

3) Edit /etc/sysconfig/network-scripts/ifcfg-eth[0-3] as appropriate, removing any HWADDR or MACADDRESS nonesense.

It's not perfect as the kernel enumeration order CAN and probably WILL change if you make other device changes to the VirtualBox settings prior to performing the clone - and the kernel detection doesn't exactly follow the Virtualbox adapter ordering (on mine it seems to be in reverse). But it otherwise does seem to behave consistently which should be at least "good enough".

More explanation and wisdom here:

  • 1
    This deserves more upvotes - complete solution, and the rules file won't be regenerated later
    – Tom
    Dec 21, 2014 at 0:37

I rarely clone Linux systems with VMWare. It's easy enough to rebuild (kickstart + Puppet/CFEngine), that it almost faster to reprovision a system than to clone.

But how are you cloning? Are you doing it from a VM template? Typically, if cloning from a template, I haven't had any NIC-related issues.

  • Yeas I am using VM template. When cloning CentOS 5 I had no problems. CentOS 6 is different.
    – xsaero00
    Jun 11, 2012 at 18:37

I faced this problem too. use this cmd after clone a centos 6 guest

sed -i '/eth0/d' /etc/udev/rules.d/70-persistent-net.rules
sed -i s/eth1/eth0/g /etc/udev/rules.d/70-persistent-net.rules

please change your ip and host name in the following line

sed -i s/ /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i s/node01/node02/g /etc/sysconfig/network

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.