This does not work since all the packets are forwarded to the default GW
which is ISP_GW_1.

in routing tables, you must have two rules to route packets with different sources to different gateways first:
ip rule add from 172.17.31.5 lookup 1
ip route add table 1 default via $GW=ISP_GW_1
ip rule add from 172.17.31.7 lookup 2
ip route add table 2 default via $GW=ISP_GW_2
then
$IPTABLES -t nat -A POSTROUTING -s 172.17.31.5 -j SNAT --to-source $ISP_IP_1
$IPTABLES -t nat -A POSTROUTING -s 172.17.31.7 -j SNAT --to-source $ISP_IP_2


As far as I remember, the routing decisions and policy are before the
POSTROUTING chain in which the SNAT occurs...

Kernel Packet Traveling Diagram http://www.docum.org/docum.org/kptd/ might be helpful for you


in case you want load balacing your internet connections, you can consult http://selab.edu.ms/twiki/bin/view/Networking/MultihomedLinuxNetworking

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

Reply via email to