source: fedkit/protogeni_routing.pl @ 4e9719b

axis_examplecompt_changesinfo-opsversion-3.01version-3.02
Last change on this file since 4e9719b was d101c8c, checked in by Ted Faber <faber@…>, 14 years ago

import

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