Cover V10, I06
Article
Listing 1
Listing 2

jun2001.tar


Listing 2 /etc/rcS.d/S31scnd_int

#!/sbin/sh
#
# 2001-01-30 Tom Kranz (thomas.kranz@flutter.com)
#
# This script will config the 2nd interface on bootup, but not bring it up
# Our redundant-interface script will do that for us
# We can't use /etc/hostname.<int> and /etc/hosts entries, as the boot
# sequence will automatically ifconfig up all interfaces configured that way
#
# If things are lovey dovey, we have an exit code of 0. 
# If there's no config file, that's bad, so we print an error message and bomb
# with an exit code of 2

PATH=/usr/bin:/usr/sbin:/sbin ; export PATH

# We'll pull the redundant interface name from a config file
if [ -r /etc/redundant.int ]; then
        INT=`cat /etc/redundant.int`
else
        echo
        echo "Warning:"
        echo "/etc/redundant.int must exist, containing the redundant interface n
ame!"
        echo
        echo " eg. qfe0"
        echo
        exit 2
fi

# Let's get ready to rumble!
/sbin/ifconfig $INT plumb

# Let's find out what our hostname is, shall we?
hostname=`cat /etc/hostname.hme0`

# We'll also need an address, I'm guessing
addr=`cat /etc/hosts | grep $hostname | cut -f1`

# Now we'll config the interface, but keep it down
/sbin/ifconfig $INT inet $addr netmask + broadcast + down >/dev/null 2>&1

# It's only polite to let people know what's just been going on
echo 
echo "$INT has been configured as the redundant interface"
echo

exit 0