# Order of network device assignments changed on boot. [solved

## ebike

Hi All,

I have three network devices:

1. Wired eth0

2. WiFi eth1

3. Wired eth2 (via usb->ethernet adapter (ADSL modem))

eth0 and eth1 are part of a bridge br0.

My problem is that sometimes on boot eth1 and eth2 assignment gets swapped. i.e eth2 becomes the

Wifi and eth1 the ADSL modem. I have to reboot several times to get the assignments I want.

How can I ensure the order above. 

(I have net.br0 and net.eth2 at boot run-level)

Thanks,

Bernard.

----------

## ebike

Bump ... Anyone?  :Crying or Very sad: 

----------

## ebike

Bumpity bump....

I have found several suggestions elsewhere:

1. adding aliases for the interface modules in /etc/moudules.d/aliases

2. Using udev to do the same.

I have tried #1. to no avail and I have no idea how to do assign a driver to an interface name in udev.

Maybe someone can come up with a rule for me??

I'm feeling all alone on this issue ...  :Crying or Very sad: 

----------

## ebike

Ok, I'm going to have to help myself here, .. and hopefully others  :Shocked:  .

I have made a file called /etc/udev/rules.d/20-network.rules which contains:

```

KERNEL="eth*", SYSFS{address}=="00:11:2f:b6:73:42", NAME="lan"

KERNEL="eth*", SYSFS{address}=="00:a0:c5:7f:17:6a", NAME="wifi"

KERNEL="eth*", SYSFS{address}=="00:50:fc:bc:be:94", NAME="adsl"

```

That should give me a lan,wifi and adsl device that I can start by making the appropriate

sym link to net.lo (eg net.lan) and start these instead of the net.eth* ones.

Ifconfig should then show these interfaces. I will also have to modify /etc/conf.d/net to use the new names.

I will try this soon and post results. Anyone see any problems with this please let me know.

----------

## ebike

Well I tried it with partial results:

The "lan" and "adsl" interfaces come up ok, but the "wifi" does not. On looking in

/sys/class/net I see that the old device eth* is still there and hasn't been renamed.

If I reload the driver for my wifi card (prism54) and then run udevstart, I get the wifi interface ok.

It looks like the prism54 module is not being loaded before udev starts.!!

Does anyone know how to ensure the module gets loaded early enough?

----------

## ebike

Come on people ...   :Confused:   184 views and no one has any comments at all??

At least if you haven't got an answer, please let me know if you have similar issues ....

someone must have found this issue, there must me someone with multiple network interfaces out there, that would have

struck this problem, I can't be the only one out there ....

----------

## Headrush

I didn't think the network interfaces used /dev/ device nodes, so your udev rules wouldn't help

Your best best is probably forcing the same module load order everytime by adding the modules for each into /etc/modules.autoload/kernel-2.6. This way you know which module will be loaded first and assigned eth0, then the second, eth1, etc.

----------

## ebike

Yay at last , someone lives on planet Gentoo, thanks for the reply HeadRush.

You don't need a /dev node for udev assignments, just an entry made by sysfs to /sys/class/etc etc

the udev howto gives an example of re-naming network devices this way.. it should work.

I will try the module load order you suggest, but this assumes that modules.autoload is used before hotplug/coldplug, and I don't know if

this is so .... can anyone confirm?

Cheers,

----------

## widan

 *ebike wrote:*   

> I will try the module load order you suggest, but this assumes that modules.autoload is used before hotplug/coldplug, and I don't know if this is so .... can anyone confirm?

 

Modules in modules.autoload.d are handled by the "modules" init script, and that script will always run before hotplug and coldplug (because those last two depend on the modules script).

----------

## ebike

Great, thanks widan, I will try this tonight.

Now if only I can solve why 2.6.14 has issues with hostname, where 2.6.11 is ok??

----------

## Headrush

 *ebike wrote:*   

> Great, thanks widan, I will try this tonight.
> 
> Now if only I can solve why 2.6.14 has issues with hostname, where 2.6.11 is ok??

 

Oh ya, give Widan the credit.   :Razz: 

Can you explain the hostname issue more. Are you sure this wasn't to do with a change in baselayout?

(New method of specifying hostname)

----------

## ebike

... and all credit to Headrush .. your the man!   :Cool: 

The hostname issue is that on boot I get a hostname resolve issue (not sure of the exact error message, .. and I'm away from my box

at present )

What were the changes in baselayout, i.e what is the new method of specifying hostname, was it the simple move from

/etc/hostname to /etc/conf.d/hostname?, or was there syntax changes as well? 

Thanks.

----------

## Headrush

 *ebike wrote:*   

> What were the changes in baselayout, i.e what is the new method of specifying hostname, was it the simple move from
> 
> /etc/hostname to /etc/conf.d/hostname?

 

Yes. remove /etc/hostname if it exists and add hostname and domainname to a runlevel.

(Don't know if it matters, but mine are in boot)

```
rc-update add domainname boot

rc-update add hostname boot
```

----------

## ebike

Yep did all that.

Hunting around the forum, looks like I might have to add host and domain to /etc/hosts..

For example, my hostname is "mythtv" and domain is "homenetwork", so I have to add:

```
127.0.0.1 mythtv.homenetwork mythtv localhost.localdomain localhost
```

instead of :

```
 127.0.0.1 localhost
```

----------

## ebike

Ok some results:

1. On the hostname/domainname issue, it looks like the only thing I had to do was set NISDOMAIN="homenetwork", that solved that issue. I did

not have to alter my /etc/hosts file as per my previous post.

2. On the network device assignments, the load order of the modules did indeed fix my problem ... thanks guys.

I will mark this thread as solved.

----------

## Headrush

 *ebike wrote:*   

> Ok some results:
> 
> 1. On the hostname/domainname issue, it looks like the only thing I had to do was set NISDOMAIN="homenetwork", that solved that issue. I did
> 
> not have to alter my /etc/hosts file as per my previous post.
> ...

 

Hmmm. Maybe you should post the following:

```
cat /etc/host.conf | grep order
```

I don't think you should have to do that for a "normal" home type setup.

----------

