Got a Red Hat Enterprise Linux (or CentOS, or Scientific Linux, or Oracle Enterprise Linux, etc.) 6 VM that won’t bring up it’s single network interface after you clone it?
Get the following error when you try using /sbin/ifup to enable it?
"Device eth0 does not seem to be present, delaying initialization."
When you use “/sbin/ifconfig -a” you see eth1 where eth0 should be?
eth1 Link encap:Ethernet HWaddr 00:50:56:9B:00:85 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:812 errors:0 dropped:0 overruns:0 frame:0 TX packets:214 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:72509 (70.8 KiB) TX bytes:28324 (27.6 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
What the heck?
It’s the udev persistent network interface rules. If you delete /etc/udev/rules.d/70-persistent-net.rules it’ll rebuild them during the next boot, based on the current state of the host, and you’ll get eth0 back. You can also edit it to change the list of MAC addresses.
There are a couple of ways to disable this functionality permanently.
1. You can remove /lib/udev/rules.d/75-persistent-net-generator.rules. The problem with this approach is that when there’s an update to udev it’ll likely replace the file again and recreate the problem.
2. You could make it part of your machine cloning process, or template prep. All that does is set yourself up for potential problems later, though. Like when you’re on vacation and the new guy clones an already-running VM. Or you do, and you’ve forgotten about this problem… :)
3. You could hijack the rule in /lib/udev/rules.d/75-persistent-net-generator.rules that creates this stuff:
Invert the logic by changing the “!=” to a “==” so it always skips eth* (and everything else in the list):
You could also remove just eth* from the list if you still wanted to preserve the behavior for other interfaces:
This is what I’m doing. I’m hoping that Red Hat does the right thing during a patch by recognizing that the file is changed and not overwriting it.
Update: Read the comments. Lars left a good one, set the 70-persistent-net.rules file to immutable. Also, he reminded me that RPM will tell you what files are config files, if you ask it. :) Thanks man.