[clug] A Routing problem

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


Yup,
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 192.168.76.0/24 uses the new table called privateip
ip rule add from 192.168.76.0/24 table privateip

#Set up the routes for this table.
ip route add default via 192.168.99.1 dev eth5 table privateip
ip route add 192.168.76.0/26 dev eth4 src 192.168.76.1 table privateip
ip route add 192.168.76.208/28 via 192.168.0.2 dev eth2 table privateip
ip route add 192.168.76.192/28 dev eth3 src 192.168.76.193 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.

Cheers
-Rod
(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 123.123.123.0/24 (say)
> I want traffic entering eth1, destined for 123.123.123.0/24 to be routed 
> to eth0 - always
> I want traffic entering from eth2 destined for 123.123.123.0/24 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