Policy Based Routing with failover route

Hi VyOS gurus,

I am new here. I have a vyos router setup at home, on a home internal network. My LAN subnet (for internal users) is I have set up TMG2010 with bandwidth splitter so that I can monitor how much traffic my kids use, and bandwidth splitter addon to TMG2010 will cut them off when they use their “quota”. Unfortunately I don’t have unlimited internet downloads from my Internet provider, so this is how I manage things.

To send the kids internet traffic to TMG2010. I use a policy based route in vyos. So essentially I have created an address group in vyos, and chucked all the kids IP addresses of all their devices (tablets, phones, computers etc) into that vyos address group. Then I created a policy based route that says, “if any source IPs match the IPs listed in the address group, re-route them to the TMG server, rather than directly to the NAT modem”.

This works fantastically, until I need to bring down the TMG2010 box for windows updates, or maintainence.

Is there any way that I can have a second route, say “TMG is distance 10, direct to modem is distance 20” in the table that the policy based route refers to? If I could, then If the route via the TMG server was down, then vyos would choose the alternate static route?

I have tried by adding a second static route with a larger “distance” to the existing table for ingress traffic from my LAN, it doesn’t work.

I have tried adding a second rule, with a larger rule number to the policy based route that points to a separate static route table that forwards direct to my modem and bypasses the TMG server, it doesn’t work.

Essentially I want to have a policy based route that sends to a particular gateway IF THAT GATEWAY IS UP. If it is down, I am hoping vyos can automatically choose a different route.

Is this possible???

Happy to share more information if need be. Thanks for any help!

Hi @snomis

I’d recommend some scripting for this, such as a ping script for basic gateway reachability and layer in command scripting:


Hello, @snomis!
As an alternative way, your case can be perfectly solved by load-balancing wan in failover mode, if a connection to the modem and to the TMG2010 was made through different VyOS interfaces.