Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using Ubuntu 12.04 LTS server edition and I am modifying /etc/udev/rules.d/70-persistent-net.rules to define my own mappings of ethernet interfaces to MAC addresses; that file is initially generated by rules in /lib/udev/rules.d/75-persistent-net-generator.rules at system installation time (or at the first boot, I actually don't know and it doesn't matter here).

How can I be sure that my edited version will never ever be overwritten by anything?

Removing the persistent-net-generator, as suggested on some websites, is not the Right Thing™ to do as told by comments in the file itself: it will be overwritten by any update of the udev package. I'm looking for a more formally correct way to disable it.

Is it enough to just make sure that /etc/udev/rules.d/70-persistent-net.rules does exist? Maybe there are other events that could trigger its regeneration? (eg. adding or removing ethernet interfaces to the system?)

share|improve this question
add comment

3 Answers

You should take a look on this file: /etc/udev/rules.d/README Then you can read, that your own udev rules file should have higher number in its name, than the 75-persistent-net-generator.rules. So create a new rules file named like /etc/udev/rules.d/76-persistent-net.rules with your own settings.

share|improve this answer
add comment

The correct way to disable the generator is to override it with an empty file. Any rules in /etc/udev/rules.d will take precedence over rules in /lib/udev/rules.d, so simply create an empty file or symlink to /dev/null:

sudo touch /etc/udev/rules.d/75-persistent-net-generator.rules
-OR-
sudo ln -s /dev/null /etc/udev/rules.d/75-persistent-net-generator.rules

This is safe and future-proof.

share|improve this answer
    
It's probably better to just touch an empty file. –  mgorven Mar 7 '13 at 17:50
add comment

Additional cents for presenting this rule from being re- generated in a batch. Usually I use this at our DevOps practice

for i in `cat /tmp/allnode.lst | awk '{print $1}'`; do echo $i; \
ssh $i 'mv /lib/udev/rules.d/75-persistent-net-generator.rules /tmp/'; done

Col 1 in allnode.lst is IP address

share|improve this answer
add comment

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.