backup static routes for freebsd (default)
philip.payne at uk.mci.com
Tue Aug 5 02:38:54 PDT 2003
> I have a gatway box running freebsd 4.8 and several links to
> the internet
> via different ISP's.
> This box is connected directly to one of the ISP's but also
> has access to
> the other gatways via the LAN.
> I would like to setup static backup (default) routes such
> that when and if
> the main link goes down, the default route for this box is
> changed to point to another router on the LAN.I am having trouble
> implementing this on freebsd.
> Any ideas?
First, I'm more of a router person than familiar with how FreeBSD calculates
it's routing table so the following is all guesswork from "man route".
The issue with static routes is that they rarely have any idea of the status
of their destination but this can be fudged if you're using point-to-point
interfaces e.g. DSL, leased line. In general terms what you'd be doing on a
1) Have a default route directed out a point-to-point interface connected to
the ISP (not the IP address) so that when the interface is down, the static
route is removed from the live routing table.
2) Have a weighted default route via an alternative IP address. The weight
implies this route is only used when the former default route is not
I've read "man route" and I get the impression you can add a route via an
interface rather than a destination with the switch "-interface" so your
first step is to add a default route along the lines
> route add default -interface <int_name>
... this is a guess as the man page isn't explicit. Also, I don't know
whether this route remains live or is removed as required during a failure
on the point-to-point interface you'd configure this to. It definitely won't
work if your primary access method is a broadcast interface e.g. ethernet.
Further, I can't find any details on adding a weight to a static route to
create the secondary route so I'm not sure this is going to be possible via
an automatic routing table kind of thing.
So.....(getting to the point very slowly)
The only other method I can think of would be a script to ping the far end
addresses regularly in order. Depending on which one is up, you could inject
a default route statement as required to the correct destination.
I'd be interested in other suggestions as this doesn't sound entirely great
as there are many other reasons than link failure why an address wouldn't be
More information about the freebsd-questions