[clug] A Routing problem

Rod Tunks rod at tpgi.com.au
Wed Oct 20 22:49:57 GMT 2004

thats no problem.  You setup different routing tables based on source 
address/device. This way each interface can see a completely different 
set of routes.  We have a router here with 6 ethernet interfaces of 
which 2 are feeds out of the building used for different purposes.

Routing is done based on both source and dest addresses.

Here's a quick cut and paste example :-

# specify anything from uses the new table called privateip
ip rule add from table privateip

#Set up the routes for this table.
ip route add default via dev eth5 table privateip
ip route add dev eth4 src table privateip
ip route add via dev eth2 table privateip
ip route add dev eth3 src table privateip
<snip> and so on.

You need to create the new table entry (ie 501) and optionally give it a 
name for each routing table you need. In your case three tables may be 
overkill but it gives you the most flexability if your networks are 
perpetually in a state of flux (like ours)

We had some issues with arp due to our rather weird lan setup and found 
  echo 1 > /proc/sys/net/ipv4/conf/all/arp_filter was needed as well. YMMV

Very low end hardware will cope with this kind of set up no problems at 
all. Our 6 port box is a PIII with 4 x 100M lans and 2 x 2M+ feeds out 
of the building and doesnt raise a sweat. Gotta love linux routers!

The linux advanced routing & traffic control howto covers this quite well.

(from next door)

This email may contain traces of nuts and/or caffeine

Stephen Hodgman wrote:
> I have a question regarding routing.  I have a linux system with three 
> interfaces say eth0, eth1 & eth2
> On eth0 is network (say)
> I want traffic entering eth1, destined for to be routed 
> to eth0 - always
> I want traffic entering from eth2 destined for to be 
> routed to eth2 - always
> The reason is that there is a route either way but I only want one 
> device to route directly.
> Can this be done?  It seems to require routing tables based on source 
> address/interface.
> I would appreciate knowing how this can be done.
> TIA.

More information about the linux mailing list