[662] in linux-net channel archive
Re: Automatically changing default route
daemon@ATHENA.MIT.EDU (Matthias Urlichs)
Thu Jul 13 07:44:55 1995
To: submit-linux-dev-net@ratatosk.yggdrasil.com
From: urlichs@smurf.noris.de (Matthias Urlichs)
Date: 12 Jul 1995 09:57:27 +0200
In linux.dev.net, article <199507100022.TAA04844@mrsagw.mrsa.com>,
Jeff Noxon <jeff@mrsagw.mrsa.com> writes:
> I have two connections to the internet through two different local providers.
> Between the two of them, I am able to stay online about 90-95% of the time.
> They are both dialup SLIP connections, and I use a program of my own creation
> to keep them both connected as much as possible.
>
The problem is that the two interfaces have different IP numbers; thus,
existing connections will still hang or die when the line goes down.
> Yes, both providers are pathetic. There isn't anything I can do about that,
> though...
>
Write a script to ping both remote sites and point the default route to
whoever answered last. Or, write one to disconnect and reconnect when the
line dies. I'm doing the latter with the following hack:
#!/usr/bin/perl5
$job="./slipto -p /dev/arnet0 -d -f -S -M 193.141.54.129 193.141.43.29";
chop($uname=`uname -r`);
chdir "/usr/local/isdn/bin-$uname" ||
chdir "/usr/local/isdn/bin" ||
die "No Directory";
$SIG{"CHLD"} = "IGNORE";
$ppd=0;
sub ala {
print "*** Leitung down ***\n" if $ppd;
kill 15, $ppd if $ppd;
sleep(8) if $ppd;
$ppd=fork;
if($ppd == 0) {
exec $job;
die;
}
$SIG{"ALRM"}="ala";
alarm(100);
}
&ala;
open(PING,"ping -i 30 193.141.43.29 2>/dev/null |");
while(<PING>) {
alarm(100);
}
exit 1;
--
Remember, you know more than I do.
--
Matthias Urlichs \ XLink-POP Nürnberg | EMail: urlichs@smurf.noris.de
Schleiermacherstraße 12 \ Unix+Linux+Mac | Phone: ...please use email.
90491 Nürnberg (Germany) \ Consulting+Networking+Programming+etc'ing 42
PGP: 1B 89 E2 1C 43 EA 80 44 15 D2 29 CF C6 C7 E0 DE
Click <A HREF="http://smurf.noris.de/~urlichs/finger">here</A>.