apinger fails to start if WAN interface is down. Failover doesn't activate.

Started by timmu, February 09, 2016, 12:34:18 PM

Previous topic - Next topic
Versions    OPNsense 16.1.2-amd64
FreeBSD 10.2-RELEASE-p12
OpenSSL 1.0.2f 28 Jan 2016

My scenario:

I have two interfaces WAN_DHCP (ethernet) and MODEM_PPP (a 3G modem) and their respective gateways configured. There is a group called UPLINK, WAN is Tier 1 and default gw, MODEM is Tier 2.

Apinger is using google DNS addresses (8.8.4.4 & 8.8.8.8 ) for failure detection.

"Allow default gateway switching" is enabled under Settings -> Miscellaneous.

LAN interface is also used.

* * *

What I want to accomplish is traffic failover (from LAN) to 3G modem in case WAN link goes down. It works pretty well when the WAN interface is up and available during router startup, but..

Problem occurs when the router boots up without link on WAN interface. For example, when router is booted up in a  location where the main (wired) connection is not available yet (but will be added on a later date).

How to reproduce:

Configure interfaces as described. Remove WAN cable before powering on the router. Power on the router.

After startup, it looks that apinger took one look at the state of things and died:

Feb 9 12:50:43    apinger: Starting Alarm Pinger, apinger(56008 )
Feb 9 12:50:43    apinger: No usable targets found, exiting

If I restart apinger from web ui, it starts up, but doesn't seem to do anything useful. No default route gets set, network traffic doesn't pass through the router. It can detect delay problems.

Feb 9 12:57:22    apinger: Starting Alarm Pinger, apinger(25102)
Feb 9 12:57:40    apinger: ALARM: MODEM_PPP(8.8.8.8 ) *** delay ***
Feb 9 12:58:15    apinger: alarm canceled: MODEM_PPP(8.8.8.8 ) *** delay ***

If I plug in the WAN cable now, everything whirs into action. Default gw gets set, traffic flows.

Feb 9 13:00:12    apinger: SIGHUP received, reloading configuration.
Feb 9 13:00:19    apinger: SIGHUP received, reloading configuration.

If I remove the WAN cable now, traffic and default route fails over to MODEM properly.

Feb 9 13:01:43    apinger: ALARM: WAN_DHCP(8.8.4.4) *** down ***

* * *

I hope this description makes sense.

Any ideas how to make anything any better?