Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

In our cloud, we generate MACs with the prefix 2c:c2:60 for instances. When we re-use an instance, or duplicate it, the new copy gets another MAC address. When the new copy boots, the NIC gets the name eth1 due to the new MAC.

I see that in /lib/udev/rules.d/75-persistent-net-generator.rules, there are rules for known prefixes such as 52:54:00 (KVM) and VMWare (00:0c:29). But this file should not be edited as stated in its first line. We would like to use our own registered MAC prefix and not others' ones.

How to disable net rules generation completely?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Morning,

You can override the /lib/udev/rules.d/* by copying them to /etc/udev/rules.d and then modifying them.

Or alternatively, you can create a new file with a lexically higher name e.g. /etc/udev/rules.d/99-stop-persistent-net.rules with the following "do nothing" entry:-

SUBSYSTEM=="net", DRIVERS=="?*", NAME="%k"

This should prevent new rules from being created as udev thinks the interface is already listed. This will also survive udev updates etc.

Sorry, don't have time to test it....

share|improve this answer
    
The first suggestion works. The alternative suggestion does not. –  borfig Jan 13 '13 at 13:48
    
Here is another beautifully unclean solution. Make your /etc/udev/rules.d/70-persistent-net.rules a directory :) –  Avio Jan 29 '13 at 10:51
cd /etc/udev/rules.d
rm -f 70-persistent-net.rules
rm -f 75-persistent-net-generator.rules
echo "# " > 75-persistent-net-generator.rules

See https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html
chapter "Rules files"

share|improve this answer

Based on JasminJ's answer, I read the manual. Well, I read a very small portion of it. The fifth sentence in the "Rules files" section states:

This can be used to override a system-supplied rules file with a local file if needed; a symlink in /etc with the same name as a rules file in /lib, pointing to /dev/null, disables the rules file entirely.

I just tested this with a VM and it does indeed work as described. I prefer this to conventional/hacky methods of disabling this functionality.

share|improve this answer

Your Answer

 
discard

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.