1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | use strict; |
---|
4 | |
---|
5 | use gateway_lib; |
---|
6 | |
---|
7 | use Getopt::Long; |
---|
8 | |
---|
9 | my $tapno; |
---|
10 | my $addr; |
---|
11 | my $dest; |
---|
12 | my $iface; |
---|
13 | my $fedkit_dir= "/usr/local/federation"; |
---|
14 | my $perl = "/usr/bin/perl"; |
---|
15 | my $peer; |
---|
16 | my $use_file; |
---|
17 | my %opts = ( |
---|
18 | 'tapno=s' => \$tapno, |
---|
19 | 'addr=s' => \$addr, |
---|
20 | 'dest=s' => \$dest, |
---|
21 | 'peer=s' => \$peer, |
---|
22 | 'use_file', \$use_file, |
---|
23 | ); |
---|
24 | |
---|
25 | exit(20) unless GetOptions(%opts); |
---|
26 | gateway_lib::read_config(gateway_lib::emulab_config_filename(), \%opts) |
---|
27 | if $use_file; |
---|
28 | |
---|
29 | die "Only one of dest and addr is allowed\n" if $addr && $dest; |
---|
30 | |
---|
31 | $iface = $dest ? |
---|
32 | gateway_lib::dest_to_iface($dest) : gateway_lib::addr_to_iface($addr) |
---|
33 | if !$iface; |
---|
34 | |
---|
35 | print "iface is $iface\n"; |
---|
36 | |
---|
37 | gateway_lib::bind_tap_to_iface($tapno, $iface); |
---|
38 | gateway_lib::ping_peer($peer) |
---|
39 | if $peer; |
---|
40 | |
---|
41 | exit(0); |
---|
42 | |
---|
43 | =pod |
---|
44 | |
---|
45 | =head1 NAME |
---|
46 | |
---|
47 | B<setup_bridge.pl> - Connect a tap and local interface. Called both remotely |
---|
48 | and locally to establish the two sides of the bridge. |
---|
49 | |
---|
50 | =head1 OPTIONS |
---|
51 | |
---|
52 | =over 8 |
---|
53 | |
---|
54 | =item B<addr=>I<address> |
---|
55 | |
---|
56 | Address of the local interface to connect to the given tap interface on the |
---|
57 | given bridge interface. |
---|
58 | |
---|
59 | =item B<dest=>I<destination> |
---|
60 | |
---|
61 | Attach the interface on which I<destination> can be reached to the given |
---|
62 | tap/bridge combo. |
---|
63 | |
---|
64 | =item B<tapno=>I<integer> |
---|
65 | |
---|
66 | The tap interafce to connect. This will be the integer that follows tap and |
---|
67 | bridge in the interface names. |
---|
68 | |
---|
69 | =item B<use_file> |
---|
70 | |
---|
71 | If given read additional parameters from the file in |
---|
72 | /proj/I<project>/exp/I<experiment>/tmp/I<hostname>.gw/conf where those are the |
---|
73 | current testbed project and experiment and the hostname is before the first |
---|
74 | dot. The file is option: value. |
---|
75 | |
---|
76 | |
---|
77 | =back |
---|
78 | |
---|
79 | =head1 SYNOPSIS |
---|
80 | |
---|
81 | B<setup_bridge.pl> Connects the established ssh tunnel (a tap interface) to |
---|
82 | a local interface through a bridge interface. Traffic on the local interface |
---|
83 | will cross the network over the ssh tunnel and be released onto the net via a |
---|
84 | symmetrical setup on the peer. |
---|
85 | |
---|
86 | The interface to attach can be given either by its interface or an address/DNS |
---|
87 | name to reach. In either case, all IP addresses are removed from the |
---|
88 | bound interface. |
---|
89 | |
---|
90 | =head1 AUTHORS |
---|
91 | |
---|
92 | Ted Faber <faber@isi.edu> |
---|
93 | |
---|
94 | =cut |
---|