Hi,

I want to setup ifstated  for multiple links.


My requirement is very simple.

I have 2 links. one is ADSL and the other is leased-line.

When both links are up, outgoing traffic should be balanced via both links.

When ADSL is DOWN, outgoing traffic  should go via Leased line

When Leased line is DOWN, outgoing traffic should go via ADSL line.

I am wrinting /etc/ifstated.conf file.

But , I still haven't achieved it. Could you pls help me to solve this.

These are the urls I refer.

http://gouloum.fr/doc/multilink.html

http://www.suborbital.org.uk/canofworms/index.php?/archives/2-Failover-routing-with-OpenBSD-and-ifstated.html


And, here's my /etc/ifstated.conf file


pingVIAbothlinks = '( "ping -c 1 -I 192.168.1.253 www.google.lk
>/dev/null" every 10 && "ping -c 1 -I 172.16.10.253 www.google.lk
>/dev/null" every 10)'
pingVIAadsl = '( "ping -c 1 -I 192.168.1.253 www.google.lk >/dev/null"
every 10)'
pingVIAleasedline  = '( "ping -c 1 -I 172.16.10.253 www.google.lk
>/dev/null" every 10)'

#init-state zero

state zero {
    init {
        run "route add -mpath default 192.168.1.1"
        run "route add -mpath default 172.16.10.254"
        }
        if ! $pingVIAadsl {
            set-state one
    }

}

state one {
    init {
        run "route delete -mpath default 192.168.1.1"
        run "route add -mpath default 172.16.10.254"
    }
    if ! $pingVIAleasedline {
            set-state two
    }
}

state two {
    init {
        run "route delete -mpath default 172.16.10.254"
        run "route add -mpath default 192.168.1.1"
    }
    if  $pingVIAbothlinks {
            set-state zero
    }
}



Pls note:

192.168.1.253 is the ip of the PF box that connects to ADSL side.

172.16.10.253 is the leased line ip of the PF box that connects to
Leased line side.


here are my configuration details of the PX box ( OpenBSD - 5 - 64 bit )


# cat /etc/hostname.ne1
inet 172.16.10.253 255.255.255.0
!route add -mpath default 172.16.10.254


# cat /etc/hostname.ne2
inet 192.168.1.253 255.255.255.0
!route add -mpath default 192.168.1.1


# netstat -r |grep default
default            192.168.1.1        UGSP       0     2274     -     8 ne2
default            172.16.10.254      UGSP       1      280     -     8 ne1

I have enabled below values in /etc/sysctl.conf file.


net.inet.ip.forwarding=1

net.inet.ip.multipath=1



hope to hear from you.







-- 
Thank you
Indunil Jayasooriya

Reply via email to