Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a bootable Linux memstick that I use on a lot of different PCs (but all of the same model and configuration). Trouble is that udev is renaming the eth interfaces so that what was eth0 on the last PC is suddenly ethX, where X=1..inf. This causes if-up (called by ifplugd) to fail, since /etc/network/interfaces only specifies how to bring up eth0:

auto eth0
iface eth0 inet dhcp

It's a well-known problem; I've googled and found that this is caused by the MAC addresses changing and that it may be fixed by deleting /etc/udev/rules.d/70-persistent-net.rules. But that only works after a reboot, which is inconvenient and should be unneccessary, since I know what behaviour I want.

What I want is non-persistent net rules, or in the alternative, an /etc/network/interfaces script that adapts to the changing eth names, or perhaps it can be done with ifplugd. What's the best way to achieve this?

Distro: Ubuntu 8.04.

share|improve this question
    
8.04 is no longer supported on the desktop; upgrade to at least 10.04. You will probably find this issue is fixed there also. –  psusi Nov 28 '11 at 15:34

2 Answers 2

up vote 3 down vote accepted

The persistent net rules are generated by /lib/udev/rules.d/75-persistent-net-generator.rules (or something similar, I'm looking on a newer Debian machine).

If Ubuntu 8.04 still has that generator script in /etc/udev/rules.d, you can just get rid of it.

Otherwise, I believe putting a blank file in /etc/udev/rules.d will override the one in /lib.

You could also write your own rules file to give the interface a name—the persistent rules generator ignores the interface if a name has already been set.

share|improve this answer

I followed derobert's advice, deleting /etc/udev/rules.d/75-persistent-net-generator.rules, and also I edited the already generated /etc/udev/rules.d/70-persistent-net.rules so that the lines looked like this:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{type}=="1", KERNEL=="eth*", NAME="%k"

Note the %k in NAME, which means to use the kernel name.

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.