ifcfg-eth99 1.36 KB
Newer Older
Mike Hibler's avatar
Mike Hibler committed
1
2
3
4
5
6
7
8
9
10
#
# HACK: run dhclient on all interfaces, and do nothing else
#
# Note that this file's name (eth99) cannot overlap with an actual
# existing interface or dhclient will loop.  dhclient-script invokes
# the source-config function which sources the ifcfg-ethN file.  Thus
# if this script were called "ifcfg-eth0" and eth0 was the DHCPable
# interface, we would wind up recursively invoking dhclient (trust me,
# I tried it :-)
#
11
12
13

. /etc/emulab/paths.sh

Mike Hibler's avatar
Mike Hibler committed
14
15
16
17
18
19
20
21
22
23
24
DEVICE="eth99"
IFACETYPES="3c59x eepro100 e1000 tulip"

#
# First, probe for all our supported ethernet types
#
modprobe -qa $IFACETYPES

#
# If dhclient returns success, then it has configured the first interface
# and gone into background mode.  At that point we don't care about it any
25
26
# more and just kill it.  We also shutdown all the other interfaces (which
# dhclient will leave "up") and set ONBOOT=no to prevent ifup (our caller)
Mike Hibler's avatar
Mike Hibler committed
27
28
29
# from doing any further configuration on this fake interface.
#
if [ -x /sbin/dhclient ] && /sbin/dhclient -q ; then
30
31
32
33
34
35
36
37
38
39
40
41
42
43
    killall dhclient

    if [ -e $BOOTDIR/controlif ]; then
	interface=`cat $BOOTDIR/controlif`
	for _if in `ifconfig -s | awk '{ print $1 }' | grep -v Iface`
	do
	    if [ $_if != "lo" -a x$_if != x$interface ]
	    then
		echo "taking $_if down"
	        ifconfig $_if down
	    fi >>$LOGDIR/dhclient.log 2>&1
	done
    fi
    ONBOOT="no"
Mike Hibler's avatar
Mike Hibler committed
44
else
45
46
    # eat flaming death
    exit 1
Mike Hibler's avatar
Mike Hibler committed
47
fi