Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 3 down vote accepted

This should be enough for what you want:

DRIVERS=="?*", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
share|improve this answer
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 '12 at 23:39
Found more information on how to do it here… – xsaero00 Jun 13 '12 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 '12 at 23:59

Identify the device by PCI address instead. Something like:

SUBSYSTEM=="net", BUS=="PCI", ID=="0000:04:00.0", ...
share|improve this answer

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:

share|improve this answer
This deserves more upvotes - complete solution, and the rules file won't be regenerated later – Tom Dec 21 '14 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.

share|improve this answer
Yeas I am using VM template. When cloning CentOS 5 I had no problems. CentOS 6 is different. – xsaero00 Jun 11 '12 at 18:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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