WAN Failover to 4G with pfSense

Home, Bangkok, Thailand, 2020-08-07 21:18 +0700

#infrastructure

I’m always trying to improve my home infrastructure and make it more robust. In February and March I made improvements around monitoring and automatically reacting to power events.

More recently we had a day-long outage of our domestic ADSL Internet connection which was pretty disruptive given we were working from home due to COVID at the time. It hit me that my pfSense router had a WiFi radio that was no longer being used since I put in a UniFi switch and access point - could it be possible to tether my pfSense router to my 4G cellphone and route my entire LAN through it?

Yes it could - and it’s very simple too:

Interface Configuration

First configure the WiFi interface on the pfSense box to connect to the phone’s personal hotspot:

  • Select Interfaces > your WiFi interface - I’ve already renamed my WiFi interface to “WAN_WIFI” by this point:

  • Make sure the interface is enabled:

  • Scroll down and enter the hotspot SSID and password:

  • After a few seconds the router should connect to your personal hotspot:

  • You can also check the upstream connectivity in Status > Interfaces:

Gateway Group

Next we have to put the main ADSL WAN and the new WiFi tethered 4G WAN into a “Gateway Group” so we can configure failover:

  • Select System > Routing then click Gateway Groups
  • Click Add and give the new Gateway Group a name. Then select the main WAN to be Tier 1 and the fallback WiFi WAN to be Tier 2:

  • Save and go back to the Gateway tab - there select the new Gateway Group to be the default gateway:

Test

As a simple test I kicked off a ping from my Windows desktop:

ping /t www.google.com

Then turned off my ADSL router via the smart switch that controls it:

Then watched as pfSense failed over the connection from the now offline ADSL uplink to the tethered 4G - it took around 15 seconds for the failover to happen:

pfSense also correctly reverted back to the ADSL WAN uplink when it was back online.

Conclusion

For my use-case ADSL outages are very rare so I don’t need this solution running all the time. However failover is semi-automated in that I just need to flip on the personal hotspot on my phone and wait for pfSense to connect and failover the uplink. This can be done without even leaving my seat and it takes only 20 to 30 seconds in total to get back online.

I love having these kinds of robust and reliable systems around my house because the more of them we have the less downtime and stress is needed to fix stuff that breaks. Given how easy this is to set up, I definitely recommend that anyone running a pfSense router that has a WiFi radio take 10 minutes to enable it.

References