On Thu, Dec 03, 2015 at 03:12:10PM +0000, Rohrmann Sascha wrote: > > Well, you could use static default-route and 'check link' option, but that > > will help you only in the third case, not in the second one. > > For the second case, you must have some other way to establish whether ISP > > is up or down, either by running some routing protocol between > > you and ISP, or running BFD session. > > Just as you said, that will only help me in the third case. > In which way should BFD be able to accomplish my goal? > In my understandings BFD only checks if the link is available. If this isn't > given, BFD tells Bird this problem.
BFD checks whether specified/destination IP is available (but it also must run BFD). Therefore both link and host must be up. > Second problem is, not every ISP supports BFD yet because BFD is kinda new. That is true, and also BFD-controlled static routes are only in devel version of BIRD, not in v1.5.0 > I was thinking about a simple ping which checks the availability of the > opposite party. > Am I able to include a simple shell script in bird? No > Do you have more information and/or tips for me, by chance? As others wrote, you could do periodic pinging by e.g. fping and enable/disable a static protocol using birdc (birdc disable XXX). See the attached script, which does something like that and estimating packet loss. > > I was thinking about the bfd protocol, but bfd is kinda new and you can't > > run more than one instance in bird. > > Well, is there any reason why to run multiple BFD instances in BIRD? > > Well... you could create one bfd instance for one single interface. > Furthermore you could then check the availability for e.g. my problem instead > of checking all BFD instances. I don't understand here. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santi...@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
#!/usr/bin/perl $ip = 'A.B.C.D'; $logfile = "/var/log/XXX"; $logfile2 = "/var/log/YYY"; $link_up = "/usr/sbin/birdc enable XXX"; $link_down = "/usr/sbin/birdc disable XXX"; $cmd = 'fping -c 40 -p 50 ' . $ip . ' 2>&1 >/dev/null'; $state = 0; $start = 1; $counter = 50; $tc = 0; open(LOGFILE, '>>', $logfile); print LOGFILE localtime () . ': watchdog (' . $ip . ") started\n"; close(LOGFILE); while (1) { $unreach = `$cmd`; $unreach =~ s/.*\/([[:digit:]]+)%.*/\1/s; open(LOGFILE2, '>>', $logfile2); if ($tc == 0) { print LOGFILE2 localtime () . ":"; } print LOGFILE2 " " . (0+$unreach) . "%"; $tc ++; if ($tc > 10) { print LOGFILE2 "\n"; $tc = 0; } close(LOGFILE2); if ($unreach == 0) { $counter -= 100; } elsif ($unreach < 3) { $counter -= 50; } elsif ($unreach < 6) { $counter -= 10; } else { $counter += $unreach; } if ($counter > 300) { $counter = 300; } if ($counter < 0) { $counter = 0; } if ((($start) && ($unreach < 6)) || (($state == 0) && ($counter < 30))) { system ($link_up); $state = 1; $start = 0; open(LOGFILE, '>>', $logfile); print LOGFILE localtime () . ': Link (' . $ip . ") online\n"; close(LOGFILE); } if ((($start) && ($unreach >= 6)) || (($state == 1) && ($counter > 95))) { system ($link_down); $state = 0; $start = 0; open(LOGFILE, '>>', $logfile); print LOGFILE localtime () . ': Link (' . $ip . ") offline\n"; close(LOGFILE); } sleep 2; }
signature.asc
Description: Digital signature