which-iface.sh 410 Bytes
Newer Older
1
#!/usr/bin/sh
Robert Ricci's avatar
Robert Ricci committed
2 3 4 5 6
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006 University of Utah and the Flux Group.
# All rights reserved.
#
7 8 9 10 11 12 13 14

LINKNAME=planetc
HOSTNAME=`cat /var/emulab/boot/nickname | sed 's/\..*//'`
LINK="$HOSTNAME-$LINKNAME"
LINKIP=`grep "$LINK" /etc/hosts | cut -f1`
IFACENAME=`ifconfig -a | perl -e 'while(<>) { if (/^(eth\d+)/) { $if = $1; } if (/10.1/) { print "$if\n"; exit 0; }} exit 1;'`

echo $IFACENAME