Changeset fde165c
- Timestamp:
- Sep 22, 2009 1:05:50 PM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-2.00, version-3.01, version-3.02
- Children:
- 8c9933c
- Parents:
- e26c240
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedkit/config_from_tunnelip.pl
re26c240 rfde165c 2 2 3 3 use strict; 4 use IO::File;5 4 use IO::Pipe; 6 5 use Getopt::Long; 7 6 7 # Commands to use below. These all seem to be in the same place on FreeBSD and 8 # Lunix 8 9 my $TMCC = "/usr/local/etc/emulab/tmcc"; 9 10 my $FINDIF = "/usr/local/etc/emulab/findif"; … … 11 12 my $ROUTE = "/sbin/route"; 12 13 13 my $tmcc = new IO::Pipe || die "Can't create tmcc pipe: $!\n"; 14 my $interface; 15 my $ip; 16 my $mac; 17 my $netmask ="255.255.255.0";18 my $router; 19 my $routedest; 14 my $tmcc = new IO::Pipe || die "Can't create tmcc pipe: $!\n"; # To parse tmcc 15 my $interface; # Interface with external address 16 my $ip; # IP address of external interface 17 my $mac; # MAC address 18 my $netmask; # Netmask 19 my $router; # Router for the internet 20 my $routedest; # Add host route to this address (if given) 20 21 22 # Linux and FreeBSD use slightly different route syntax, so get the OS 21 23 my $os = `uname`; 22 24 chomp $os; 23 25 26 # Option parsing, --destination sets $routedest 24 27 GetOptions('destination=s' => \$routedest); 25 28 29 # Parse out the info about tunnelips 26 30 $tmcc->reader("$TMCC tunnelip"); 27 31 while (<$tmcc>) { … … 36 40 die "No MAC information for tunnel.\n" unless $mac; 37 41 42 # Use the emulab findif command to get the right interface to configure 38 43 $interface = `$FINDIF $mac`; 39 44 chomp $interface; 40 45 die "Can't get interface for mac address $mac: $?" if $? || !$interface; 41 46 47 # Do the ifconfig 42 48 my @ifconfig = ($IFCONFIG, $interface, $ip); 43 49 push(@ifconfig, 'netmask', $netmask) if $netmask; … … 46 52 die join(" ", @ifconfig) . " failed: $!\n" if $?; 47 53 54 # Add the host route, if needed 48 55 if ($routedest ) { 49 56 if ($router) {
Note: See TracChangeset
for help on using the changeset viewer.