source: fedkit/setup_bridge.pl @ 51d3aa0

Last change on this file since 51d3aa0 was 2c16731, checked in by Ted Faber <faber@…>, 11 years ago

Ping hosts on tap establishment

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