Dynamically remove static routes when gateway down



  • Hi,

    I have a pFSense 2.2.6 firewall configured with static routes pointing to my WAN gateway e.g. 62.0.0.0/16. I also have OpenBGPD running to advertise these prefixes to a BGP router on my LAN side. The issue is that I would like to only advertise the prefixes ONLY IF they are reachable to avoid blackholing.

    Normally on a Cisco router I would do the following:
    1. Create an IP SLA track to monitor an IP address on the internet e.g. 8.8.8.8
    2. Configure static routes pointing to the WAN gateway but tracked against the IP SLA
    3. Redistribute the static routes into BGP

    This would mean that while the IP SLA was 'up', the static routes would be injected into the routing table which in turn would then get redistributed into BGP. If the IP SLA went 'down' the static routes would drop out of the routing table and hence out of BGP too.

    Is there a way to do this in pFSense?

    I can see that pFSense can monitor Gateway health and you can even set it with an 'Alternate Gateway IP' to monitor 8.8.8.8) so I could monitor but there doesn't seem to be any obvious way for it to remove the static routes when the gateway goes 'offline'.

    There might be a completely different way to do this so appreciate any thoughts on this!



  • Did you ever find a solution to your problem?