Re: multiple default routes

From: Ed Carp (erc@pobox.com)
Date: Wed May 31 2000 - 10:00:08 EST


Helge Hafting (helgehaf@idb.hist.no) writes:

> > 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.)

I think that's what the original poster wants to do:

eth0: 192.168.1.1 (network 1)
eth1: 209.186.42.1 (network 2)

route add default gw dev eth1
route add -net 192.168.1.255 dev eth0

Something like this is what I think he had in mind...

--
Ed Carp, N7EKG  	erc@pobox.com		940/367-2744 cell phone
			http://www.pobox.com/~erc

- 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