Hi !
I have a problem with equal cost multipath. I have two 2 mb lines to the internet with 
diffrent routes.
I just use one line on our firewall, but are going to set up the other line now.
But when i set it up like this
route add -net 0.0.0.0 gw xxx.xxx.xxx.xxx netmask 0.0.0.0
route add -net 0.0.0.0 gw xxx.xxx.xxx.xxx netmask 0.0.0.0
and i have the net set up like this

      internet
router        router
        switch
            fw

the traffic stops if one of the routers  goes down, it does not fall back to the other 
router (like i want it to do).
Then i thought that if I set up one interface  to each router and then run a ping 
script that looks if the router in down or not.
And if it is down it takes away the route to that router untill it is alive again.
Something like this. ( I can´t make scripts in linux so I don´t know if anything is 
right in the script).
But it might show what i want the script to do :)


#!/bin/bash

:start

ping -c 1 -I eth0 www.download.com &> ping1
ping -c 1 -I eth1 www.download.com &> ping2

        cat ping1 | grep icmp_seq=0 &> $A1
        cat ping2 | grep icmp_seq=0 &> $B1
       
# eth0 ping seq

        if [ "$A1" = " " ] do
        echo down &> $ETH0
        done

        if [ "$A1" = !" " ] do
        echo up &> ETH0
        done
       
        if [ "$ETH0" = "down" ] do
        cat /proc/net/route |grep A04655D4 &> $A2
        done
       
        if [ "$A2" = !" " ] do
        /sbin/./route del default gw 212.85.70.160
        done
       
        if [ "$ETH0" = "up" ] do
        cat /proc/net/route | grep A04655D4 &> $A3
        done
               
        if [ "$A3" = " " ] do
        /sbin/./route add -net 0.0.0.0 gw 212.85.70.160 netmask 0.0.0.0
        done

#eth1 ping seq
       
        if [ "$B1" = " " ] do
        echo down &> $ETH1
        done

        if [ "$B1" = !" " ] do
        echo up &> ETH1
        done
       
        if [ "$ETH1" = "down" ] do
        cat /proc/net/route |grep A14655D4 &> $B2
        done
       
        if [ "$B2" = !" " ] do
        /sbin/./route del default gw 212.85.70.161
        done
       
        if [ "$ETH1" = "up" ] do
        cat /proc/net/route | grep A14655D4 &> $B3
        done
               
        if [ "$B3" = " " ] do
        /sbin/./route add -net 0.0.0.0 gw 212.85.70.161 netmask 0.0.0.0
        done

        pause 15 sek
        goto :start


all help would be very much appreciated

/Rikard
*****************************************************
Rikard Lindberg
Selek AB
Tel: +4622662500
Fax: +4622612895
Internet Address: [EMAIL PROTECTED]
Home Page: http://www.selek.se
*****************************************************
-
[To unsubscribe, send mail to [EMAIL PROTECTED] with
"unsubscribe firewalls" in the body of the message.]

Reply via email to