# udev-089-r2 randomly swaps my NICs [solved]

## mesch.t

Hi!

So I updated to udev-089-r2 (I'm running ~x86) yesterday and after a reboot the network was gone.

I noticed that my NICs were swapped - this is extremly uncomfortable since this box also serves as a router for my laptop.

There seems to be no order how the NICs get a name assigned.

I searched the net and the forums here but didn't find an answer.

After reading the gentoo-udev guide and howto write custom udev rules [http://www.reactivated.net/writing_udev_rules.html] I inserted the following rules to 

/etc/udev/rules.d/10-local.rules

```

KERNEL=="eth*", SYSFS{address}=="00:50:fc:95:a1:c8", NAME="eth0"

KERNEL=="eth*", SYSFS{address}=="00:0c:6e:19:d0:98", NAME="eth1"

KERNEL=="eth*", SYSFS{address}=="00:09:5b:74:ca:8a", NAME="eth2"

```

But this doesn't work either. The naming still changes from reboot to reboot. 

Any suggestions?

Thanks, mesch.tLast edited by mesch.t on Sat Apr 08, 2006 1:17 pm; edited 1 time in total

----------

## mesch.t

On bootup I see this message 2x fly by:

```

rename_net_if: Error changing interface name. File exists

```

Coldplug is not installed - hotplug is (it is written in the udev-0.89-r2 ebuild that the functionality is still needed..)

I'm using kernel 2.16-r1 (gentoo sources).

Bye, mesch.tLast edited by mesch.t on Fri Apr 07, 2006 5:44 pm; edited 1 time in total

----------

## gemini91

I had this problem with eth1 setting up as wireless instead of eth0, I went back to udev-087

and re-emerged coldplug, and it now works again.

----------

## mesch.t

yeah i guess this is an option but, just out of curiosity...

on the hotplug-devel-mailinglist i found a similar problem (dating of 31.12.2005) which results to add the following to the rule:

http://sourceforge.net/mailarchive/forum.php?forum_id=3157&max_rows=25&style=nested&viewmonth=200512

```

KERNEL=="eth*", SYSFS{address}=="00:50:fc:95:a1:c8", NAME="eth0", ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address"

```

Furthermore I get the following which also sounds not normal   :Wink: 

```

# udevtest /sys/class/net/eth0/

main: unable to open '/sys/class/net/eth0/'

```

as it is exactly the same as mentioned in the above udev-rules-writing guide...

ciao, mesch.t

----------

## gemini91

Yeah, well I don't feel like I should have to write a udev rule 

to make something work that has been working for three years.

----------

## derk

Well I've had to use a udev rule  to lock my network cards in place for quite sometime .. with this most recent update I've had some problems again.

Now,  after reading this thread and following  mesch.t 's  code sample to modufy my existing rules, everything works properly again.  Thank you   mesch.t for digging this correction/modification up.

derk

ps try running  

```
udevtest /class/net/eth0/
```

seems something has changed in the way it now works ..  ( and strace showed it looking for /sys/sys/class/net/eth0/ using your command)

PPS  -- broken again -- don't know how it seems to have blown-up againLast edited by derk on Sun Apr 09, 2006 2:14 am; edited 1 time in total

----------

## mesch.t

hi!

ok, I think I finally solved this issue:

The above mentioned error: 

```
rename_net_if: Error changing interface name. File exists 
```

stupid me...after changing the names from eth* to something like wan, lan etc the right hardware gets assigned the right names...finally!

So I have to change my configs to automatically bring up my network again:

Creating the symbolic links in /etc/init.d/net.* and changing /etc/conf.d/net  to according names was not enough...

(maybe because of my iptables rules as they expect eth*?)

but right now i'm glad.

tank you

mesch.t

btw:

```
udevtest /class/net/wan
```

gives the expected results...

----------

## mesch.t

ok another stupid mistake:

```

rc-update del net.eth0 

rc-update add net.wan default

```

ciao, mesch.t

----------

## peterton

You can force the order in which the network modules are loaded:

I created /etc/modules.d/eth

```
add above forcedeth skge

add above eth1394 forcedeth
```

(Run update-modules afterwards.)

Now my skge will be eth0, forcedeth eth1, and firewire devices will be last.

----------

## gemini91

I resolved this problem by changing /etc/conf.d/wireless

From:

# /etc/conf.d/wireless:

# Global wireless config file for net.* rc-scripts

essid_eth0="any"

key_miloulan="e9e61d5f99"

To:

# /etc/conf.d/wireless:

# Global wireless config file for net.* rc-scripts

#essid_eth0="any"

key_miloulan="e9e61d5f99"

Now my wireless connects to either eth0 or eth1, but it 

connects. The other ethernet port is a hardwired port

that I hardly ever use.

----------

## kbps

okay! solved!!  :Very Happy: 

udev-094

```

# /etc/init.d/net.eth0 stop

# /etc/init.d/net.eth1 stop

# cd /etc/udev/rules.d/

# touch 10-local.rules

```

add to "10-local.rules" file

```

KERNEL=="eth*", SYSFS{address}=="00:aa:bb:dd:cc:00", NAME="net0"

KERNEL=="eth*", SYSFS{address}=="00:bb:aa:dd:5c:bb", NAME="lan0"

```

'eth0' != 'eth0' --- rename 'eth0' to 'net0' ..etc..

p.s. mac addresses ( !case sensitive! ) from

```

# udevinfo -a -p /sys/class/net/eth0|grep addre

   SYSFS{address}=="00:aa:bb:dd:cc:00"

# udevinfo -a -p /sys/class/net/eth1|grep addre

   SYSFS{address}=="00:bb:aa:dd:5c:bb"

```

p.s. after that unload your eth's modules... (my - skge & ne2k-pci)

```

# modprobe -r skge

# modprobe -r ne2k_pci

# rc-update -d net.eth0

# rc-update -d net.eth1

# cd /etc/init.d/

# rm net.eth0 net.eth1

# ln -s net.lo net.net0

# ln -s net.net0 net.lan0

# rc-update -a net.net0

# rc-update -a net.lan0

# /etc/init.d/net.net0 start

# /etc/init.d/net.lan0 start

```

----------

