I have the same issue. Resolved it with ifstated.
In OpenBSD 3.8 comes in base system.
With pf switches route-to.

my setup:
ifstated.conf:
 $OpenBSD: ifstated.conf,v 1.6 2005/02/07 06:08:10 david Exp $

init-state primary

net = '( "ping -t 128 -q -c 1 -w 1 159.148.60.20 > /dev/null" every 10 || \
    "ping -t 128 -q -c 1 -w 1 159.148.95.16 > /dev/null" every 10 || \
    "ping -t 128 -q -c 1 -w 1 195.2.123.94 > /dev/null" every 10)'


state primary {
        init {
                run "echo `date` up >> /var/log/ifstated.log"
                run "/sbin/pfctl -a nattelia -Fn"
                run "/sbin/pfctl -a telia -Fr"
        }
        if ! $net
                set-state demoted
}

state demoted {
        init {
                run "echo `date` down >> /var/log/ifstated.log"
                run "echo nat on rl0 from 192.168.0.0/16 to any -\> \(rl0\) | 
/sbin/pfctl -a nattelia -f -"
                run "echo pass in quick on \{ rl1 rl2 \} route-to \(rl0 `cat 
/etc/mygate.dhcp`\) \
                from 192.168.0.0/16 to any modulate state | /sbin/pfctl -a 
telia -f -"
        }
        if $net
                set-state primary
}

Reply via email to