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

Re: policy routing



Cenk Hasirlioglu <cenkh@efes.net.tr> writes:

> There is third network behind another router and we want to
> route packets coming from this network to a different
> next-hop, not to default gateway.
> 
> How can i do that policy routing with iproute or ipchains
> (kernel 2.2.x)

These two statements should be enough to get packets from the internal
network using the other gateway (I call it 172.16.1.1):

ip route add default via 172.16.1.1 proto static table 5 
ip rule add from 192.168.0.0/24 to 0/0 lookup 5 priority 999

After this issue an "ip route flush cache" ...

Note, before the default route statement you may have to throw some routes to
your other local networks if you still with wish to talk to them properly.
Something like "ip route add throw 10.0.1.0/24 table 5".

There is an excellent iproute2 document that explains all these things but
iirc it is a little short on details covering your particular scenario.

Good luck,
--
fraser campbell <fraser@starnix.com>                          starnix inc.
tollfree: (905) 771-0017                        thornhill, ontario, canada
http://www.starnix.com/             professional linux services & products



Reply to: