Re: multiple default routes

From: Helge Hafting (helgehaf@idb.hist.no)
Date: Wed May 31 2000 - 03:33:11 EST


>
>
> 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?"

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:26 EST