[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Re Routing



On December 6, 2002 04:48 am, the great Samantha Scafe wrote:

> I have it so it can do either but not both
>
> 203.24.120.0/24 and 202.129.104.0/24 on eth0
> 203.55.214.0/24 is on the ppp0 interface

I think I understand what you want to do.  You need to use multiple routing 
tables enabled by advanced routing (iproute2).  See http://lartc.org/ for a 
decent howto.

In a nutshell I believe your situation will be solved by having routing rules 
to ensure that locally destined traffic goes through the main routing table 
and everything else goes through connection specific routing tables.  Roughly 
like this:

# Set up correct gateway for ppp0 addresses in routing table 50
ip route add default via 203.55.214.254 table 50
# Set up correct gateway for eth0 addresses in routing table 51
ip route add default via  203.24.120.254 table 51

# Add a rule to ensure that traffic with a local destination stays local
ip rule add to  203.24.120.0/24 lookup main pri 1000
ip rule add to  203.55.214.0/24  lookup main pri 1000
ip rule add from 203.24.120.0/24  lookup table 51 pri 2000
ip rule add from 203.55.214.0/24 lookup table 50 pri 2000

This would give you routing rules looking something like this (seen with "ip 
rule list"):

0:      from all lookup local
1000:   from all to 203.24.120.0/24 lookup main
1000:   from all to 203.55.214.0/24 lookup main
2000:  from 203.24.120.0/24 lookup 51
2000: from 203.55.214.0/24 lookup 50
32766: from all lookup main
32767:  from all lookup 253

Hopefully this becomes clearer once once your read the LARTC howto.

Fraser



Reply to: