View Single Post
  #6   (View Single Post)  
Old 12th December 2011
alpha202ej alpha202ej is offline
Port Guard
 
Join Date: Dec 2011
Posts: 10
Default

So using multiple examples I was able to make this:

Code:
net0 = '"ping -q -c1 -w1 x.x.x.x >/dev/null" every 3'
net1 = '"ping -q -c1 -w1 y.y.y.y >/dev/null" every 3'

init-state zero

state zero {
    init {
        run "route add -mpath default x.x.x.x"
        run "route add -mpath default y.y.y.y"
    }
    if ! $net0
        set-state one
    if ! $net1
        set-state two
        if $net0 {
                if $net1
                        set-state zero
                }

}

state one {
    init {
        run "route delete -mpath default x.x.x.x"
        run "route add -mpath default y.y.y.y"
    }
        if ! $net0
            set-state one
    if $net0 {
                if $net1
                        set-state zero
                }
}

state two {
    init {
        run "route delete -mpath default y.y.y.y"
        run "route add -mpath default x.x.x.x"
    }
    if ! $net1 {
        if $net0
            set-state one
    }
}
x.x.x.x is the first hop for my default gateway on my first ISP.
y.y.y.y is the first hop for my default gateway on my second ISP.

The script does a ping test of each of the ISPs and if one stops responding, it removes the route. Once it responds, it adds it back on.

It serves its purpose quite well in terms of removing the route when it stops resolving but in practice, I still can't get the fail over to work. Not only that, when browsing many web pages half load. Ping tests work just fine but if I am going to replace this I cannot have web pages half loading

As always, any help or ideas that would help with these issues would by greatly appreciated.

Thanks!
Reply With Quote