Network interface failure detection

Mark Hahn hahn at physics.mcmaster.ca
Fri Mar 15 15:43:43 PST 2002


> Actually I came across "IP Multipath" daemon
> in Solaris which can determine whether the
> communication failure was due to network
> card failure or due to ethernet cable pull
> out.

no.  it's nothing more than a daemon that pings routers,
at least from the man pages I can find on the net.
that has nothing to do with physical-layer diagnosis.
I consider it to be a fairly poor kind of heartbeat daemon.

> I was wondering if there was something similar
> in Linux.

use Net::Ping;

open(I,"netstat -nr|") || die("failed to netstat");
while (<I>) {
    @fields = split;
    if ($fields[3] eq "UG") {
        $gateway = $fields[1];
    }
}
close(I);

$p = Net::Ping->new("icmp");
while (1) {
    if (!$p->ping($gateway, 2)) {
        print "aww, bummer!\n";
    } else {
        print "copacetic, dude!\n";
    }
    sleep(1);
}
$p->close();




More information about the Beowulf mailing list