Re: multiple default routes

From: Rani Chouha (rani@247media.com)
Date: Wed May 31 2000 - 08:56:06 EST


On Wed, 31 May 2000, Helge Hafting wrote:

> >
> >
> > I have 2 NICs on each of my Linux boxes connected to 2 different
> > network segments and routers and I would like packets coming on one
> > ethernet interface (from any source ip) to go back over the same
> > interface. Is that possible in Linux ?
>
> You probably mean something like "*answers* to incoming packets
> should go out via the interface the packet came in?"

Correct, this is exactly what I mean.
On solaris for example, if you have multiple interfaces and you set
multiple defaultroutes, the kernel re-routes incoming requests (coming
from any segment on the Internet) via the same interface the packet came
in.

The reason I need this is because I have 2 Foundry switches (for
redundancy) doing load balancing across 40 Linux servers. Each Linux box
has 1 interface to each Foundry and 1 interface to a backend switch.
All interfaces are on seperate subnets.
The Foundry switches are running NAT and must be in a Active/Active
configuration meaning that incoming packets reach each Linux box from both
Foundry switches.
On Linux, I can only have 1 defaultroute pointing to 1 Foundry switch
only. On Solaris, I can have 1 defaultroute pointing to each foundry
switch and answers to incoming packets are rerouted to the right foundry
switch.

It would be great if this can be implemented in the Kernel as a
loadable module for example.
please cc me directly on any replies and thanks to all those who replied.

--Rani Chouha

>
> IP don't work that way, as far as I know. Information about wich
> interface received a packet is removed early, it is not in the
> IP headers. (Firewall code like ipchains may have access to this
> information,
> but I don't think that is useful for your purpose.)
>
> A machine with two NIC's is usually connected to two different
> networks. You can then set up routes to get packets where you want.
> (Consider load-balancing if you have several NICs oon the
> same network.)
>
> The kernel knows the network addresses directly connected to your
> NICs. So no routes are required for those. You need
> routes for any networks connected to routers on the directly
> connected networks. If both your NICs are connected to routers,
> set the default route to the router that routes for the largest
> amount of networks. (I.e. the one that routes onto the
> entire internet, if you are connected to it.) You have to set
> up explicit routes to every network reachable via other routers.
>
> This may indeed be a lot of work, if there's a lot of
> connected networks. You may simplify it if you somehow can
> make the routers output their routing information. (Via
> a routing protocol, or a router admin tool.) You can then edit
> this to make your own routing table.
>
> Helge Hafting
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:27 EST