Failover from cable to cell modem with failback - example
-
I have been suffering 2-3 service outages daily from my cable ISP. Outages typically persist for 5-20 minutes when packet loss is > 25% and/or delay exceeds 2000ms. Then it recovers. During the outage our phones, security system, Zoom sessions and etc.. are disrupted.
To cope with this I bought a Netgear 2120 modem and subscribed to a At&T data plan which is capped at 3Gigabytes monthly. After some pain I got this working. During WAN outages my router switches new sessions to the Cell. After the outage ends a script is necessary to break connections on Cell and force traffic back onto the WAN. Otherwise, traffic flows onto the cell indefinitely exceeding the data cap.
Pfsense multi-WAN documentation mentions that its possible to configure simple failover (with no load balancing) but gives no example and is otherwise incoherent. I did find this rather old user discussion which was helpful.
https://forum.netgate.com/topic/84269/multi-wan-gateway-failover-not-switching-back-to-tier-1-gw-after-back-onlineBelow are screen shots of my working config as an example. Hopefully it will benefit others.
#!/bin/sh
*** kills firewall states on failover CELL when WAN is up ***
WAN_NAME=WAN_DHCP
CELL_IF=igb2
CELL_DNS_IP=1.0.0.1:53CURRENT_TIME="$(date +"%c")"
WAN_STATUS=/usr/local/sbin/pfSsh.php playback gatewaystatus brief | grep "$WAN_NAME" | awk '{print $2}'
if [ "$WAN_STATUS" = "none" ]; then
# the following line may need to be tweaked depending on your needs
CELL_NSTATES=pfctl -s state | grep "$CELL_IF" | grep -v " -> $CELL_DNS_IP" | wc -l
if [ "$CELL_NSTATES" -gt 0 ]; then
echo "$CURRENT_TIME: WAN is online, but connections remain on $CELL_IF. Killing states."
pfctl -F state
fi
else
echo "$CURRENT_TIME: WAN is down"
fi
#Reply -
Check out https://www.netgate.com/resources/videos/multi-wan-on-pfsense-23.html
-Rico
-
This post is deleted! -
Bug Fix.
CELL Gateway must be unmonitored. Otherwise an ICMP connection may be present leading to unwanted state resets.
-
@Rico - As far as I can see PFsense built in features as presented handle failover reasonably well. But failback on an expensive and data capped service like CELL is not well supported. The script I am using is a necessary hack because of this.