HOWTO avoid problems with network interfaces numbering between BIOS and Linux kernel

From SystemImager

Jump to: navigation, search

Some small explanation with an example systemimager post-install script

Biosdevname

You have to install this utility on your golden client:

* http://freshmeat.net/projects/biosdevname

With the aid of this program we can determine how the network interface are numbered for the BIOS or Linux kernel, e.g.:

biosdevname -i eth0
eth0

In this example there is no difference between the BIOS interface numberinng and Linux kernel

For our Dell 1950 with Broadcom network cards, e.g.:

biosdevname -i eth0
eth1

The BIOS has a different order then the Linux kernel.

Systemimager post-installl script example

technology essays We at SARA use logical names (admin) instead of eth0. The example script will use biosdevname utiltity to avoid the problems with network interface numbering and assign logical names to the network interface. This example script assumes Debian as operating system.

create_persistent_ethernet_devices()
{
         #BIOSDEVNAME=/usr/sbin/biosdevname
         BIOSDEVNAME=`which biosdevname`
         if [ ! -x $BIOSDEVNAME ]
         then
                 echo "NOT configuring ethernet devices, missing
program: $BIOSDEVNAME"
                 exit 1
         fi

         PERSISTENT_NET_RULES=/etc/udev/rules.d/z25_persistent-net.rules

         ADMIN_NETWORK=`$BIOSDEVNAME -i eth0`
         USER_NETWORK=`$BIOSDEVNAME -i eth1`
         IFCONFIG=ifconfig

         ADMIN_MAC=`$IFCONFIG $ADMIN_NETWORK | grep HWaddr | awk
'{ print tolower($NF) }'`
         USER_MAC=`$IFCONFIG $USER_NETWORK | grep HWaddr | awk
'{ print tolower($NF) }'`

         # Write persistent network names
         #
         cat > $PERSISTENT_NET_RULES << EOF
# This file was automatically generated by the SYSTEMIMAGER (BvdV)
#
# program, probably run by the persistent-net-generator.rules rules
file.
#
# You can modify it, as long as you keep each rule on a single line.
# MAC addresses must be written in lowercase.

# PCI device 0x14e4:0x164c (bnx2)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="$ADMIN_MAC",
NAME="admin"

# PCI device 0x14e4:0x164c (bnx2)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="$USER_MAC", NAME="gb2"

EOF
}}}

systemimager network config:
{{{
two_interfaces()
{

systemconfigurator --confighw --confignet --stdin <<EOL || shellout

[NETWORK]
HOSTNAME = <name>

[INTERFACE0]
DEVICE = admin
TYPE = dhcp

[INTERFACE1]
DEVICE =  gb2
TYPE = static
IPADDR = 10.0.0.1
NETMASK = 255.255.255.0

EOL
}
Personal tools