Re: Double Net cards?


Subject: Re: Double Net cards?
From: Bryn Hughes (linux@mail.demian.shacknet.nu)
Date: Mon Apr 02 2001 - 09:46:45 MDT


>>I m wondering if you could have a script shut down the interface
>>and restart the adapter if it can't ping your router. On the other
>>hand, if you can get the tulip card to work, I don't forsee it
>>going down much if at all - DEC made a very robust chip, and the
>>driver support (at least, on most other Linux platforms) really
>>takes advantage of the hardware
>
>Do you know of any scripts like that? I had thoughts like that, but
>just couldn't make one that worked well.
>

I've got a script which does exactly that... I was having some
problems with my ISP's DHCP server, my script checks once an hour to
make sure it can ping the router and restarts the interface if it
can't. Replace the <YOUR_IP_ADDRESS_HERE!!> bit with your IP
address, NO QUOTES, BRACKETS, ETC... Also change eth1 to your
interface name. The script will ping once, if it doesn't get a reply
it will then try a second time, if it still doesn't get a reply it
will restart that interface.

# Written by Bryn Hughes, March 15, 2001
# This little script performs regular network checks and then, if it detects
# that the connection has gone down for some reason, attempts to reconnect it.
#
# I really don't know why this isn't a standard part of Linux already!!

RESPONSE=["$(ping -nc 1 <YOUR_IP_ADDRESS_HERE!!> | grep icmp)"]

if [ "${#RESPONSE}" -lt 5 ]; then

RESPONSE_2=["$(ping -nc 1 <YOUR_IP_ADDRESS_HERE!!> | grep icmp)"]

         if [ "${#RESPONSE_2}" -lt 5 ]; then
                 /sbin/ifdown eth1
                 /sbin/ifup eth1
         fi

fi



This archive was generated by hypermail 2a24 : Mon Apr 02 2001 - 09:50:30 MDT