[CentOS] Nic order detection

Thu Jan 10 14:06:32 UTC 2008
Nicolas Thierry-Mieg <Nicolas.Thierry-Mieg at imag.fr>


Les Mikesell wrote:
> MatsK wrote:
>> Les Mikesell wrote:
>>> I have a number of machines that have 4 NICs, two of which are 
>>> actually in use, running Centos 5.  When they are rebooted, they seem 
>>> to change the eth interface names, assigning them in different 
>>> orders.  I'm a little fuzzy on the details because they are at a 
>>> remote location and I can't access them easily - especially after the 
>>> network breaks.  Shouldn't:
>>> alias eth0 bnx2
>>> alias eth1 bnx2
>>> alias eth2 e1000
>>> alias eth3 e1000
>>> in /etc/modprobe.conf always make the intel cards eth2 and 3?
>>
>> Noop, this is done with ifcfg-ethX where X is the if number.
>>
>> Create a /etc/sysconfig/network/ifcfg-eth0 that look like this example:
>>
>> DEVICE=eth0
>> HWADDR=00:01:23:45:67:89
>> ONBOOT=yes
>> TYPE=Ethernet
>> NETMASK=255.255.255.0
>> IPADDR=192.168.1.154
>> GATEWAY=192.168.1.1
>>
>> and then create ifcfg-eth1, ifcfg-eth2, ifcfg-eth3
>>
>> then do a "service network restart" to activate the settings.
> 
> I do have the ifcfg-ethX files for the 2 interfaces that are currently 
> active, but since the machines were built by image copies of a master 
> disk, they do not have HWADDR address entries.  A person on-site with 
> access to the console adjusted them if they didn't come up right the 
> first time, but they seem to shift around on each reboot.  Will adding 
> the HWADDR entry nail them down even if it doesn't match the nic type 
> specified in modprobe.conf?  Can someone point me to the code where this 
> happens?  Until recently the machines were running centos 3.x and this 
> seems to be a difference in behavior.
> 

the names in modprobe.conf don't mean much: you could have eth0 as an 
alias to your sound card module and  snd-card-0 an alias to your 
ethernet module, except for timing problems on startup...

I assume the ifup scripts modprobe's the corresponding eth device, so if 
your alias is correct you can be sure the module will be loaded in time 
for activating the device. However, if your modprobe.conf has "alias 
eth1 bnx2" but eth1 is an intel NIC for some reason, ifup eth1 will 
still work fine and bring up the intel eth1 as long as the intel module 
(e1000?) has been loaded at that point.

make sense?

cheers,