# [solved] udev and ethernet interface

## Section_8

It has been a long day getting my little home network (1 wireless windows box & 1 gentoo box) back up and online, so I will post the condensed version here.

After booting the gentoo box this morning, I had no internet  access.  After a process of elimination, I decided the mobo ethernet controller on the gentoo box was dead, so I went to Frys & bought a PCI NIC card.  By pure cooincidence, this NIC had the same controller as my mobo (realtek 8169) so no kernel tweaks were required to get it working.

Of course, it's never that easy, and after disabling the mobo ethernet in bios & rebooting I still had no internet access on the gentoo box and finally found this in /var/log/messages:   *Quote:*   

>  udev: renamed network interface eth0 to eth1

 

After tracking down all the hard-coded refernces to "eth0" (especially in iptables rules) and changing them to eth1, I was finally able to boot everything up normally with internet access using eth1 as the interface.

However, I don't like mysteries and wanted to know why udev decided to rename my only working ethernet interface from eth0 to eth1 (it didn't do this if i booted sysrescuecd).  I found an obviously generated file in /etc/udev/rules.d/70-persistent-net.rules  that set my dead mobo ethernet port as eth0 and the new PCI NIC as eth1.   After deleting this and rebooting, I had a working interface at eth0 and a   /etc/udev/rules.d/70-persistent-net.rules  that sets my PCI NIC as eth0, as expected.

Everything now appears to be working using eth0 as the ethernet interface as expected. I just want to know if all of this is normal and /etc/udev/70-persistent-net.rules  works like this.  The word "persistent" does't seem to apply here if this is auto-generated by udev.  If my wife boots the gentoo box some morning, and udev decides it wants to name the ethernet interface "eth1", I will get an irate call at work and there will be hell to pay when I get home.  I'd like to avoid that.Last edited by Section_8 on Mon Aug 30, 2010 2:29 pm; edited 1 time in total

----------

## Bones McCracker

Yes.  I have had similar things happen once in a while, although very rarely.  I think they have typically been coincidental with a udev upgrade (or perhaps a kernel upgrade that affected sysfs).  I haven't had it happen in a long time though.

The udev upgrade usually includes an elog warning to this effect, telling you to trash your 70-persistent-net.rules file if you have problems with an interface suddenly not working (although usually all that's required is minor editing).

I hope you can get your money back on the NIC, or have a use for it.   :Smile: 

----------

## Randy Andy

Hi Geeks,

i've fallen into this trap few month ago too. 

In my case it was cause cloning my installation to a different hardware, but now i know that this strategy is correct cause:

If you like to understand it  in this way, the udev-rule is persistent cause: it's bind to the hardware interface (MAC-Adress), so a new interface with a different MAC, will count + 1.

That's why your new interface are now known as eth0.

If you knew that before, you only had to delete the /etc/udev/70-persistent-net.rules, and everything was fine, after exchanging you NIC.

The interesting question would be: Is your NIC really broken or not.

If it is defect, the rules and the strategy works as it should.

If not, you are right and this behaviour is not acceptable...

Best regards, Andy.

----------

## Bones McCracker

This is good reading.  Written by a Gentoo developer a few years ago (so it may be a bit dated in spots, but it's extremely informative).

http://www.reactivated.net/writing_udev_rules.html

Udev is much more "autopilot" than it used to be, but if you know how to handle it, you can make it do some interesting things.

----------

## krinn

try search the forum (lol i know it sucks most of the time) but "eth0 rename to eth1" gave plenty results, fix and even explains about that issue

And adding solved to your thread title will help others users finding this one for an answer  :Smile: 

----------

## Section_8

The new NIC is fine - even when I couldn't get to the net (due to the eth0/1 confusion), I could boot sysrescuecd and get there (with eth0) so I knew it was just configuration problems somewhere.

What I thought would just take a few minutes - especially since my kernel was already configured with the right drivers - took all afternoon to track down.  I wasn't expecting udev to rename it like that - since it's the only interface.  As long as udev is happy with eth0, everything will be fine.

----------

