All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Lobato <tomlobato@gmail.com>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] DGD patch not detecting dead gateway
Date: Wed, 07 Feb 2007 23:52:03 +0000	[thread overview]
Message-ID: <45CA6623.8000703@gmail.com> (raw)
In-Reply-To: <7fe14e000701182100l5b1474eai853a0077c821a835@mail.gmail.com>

  Hi!

  Thank you for the script. I'm trying it.

  Well, I made a simple modification and would like to hear opnions.
  Until now, I just added one more TESTIP, so I'm pinging one IP for each link. 
  Also I'm using the IP instead name address, and used the DNS IP of each provider
for the ping. I made this because the ping to external sites (yahoo, google) is too slow
here, mainly when the link is under heavy load. So I'm afraid it can try ping 
without success and "think" the link is down.
  Also, for don't get falses 'link down', did you tried to increase the number of 4
ping fails before replace the route? What do you think about?

  I appreciate suggestions,


  PS: although alteration be so simple, if someone want to see, tell me and I send a mail.



  Tom Lobato



Manish Kathuria wrote: 

> The script is appended. It assumes that you have followed the steps as
> described in nano.txt with or without applying the patches. Though it
> appears to be very simplistic, its working great at a number of
> locations.
>
> #!/bin/bash -x
>
> TESTIP=www.yahoo.com
> CHECK=0
> ISPA=1
> ISPB=1
> LINKSTATUS=1
> COUNTA=0
> COUNTB=0
> EXTIF1=eth1
> EXTIF2=eth2
> GW1\x172.16.1.1
> GW2\x192.168.1.1
> W1=1
> W2=1
>
> while : ; do
>
>         ping -I $EXTIF1 -c 1 $TESTIP > /dev/null  2>&1
>         RETVAL=$?
>         if [ $RETVAL -ne 0 ]; then
>                 COUNTA=`expr $COUNTA + 1`
>         else
>                 COUNTA=0
>         fi
>
>         if [ $COUNTA -ge 4 ]; then
>                 ISPA=0
>         else
>                 ISPA=1
>         fi
>
>         ping -I $EXTIF2 -c 1 $TESTIP > /dev/null  2>&1
>        RETVAL=$?
>        if [ $RETVAL -ne 0 ]; then
>                COUNTB=`expr $COUNTB + 1`
>        else
>                COUNTB=0
>        fi
>
>        if [ $COUNTB -ge 4 ]; then
>                ISPB=0
>        else
>                ISPB=1
>        fi
>
>
>         if [ $ISPA -eq 1 ]; then
>                 if [ $ISPB -eq 1 ]; then
>                         NEWSTATUS=1
>                 elif [ $ISPB -eq 0 ]; then
>                         NEWSTATUS=2
>                 fi
>         elif [ $ISPA -eq 0 ]; then
>                 if [ $ISPB -eq 1 ]; then
>                         NEWSTATUS=3
>                 fi
>         fi
>         
>         case $LINKSTATUS in
>
>         1)      if [ $NEWSTATUS -eq 2 ]; then
>                         ip route replace default via $GW1 dev $EXTIF1
>                 elif [ $NEWSTATUS -eq 3 ]; then
>                         ip route replace default via $GW2 dev $EXTIF2
>                 fi;;
>
>         2)      if [ $NEWSTATUS -eq 1 ]; then
>                         ip route del default
>                         ip route replace default table 222 proto static \
>                                 nexthop via $GW1 dev $EXTIF1 weight $W1\
>                                 nexthop via $GW2 dev $EXTIF2 weight $W2
>                 elif [ $NEWSTATUS -eq 3 ]; then
>                         ip route replace default via $GW2 dev $EXTIF2
>                 fi;;
>
>         3)      if [ $NEWSTATUS -eq 1 ]; then
>                         ip route del default
>                         ip route replace default table 222 proto static \
>                                 nexthop via $GW1 dev $EXTIF1 weight $W1\
>                                 nexthop via $GW2 dev $EXTIF2 weight $W2
>                 elif [ $NEWSTATUS -eq 2 ]; then
>                         ip route replace default via $GW1 dev $EXTIF1
>                 fi;;
>
>         *)      echo;;
>                 
>         esac
>
>         LINKSTATUS=$NEWSTATUS
>         sleep 10
> done
>
> Let me know if you can think of any improvements or modifications.
>

_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

  parent reply	other threads:[~2007-02-07 23:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-19  5:00 [LARTC] DGD patch not detecting dead gateway Tom Lobato
2007-01-19 18:57 ` Manish Kathuria
2007-01-20  4:13 ` Grant Taylor
2007-01-23  0:40 ` Tom Lobato
2007-01-27 14:52 ` Manish Kathuria
2007-01-27 16:24 ` Manish Kathuria
2007-01-28 16:12 ` Tom Lobato
2007-01-28 16:47 ` Manish Kathuria
2007-02-07 23:52 ` Tom Lobato [this message]
2007-02-08 19:19 ` Manish Kathuria
2007-02-12 11:34 ` Tom Lobato
2007-05-11  2:56 ` Salim S I
2007-05-14  5:47 ` Manish Kathuria
2007-05-14  5:59 ` Salim S I

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45CA6623.8000703@gmail.com \
    --to=tomlobato@gmail.com \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.