multiple routing tables and default route (was: ipv4 forwarding - any known issues?)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

multiple routing tables and default route (was: ipv4 forwarding - any known issues?)

Per Jessen-2
James Knott wrote:

> Per Jessen wrote:
>> Yep, I have a number of servers in just such a setup - each server
>> has two possible outbound paths, but the kernel cannot know which one
>> is
>> actually available, so I control that manually (scripted).  (three
>> options: left is up, right is up, both are up).
>
> When both are up, how do you select?

I alternate between them.

> Are both on the same ISP?

Sort of - they are IPIP connections to two other servers, but in
different datacentres.

> If not, you have to use some method to determine which becomes the
> default route.

Well, each routing table has a default route.  When only "left" is up,
the routing table has a default route that says "via left", vice versa
when only "right" is up, and when both are up, the routing table has a
default route alternates between "left" and "right".

See the "nexthop" option for "ip route add".


--
Per Jessen, Zürich (5.5°C)

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: multiple routing tables and default route (was: ipv4 forwarding - any known issues?)

James Knott
Per Jessen wrote:
> Well, each routing table has a default route.  When only "left" is up,
> the routing table has a default route that says "via left", vice versa
> when only "right" is up, and when both are up, the routing table has a
> default route alternates between "left" and "right".

So, in your example, you're manually or automagically selecting from one
of two routes.  Those are no longer default routes, as you chose between
them.  I could do the same by going into IP configuration and changing
the default route, if there were more that one possibility, but that
would still leave me with just the one default route.  The other(s)
would no longer be default.

BTW, a few years ago, I set up an SHDSL connection between two sites.  
Each site had it's own ISP connection via ADSL and the SHDSL link was
used to bridge the 2 networks (same subnet).  A computer at one site
would normally get it's IP config info from the DHCP server in the
nearest NAT router, as it would respond first, but if one router was
down, it was possible to get the config info from the other site and go
that way.  In this situation, there was always one and only one default
route at any time in a computer, but that default could change if one
router failed.
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: multiple routing tables and default route (was: ipv4 forwarding - any known issues?)

Anders Johansson-9
On Sunday 26 February 2012 10:58:14 James Knott wrote:

> Per Jessen wrote:
> > Well, each routing table has a default route.  When only "left" is up,
> > the routing table has a default route that says "via left", vice versa
> > when only "right" is up, and when both are up, the routing table has a
> > default route alternates between "left" and "right".
>
> So, in your example, you're manually or automagically selecting from one
> of two routes.  Those are no longer default routes, as you chose between
> them.  I could do the same by going into IP configuration and changing
> the default route, if there were more that one possibility, but that
> would still leave me with just the one default route.  The other(s)
> would no longer be default.

Logically, I agree with you 100%. "Default" is what's left when everything
else is ruled out. Unfortunately, "default" is also a keyword in iproute2. It
is a synonym for the 0/0 target, and there can be several rules for that
target, so in one sense there can be only one default, in the other sense
there can be several.

In short, you're all correct :)

Anders
--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: multiple routing tables and default route (was: ipv4 forwarding - any known issues?)

Per Jessen-2
In reply to this post by James Knott
James Knott wrote:

> Per Jessen wrote:
>> Well, each routing table has a default route.  When only "left" is
>> up, the routing table has a default route that says "via left", vice
>> versa when only "right" is up, and when both are up, the routing
>> table has a default route alternates between "left" and "right".
>
> So, in your example, you're manually or automagically selecting from
> one of two routes.

Routing tables, not routes.  I guess I could have done that by amending
the default routing table, but it was easier just having three fixed
tables.


--
Per Jessen, Zürich (5.1°C)

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: multiple routing tables and default route (was: ipv4 forwarding - any known issues?)

Per Jessen-2
In reply to this post by Anders Johansson-9
Anders Johansson wrote:

> On Sunday 26 February 2012 10:58:14 James Knott wrote:
>> Per Jessen wrote:
>> > Well, each routing table has a default route.  When only "left" is
>> > up, the routing table has a default route that says "via left",
>> > vice versa when only "right" is up, and when both are up, the
>> > routing table has a default route alternates between "left" and
>> > "right".
>>
>> So, in your example, you're manually or automagically selecting from
>> one of two routes.  Those are no longer default routes, as you chose
>> between them.  I could do the same by going into IP configuration and
>> changing the default route, if there were more that one possibility,
>> but that would still leave me with just the one default route.  The
>> other(s) would no longer be default.
>
> Logically, I agree with you 100%. "Default" is what's left when
> everything else is ruled out. Unfortunately, "default" is also a
> keyword in iproute2. It is a synonym for the 0/0 target, and there can
> be several rules for that target, so in one sense there can be only
> one default, in the other sense there can be several.

Yeah, that is sort of what I was hinting at earlier when I wrote:

> Well, actually you have one default route per routing table. I guess
> this could be construed as having multiple default routes :-)



--
Per Jessen, Zürich (5.1°C)

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]