From: Paul Kelly (longword at domain esatclear.ie)
Date: Fri 14 Jun 2002 - 19:25:40 IST
Deim Agoston wrote:
> OK, the problem as you may see:
> When somebody wants to connect to 213.163.36.158 port 80, they come from network
> 213.163.36.156. The problem is that all packets go back at _ppp0_ instead of
> eth2. And they never get a reply. If I just add another routing
> route add -net 213.163.35.156 netmask 255.255.255.252 gw 213.163.35.157 eth2
>
> it doesn't work either. OK, I know I should remove the previous routing on eth2.
> But if I did it and routing gone, and added the line above, the kernel gave
> me an error message.
Ah if only life were so simple.
Normally, routing depends solely on the /destination/ address of the
packet. So yes, your 213.163.36.158 packets will come in on eth0, but
any reply will be treated no different from any other packet - thus it
will be thrown back at your default gateway on ppp0.
What you need is iproute2 and the Advanced Routing HOWTO on
http://www.tldp.org/. It's not pretty, and good docs on iproute2 are
very hard to find, but it does get the job done. You can instruct your
kernel to choose the outbound device based on the source IP address of
the packets.
It's possible something like this might work:
ip rule add from 213.163.35.156/29 table 200
ip route add default via 213.163.35.157 dev eth0 table 200
ip route flush cache
Paul.
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:17:16 GMT