Nelson Castillo
2005-May-29 00:22 UTC
Routing for multiple uplinks and SNAT to 2 source IPs
Hi, I configured a router box to use 2 providers, as described in the HOWTO. (Apendix 1) I want to use both links to reach a single smtp server. As I read in the kptd and in some old messages of this list, doing a SNAT in the postrouting chain comes _after_ the routing desision. So I guess the following lines I''m trying to use are wrong. (See Apendix 1) What can I do to have multiple connection to the same IP to use both links? Do the following lines have some effect after I do SNAT in the mangle table of the POSTROUTING chain? # use the right route if the source address is already set ip rule add from $IP1 table T1 ip rule add from $IP2 table T2 Thanks a lot! Nelson.- Apendix 1: # SNAT the internal networks using round robin. I think this wont work. iptables -t nat -A POSTROUTING -o $IF1 -s 192.168.0.0/255.255.255.0 -j SNAT --to-source $IP1 --to-source $IP2 iptables -t nat -A POSTROUTING -o $IF1 -s 192.168.10.0/255.255.255.0 -j SNAT --to-source $IP1 --to-source $IP2 iptables -t nat -A POSTROUTING -o $IF2 -s 192.168.0.0/255.255.255.0 -j SNAT --to-source $IP1 --to-source $IP2 iptables -t nat -A POSTROUTING -o $IF2 -s 192.168.10.0/255.255.255.0 -j SNAT --to-source $IP1 --to-source $IP2 [1] http://lartc.org/howto/lartc.rpdb.multiple-links.html [2] http://www.docum.org/docum.org/kptd/ -- Homepage : http://geocities.com/arhuaco The first principle is that you must not fool yourself and you are the easiest person to fool. -- Richard Feynman.
Nelson Castillo wrote:> > Hi, > > I configured a router box to use 2 providers, as described > in the HOWTO. (Apendix 1) > > I want to use both links to reach a single smtp server. As I read > in the kptd and in some old messages of this list, doing a SNAT > in the postrouting chain comes _after_ the routing desision. > So I guess the following lines I''m trying to use are wrong. > (See Apendix 1) > > What can I do to have multiple connection to the same IP to > use both links?You should google "policy based routing Linux" and "port based routing Linux" http://linux-ip.net/html/ch-routing.html http://snafu.freedom.org/linux2.2/docs/advanced-routing/ I know nothing of squid, but previous posts here indicate that it may be useful to you. -- Gypsy