How to disable udev net rule generation?

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"


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.

Here is the command

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

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…

Tags:

Udev

10.04

12.04