[Nottingham] Two interfaces...a discussion from Wednesday

Robert Postill robert at grinning-cat.com
Fri Mar 18 23:01:45 GMT 2005


Hi,
While at the pub on Wednesday I vaguely recall having a chat about
naming of NICs (I believe it was Dave but my memory's a little hazy).
The problem was that on boot-up the NICs were being assigned the wrong
interface (eth0, eth1 etc).  Afterwards the NICs had their setting
reassigned to the correct setting in what was described as a "kludgey
script".  Well this week I was low on enthusiasm and high on caffine, so
I decided to do a little nosing around...

First and foremost it's important to realise that the kernel assigns the
order of you interfaces, *not* you network config scripts.  That means
by the time in the boot process your distro is trying to tell the NIC
what IP it should have the order of the interfaces is pretty much set.
Now in debian there's a bit of the debian reference manual that refers
to this kind of setup.  It suggests using a script you can find
in /usr/share/doc/ifupdown/examples/match-mac-address.sh (it's called
get-mac-address on my Ubuntu Hoary install).  This takes the MAC address
(sometimes called the burn-in address because a value is given to each
NIC during manufacture, although that can be overridden) specified
in /etc/network/interfaces and creates a new designation from that.  You
then run from your manufactured designation.  See
http://www.debian.org/doc/manuals/reference/ch-gateway.en.html for the
full discussion.  Getting your MAC address is a case of running ifconfig
and using the HWaddr.  It does mean that you have to ditch eth0..ethx
but what's in a name right?

Two coffees later and I can't type to such an extent int becomes
uiobnmrty.  Surely there's a way to make eth0 be what you want it to be
I foam...  A little more searching led me to the answer.  Looking in the
network administrators guide on the the Linux Documentation Project I
hit paydirt.  What you have to do is pass the base address as a boot
parameter to the kernel.  The Network admin guide is pretty old so it
confines itself to LILO but the principle should hold true for GRUB.
The idea is that you reserve the address space of the card so the kernel
lets you decide what that address space is going to be.  Checkout
http://www.tldp.org/LDP/nag2/x-087-2-hardware.drivers.ethernet.html for
the info from the horses mouth as it were. If you want to find the
hardware address of the card then do a dmesg|grep eth0 and it should
spit out a line like: 
e100: eth0: e100_probe: addr 0x40a00000, irq 11, MAC addr
00:50:8B:AD:0E:10

Which tells me the e100 driver found a card at 0x40a that the kernel is
calling eth0.


Right, now I can sleep, if only I can find the horse tranquilisers...

Robert. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mailman.lug.org.uk/pipermail/nottingham/attachments/20050318/4550cf93/attachment.bin


More information about the Nottingham mailing list