backup static routes for freebsd (default)

Nick Rogness nick at
Tue Aug 5 09:53:06 PDT 2003

On Tue, 5 Aug 2003, Ezra Banoba wrote:

> Thanks Phil, I tried some guesswork myself to add the secondary default
> routes router style with weights and that's the only way the route add
> command will accept another default route. I do not know how freebsd
> interpretes this: route add default [gateway] [administrative weight]
> though this has no effect when i birng down the default route.
> Maybe a script to ping the gateways at intervals will do. Any other
> ideas are welcome. Thanks.

	The trick to adding a backup default route is to split 'default'
	into 2 different and more specific subnets:

	# route add PRIMARY_GW -netmask
	# route add PRIMARY_GW -netmask
	# route add default SECONDARY_GW

	Now that default is split into 2 different smaller subnets than
	'default' they will be the preferred route.  If your interface
	that connects PRIMARY_GW goes down, the first 2 routes will be
	removed, leave your backup 'default' gateway to take affect.

	This only works if PRIMARY_GW and SECONDARY_GW are on seperate
	physical networks and will also only work if the INTERFACE goes
	down.  It will not work if the PRIMARY_GW goes down but the
	physical interface connected to that network stays up.

Nick Rogness <nick at>
  How many people here have telekenetic powers? Raise my hand.
  				-Emo Philips

More information about the freebsd-questions mailing list