All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] Load Balance and SNAT problem.
@ 2007-06-25  3:07 John Chang
  2007-06-25 14:47 ` Grant Taylor
                   ` (29 more replies)
  0 siblings, 30 replies; 31+ messages in thread
From: John Chang @ 2007-06-25  3:07 UTC (permalink / raw)
  To: lartc


[-- Attachment #1.1: Type: text/plain, Size: 2533 bytes --]

I am developing load balancing router, But I have a question about fail
over.
The follow diagram is my test environment and scripts.
-------------------------------------------------------------------
Environment Setting

                 PC1(192.168.10.2)
                         |
                       (LAN)
                         |
               PC2-eth2(192.168.10.1)
                +               +
  PC2-eth0(111.111.111.2)    PC2-eth1(222.222.222.2 )
                |               |
              (WAN1)          (WAN2)
                |               |
  PC3-eth0(111.111.111.1)    PC3-eth1( 222.222.222.1)
                +               +
               PC2-eth2(172.16.0.1)

PC2-Linux Kernel 2.6.21
PC2-Iptables 1.3.7


-------------------------------------------------------------------
Iptables rules:

iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 111.111.111.2
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to 222.222.222.2

# table 101
ip route flush table 101
ip route add 192.168.10.0/24 dev eth2 table 101
ip route add default via 111.111.111.1 dev eth0 table 101

# table 102
ip route flush table 102
ip route add 192.168.10.0/24 dev eth2 table 102
ip route add default via 222.222.222.1 dev eth1 table 102

ip rule del fwmark 1 table 101
ip rule del fwmark 2 table 102
ip rule add fwmark 1 table 101
ip rule add fwmark 2 table 102

iptables -t mangle -A PREROUTING -t mangle -j CONNMARK --restore-mark
iptables -t mangle -A PREROUTING -m state --state NEW -m statistic --mode
nth --every 2 --packet 1 -j MARK --set-mark 1
iptables -t mangle -A PREROUTING -m state --state NEW -m statistic --mode
nth --every 2 --packet 2 -j MARK --set-mark 2
iptables -t mangle -A POSTROUTING -j CONNMARK --save-mark

-----------------------------------------------------------------------------
Test Sequence:
1. Run command "ping 172.16.0.1 -t" on PC1
2. I capture packets on WAN1 and WAN2, it works fine.
   The ICMP request/response would come out on WAN1 and WAN2 sequentially.
3. I unplug WAN1. Only the packets on WAN1 will lost, but WAN2 should works,
right?
   I should saw "ping Time Out" and "ping OK" on PC1 sequentially.
4. But the both connections all breaks. It always "ping Time Out" on PC1.
5. After caputre the packets on WAN1 and WAN2. I saw a weird behavior.
   The source IP of packets on WAN2 is 111.111.111.2, but it should be
222.222.222.2
   That is why WAN2 breaks.
-----------------------------------------------------------------------------
Could you give me a suggestion?
Thanks.

[-- Attachment #1.2: Type: text/html, Size: 5005 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2007-06-27 10:19 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-25  3:07 [LARTC] Load Balance and SNAT problem John Chang
2007-06-25 14:47 ` Grant Taylor
2007-06-25 21:30 ` VladSun
2007-06-26  6:46 ` Peter Rabbitson
2007-06-26 11:36 ` John Chang
2007-06-26 14:37 ` Grant Taylor
2007-06-26 15:04 ` Patrick Brandão
2007-06-26 17:44 ` Peter Rabbitson
2007-06-27  1:24 ` Grant Taylor
2007-06-27  1:51 ` Grant Taylor
2007-06-27  2:07 ` Grant Taylor
2007-06-27  2:22 ` Salim S I
2007-06-27  2:34 ` Grant Taylor
2007-06-27  2:39 ` Grant Taylor
2007-06-27  3:07 ` Salim S I
2007-06-27  3:16 ` Grant Taylor
2007-06-27  5:54 ` Peter Rabbitson
2007-06-27  6:41 ` Salim S I
2007-06-27  6:43 ` Grant Taylor
2007-06-27  6:58 ` Peter Rabbitson
2007-06-27  7:28 ` Grant Taylor
2007-06-27  7:37 ` Grant Taylor
2007-06-27  7:53 ` Grant Taylor
2007-06-27  7:57 ` Grant Taylor
2007-06-27  8:03 ` Peter Rabbitson
2007-06-27  8:03 ` Grant Taylor
2007-06-27  8:11 ` Grant Taylor
2007-06-27  8:24 ` Grant Taylor
2007-06-27  8:26 ` Grant Taylor
2007-06-27  9:09 ` Peter Rabbitson
2007-06-27 10:19 ` Grant Taylor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.