source: fedkit/gated_routing.pl @ 5e71d34

Last change on this file since 5e71d34 was dc803a7, checked in by Ted Faber <faber@…>, 15 years ago

Set up all routing daemons from the fedkit and note interfaces we've added in a way that SEER's federated testbed will grok them.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1#!/usr/bin/perl
2
3use strict;
4use IO::File;
5use IO::Pipe;
6
7my $IFCONFIG = "/sbin/ifconfig";
8my @GATEDS= ("/usr/sbin/gated", "/sbin/gated" );
9my $GATED;
10
11my $fn = "/usr/local/federation/etc/gated.conf";
12my @live_ones;
13
14chomp (my $cif = `/usr/local/etc/emulab/control_interface`);
15
16my $ifp = new IO::Pipe();
17$ifp->reader("$IFCONFIG");
18while (<$ifp>) {
19    /^(eth\d+)/ && do {
20        push(@live_ones, $1) unless $1 eq $cif;
21    };
22}
23$ifp->close();
24
25foreach my $g (@GATEDS) {
26    if (-x $g ) {
27        $GATED = $g;
28        last;
29    }
30}
31
32die "Can't find gated in " . join(",", @GATEDS) . "\n" unless $GATED;
33
34my $f = new IO::File(">$fn") || die "Can't open $fn: $!\n";
35print $f <<END;
36smux off;
37rip off;
38ospf on {
39    backbone {
40END
41print $f "\tinterface $cif { passive; };\n";
42print $f <<END;
43    };
44    area 0.0.0.2 {
45        authtype none;
46END
47foreach my $i (@live_ones) {
48    print $f "\tinterface $i { priority 1; };\n";
49}
50print $f <<END;
51    };
52};
53END
54$f->close();
55
56$f = new IO::File(">/proc/sys/net/ipv4/ip_forward") || 
57    die "Can't open sys forwarding file:$!\n";
58print $f "1\n";
59$f->close();
60system("$GATED -f $fn");
61
Note: See TracBrowser for help on using the repository browser.