It sounds like "ping -I" is what I was looking for, but when I use it, it seems
to be sending out the packet with the right source address, but sending it to
the wrong interface.....are there any tricks here?

Here's some data (edited) to show what I'm seeing:

fxp0: inet 10.16.100.1 netmask 0xfffffff0 broadcast 10.16.100.15

fxp1: inet 192.168.243.152 netmask 0xffffff00 broadcast 192.168.243.255

when I try "ping -I 192.168.243.152 ucla.edu", I see the following:

tcpdump -i fxp0 icmp and host ucla.edu
tcpdump: listening on fxp0, link-type EN10MB
13:06:36.478450 192.168.243.152 > 128.97.27.37: icmp: echo request
13:06:37.483393 192.168.243.152 > 128.97.27.37: icmp: echo request
13:06:38.493244 192.168.243.152 > 128.97.27.37: icmp: echo request

The routing table shows:

10.16.100.0/28     link#1             UC         4        0     -     4 fxp0 
192.168.243/24     link#2             UC         1        0     -     4 fpx1 


On Wed, Oct 01, 2014 at 05:23:43PM +0100, aluc...@phangos.fr wrote:
> On 2014-10-01 16:10, Jeff wrote:
> >I have a very unreliable ISP (approximately 97% uptime).  Many of the
> >times that they go
> >down, I'm connected and can ping within their limited network, but
> >can't get to the
> >"outside world".  In these cases, I have an alternate slow speed
> >connection that I use.
> >Right now, I manually change the default route and use pfctl to invoke
> >an alternate
> >pf.conf file.
> >
> >I'm thinking that OpenOSPF, BIRD or one of the other routing oriented
> >daemons might be a
> >way to automate switching back and forth.
> >
> >Does anyone suggestions on effective ways to automate/manage this?
> >
> >Thanks!
> >     Jeff
> 
> 
> Implementing a dynamic routing protocol will ensure the switch over but
> would require either ISP cooperation or a server on the internet side.
> 
> the easiest way to achieve what you want is scripting default route change.
> Something like that should do the trick.
> 
> 
> 
> while true
> do
> 
>         route1=$(ping -I $INTERFACE_TO_ISP1 $ISP1_GATEWAY -c 1 | tail -n2 |
> head -1 | grep -c "1 received")
>         route2=$(ping -I $INTERFACE_TO_ISP1 $ISP2_GATEWAY -c 1 | tail -n2 |
> head -1 | grep -c "1 received")
>         routa=$(ip route | grep "default" | cut -d' ' -f3 | tr -d ' ')
> 
>         if [ "$route1" != "1" ]
>         then
>                 route del default
>                 route add default gw $ISP2_GATEWAY
>         else
>                 if [ "$routa" != "$ISP1_GATEWAY" ]
>                 then
>                      route del default
>                      route add default gw $ISP1_GATEWAY
>                 fi
>         fi
> 
>         sleep $waittime //you may want to wait a bit between checks
> done
> 
> Regards
> Louis
> 

-- 
===============================================================================
                        Jeff's Used Movie Finder    
                     http://www.usedmoviefinder.com
                    email: j...@usedmoviefinder.com

Reply via email to