Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
5c848316
Commit
5c848316
authored
Oct 21, 2008
by
Ryan Jackson
Browse files
Oops again. This should be the right one.
parent
2c0538c8
Changes
1
Show whitespace changes
Inline
Side-by-side
tmcd/fedora/ifcfg-eth99
View file @
5c848316
#/bin/sh -
#/bin/sh -
#
#
# EMULAB-COPYRIGHT
# EMULAB-COPYRIGHT
# Copyright (c) 2004, 200
7
University of Utah and the Flux Group.
# Copyright (c) 2004, 200
5
University of Utah and the Flux Group.
# All rights reserved.
# All rights reserved.
#
#
#
#
# HACK: run dhclient on all interfaces, and do nothing else
# HACK: run dhclient on all interfaces, and do nothing else
# (well, now also bring up a widearea node control net statically if asked)
#
#
# Note that this file's name (eth99) cannot overlap with an actual
# Note that this file's name (eth99) cannot overlap with an actual
# existing interface or dhclient will loop. dhclient-script invokes
# existing interface or dhclient will loop. dhclient-script invokes
...
@@ -19,13 +20,108 @@
...
@@ -19,13 +20,108 @@
. /etc/emulab/paths.sh
. /etc/emulab/paths.sh
DEVICE="eth99"
DEVICE="eth99"
IFACETYPES="3c59x e
epro
100 e1000
r8169 tulip
"
IFACETYPES="3c59x e100 e1000
tulip e1000e tg3
"
#
#
# First, probe for all our supported ethernet types
# First, probe for all our supported ethernet types
#
#
modprobe -qa $IFACETYPES
modprobe -qa $IFACETYPES
#
# Check: are we a remote node? If so, possibly try static config in pref
# to dhcp.
#
if [ -e /etc/emulab/isrem -a -e /etc/emulab/waconfig ]; then
. /etc/emulab/waconfig
echo "Found Emulab widearea config info..."
_ifs=`ifconfig -s -a | awk '{ print $1 }' | grep -v 'Iface' | grep -v '^lo$'`
if [ "$WA_BOOTMETHOD" = "static" -a "$WA_MAC" != "" ]; then
# try to find an iface matching WA_MAC
cnetif=""
for _if in $_ifs; do
ifconfig $_if | grep HWaddr | sed -e 's/.*HWaddr\s*\(.*\)/\1/' \
| grep -q -i "$WA_MAC"
if [ "$?" = "0" ]; then
cnetif="$_if"
break
fi
done
if [ "$cnetif" = "" ]; then
echo "Could not find iface with MAC $WA_MAC; trying DHCP!"
WA_BOOTMETHOD="dhcp"
elif [ "$WA_HOSTNAME" = "" \
-o "$WA_DOMAIN" = "" \
-o "$WA_IP_ADDR" = "" \
-o "$WA_IP_NETMASK" = "" \
-o "$WA_IP_GATEWAY" = "" \
-o "$WA_IP_DNS1" = "" ]; then
echo "Missing static IP config vars; trying DHCP!"
WA_BOOTMETHOD="dhcp"
fi
fi
fi
#
# Try static config if all its constraints above are met...
#
if [ "$WA_BOOTMETHOD" = "static" ]; then
echo "Statically configuring control net on $cnetif ..."
ifconfig "$cnetif" inet "$WA_IP_ADDR" netmask "$WA_IP_NETMASK" up
route add default gateway "$WA_IP_GATEWAY"
# bring up lo too just to make sure it's up
ifconfig lo inet 127.0.0.1 up
route add -net 127.0.0.0/8 dev lo
# setup resolv.conf
echo "search $WA_DOMAIN" > /etc/resolv.conf
echo "nameserver $WA_IP_DNS1" >> /etc/resolv.conf
if [ x"$WA_IP_DNS2" != x ]; then
echo "nameserver $WA_IP_DNS2" >> /etc/resolv.conf
fi
# set hostname
hosts_str="$WA_HOSTNAME"
echo "$WA_HOSTNAME" | grep -q \\.
if [ $? = 0 ]; then
hostname "$WA_HOSTNAME"
else
hostname "${WA_HOSTNAME}.${WA_DOMAIN}"
hosts_str="${WA_HOSTNAME}.${WA_DOMAIN} ${hosts_str}"
fi
# setup hosts file
echo "$WA_IP_ADDR ${hosts_str}" >> /etc/hosts
# setup a few necessary emulab files...
echo "$cnetif" > $BOOTDIR/controlif
if [ -e "/etc/emulab/bossnode" ]; then
bossnode=`cat /etc/emulab/bossnode`
bossip=`host -t A "$bossnode"`
retval="$?"
i=0
while [ "$retval" != "0" -a $i -lt 6 ]; do
bossip=`host -t A "$bossnode"`
retval="$?"
i=`expr $i + 1`
sleep 5
done
echo `echo "$bossip" | sed -n -e 's/.*has address\s*\(.*\)/\1/p'` \
> $BOOTDIR/bossip
fi
echo "$WA_HOSTNAME" > $BOOTDIR/realname
echo "$WA_IP_GATEWAY" > $BOOTDIR/routerip
echo "$WA_IP_ADDR" > $BOOTDIR/myip
echo "$WA_IP_NETMASK" > $BOOTDIR/mynetmask
exit 0
fi
#
# else default to dhclient...
#
interfaces=`ifconfig -a -s | sed '1d;/^lo /d;s/ .*$//'`
interfaces=`ifconfig -a -s | sed '1d;/^lo /d;s/ .*$//'`
#
#
...
@@ -35,6 +131,7 @@ interfaces=`ifconfig -a -s | sed '1d;/^lo /d;s/ .*$//'`
...
@@ -35,6 +131,7 @@ interfaces=`ifconfig -a -s | sed '1d;/^lo /d;s/ .*$//'`
# dhclient will leave "up") and set ONBOOT=no to prevent ifup (our caller)
# dhclient will leave "up") and set ONBOOT=no to prevent ifup (our caller)
# from doing any further configuration on this fake interface.
# from doing any further configuration on this fake interface.
#
#
echo "Discovering control net via dhcp ..."
if [ -x /sbin/dhclient ] && /sbin/dhclient -q $interfaces; then
if [ -x /sbin/dhclient ] && /sbin/dhclient -q $interfaces; then
killall dhclient
killall dhclient
...
@@ -48,6 +145,18 @@ if [ -x /sbin/dhclient ] && /sbin/dhclient -q $interfaces; then
...
@@ -48,6 +145,18 @@ if [ -x /sbin/dhclient ] && /sbin/dhclient -q $interfaces; then
ifconfig $_if down
ifconfig $_if down
fi >>$LOGDIR/dhclient.log 2>&1
fi >>$LOGDIR/dhclient.log 2>&1
done
done
#
# Now probe for wifi interfaces. We don't want to
# do this before dhcp'ing on the wired interfaces since
# there is a possibility that the wifi interface will
# grab an address and become the control net!
#
# This expects to load the madwifi-ng driver; the param states
# that no "virtual AP" device is to be created on module load.
# This is deferred until Emulab interface configuration time.
#
modprobe -q ath_pci autocreate=none
fi
fi
ONBOOT="no"
ONBOOT="no"
else
else
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment