[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 2.6 kernel network interface assignment order




Eric Sproul wrote:

On Thu, 2004-01-29 at 14:55, Franz Georg Köhler wrote:

This occasionally happens with new kernel releases.


I'd like to know why.


Swap your configuration...


Again, I'd like to know *why* it happens rather than blindly changing
configs.  What if I had 3 interfaces, what would happen then?  I
wouldn't know which would end up where.

Anyone have any more constructive advice?
Eric



I don't know of any way to reliably ensure that a given card = eth(n). It's obviously a big deal on any multi-card platform. Another problem is if you have multiple cards (often to ensure connectivity if one goes down) and eth0, for instance dies. Now on reboot, all the cards shift over one number, and nothing works (if they're on seperate subnets. Same problem, but can happen without a kernel change. Yuck.

If it's really critical, or happens often, perhaps you'll want to write a custom init script that looks at the hardware address of the interface, and configures the appropriate IP settings for the interface.

Something like the following crude outline:

devs="eth0 eth1 eth2"

setconfig () {
    case "$1" in
	11:11:11:11:11:11)
		configint $1 <ip> <netmask> <gateway>
		;;
	22:22:22:22:22:22)
		configint $1 <ip> <netmask> <gateway>
		;;
#	(etc. etc.)
    esac;
}

configint () {
    int=$1
    ip=$2
    mask=$3
    gateway=$4

    ifconfig $int netmask $mask  $ip
     #etc...
}

for dev in $devs; do
  addr=`ifconfig $dev | grep HWaddr | sed -e's/.*HWaddr //'`
  setconfig $addr
done

--Rich




Reply to: