Multiple default routes on multihome host

Wes Peters wes at opensail.org
Wed Feb 20 02:45:37 UTC 2008


>

At 18 Feb 2008 21:55:50 +0000, Nick Barnes <Nick.Barnes at pobox.com>  
wrote:

> At 2008-02-18 21:36:18+0000, Bill Moran writes:
>> In response to Nick Barnes <Nick.Barnes at pobox.com>:
>>
>>> I have a multi-home host: more than one IP address.  The addresses  
>>> are
>>> in separate subnets but run over the same ethernet segment (this  
>>> is a
>>> temporary situation while I switch an office network over from one
>>> network provider to another).
>>>
>>> I want packets from address A1 to be sent via gateway G1, but  
>>> packets
>>> from address A2 to be sent via gateway G2.
>>>
>>> How do I do this?  Can I just have more than one default route?  I'm
>>> remote from the machine in question, so I don't want to tinker with
>>> the default route until I'm sure of the answer.
>>
>> You can't have multiple default routes.  The fact that you want to is
>> an indicator of incorrect network design, although it could be an
>> artifact of the interim setup while you migrate things around.
>>
>> I would suggest you ask yourself (and possibly the list) _why_ you  
>> think
>> multiple default routes is necessary ... what is it that you're  
>> hoping
>> to accomplish.  I'm guessing your looking for some sort of  
>> redundancy,
>> in which case something like CARP or RIP is liable to be the correct
>> solution.
>
> I agree that this is probably my inexperience showing.

Yes.  :^)

> I have an office network which is switching leased line, from provider
> P1 to provider P2.  I have a /25 from P1 and a (different) /24 from
> P2.  I am doing the migration a few machines at a time: move a little,
> test a little, etc.  I am dual-homing each host for a short period
> while I am switching it over.  The dual-homing works just fine, over a
> shared ethernet segment, except for the fact that I can only have one
> default route.

Repeat after me: "The default route is the route I use when I don't  
know a better route."

If you have two connections to the internet, the usual way of handling  
this is to have a single router that understands both routes.  This  
single router maintains a routing table that knows which connection is  
the "best" one to use for each IP destination.  It maintains this  
routing table by exchanging route information with other (nearby)  
routers, most especially those at the other end of your internet  
connection(s).

If you don't have a single routing instance to do this for you, you  
have to push the same information all the way down to the devices, so  
they can make those routing decisions for themselves.

The default route is then one that is used when no other match was  
found in the routing table.  It is an interesting philosophical  
argument to consider what is the meaning of more than one "default"  
route -- if you have more than one, how can it be a "default"?  When  
you hit these multiple "default" routes, do you send the packet to all  
of them?  Pick one?  Which one?  Try one, and if that doesn't work,  
then try another?  Who is responsible for remembering which one(s)  
don't work?

There is a dangerous assumption here that because both Microsoft and  
Linux have done something, it's a good idea.  In point of fact, it's  
not a good idea, it is codifying bad network design.  If you think you  
need two or more default routes, you need to learn a little bit more  
about networking instead.

I see a number of people have replied to this message offering  
solutions of how to accomplish your migration, using a variety of  
tools available to you in FreeBSD.  I've always found this community  
very supportive in this fashion, and I'm glad they've jumped in to  
help you in your transition as well.  Please note that the variety of  
solutions presented recognize that your transition period is just  
that, a temporary situation, and that "multiple default routes" is not  
the solution.

I'll get down off my soapbox now.  This is such an FAQ on this list,  
you should be required to read and answer this question before being  
allowed to post to the list.  :^)

--
            Where am I, and what am I doing in this handbasket?
Wes Peters                                                     wes at opensail.org




More information about the freebsd-net mailing list