2013-10-09 90 views
0

我正在嘗試使用iptable進行負載平衡。 我已經設置的規則如下,其中我想要路由請求到我的服務器與IP地址10.xx4到服務器10.xx1的內部ips:1010,10.xx2:1010和10.xx3: 1010用於負載平衡的IPtables

iptables -t nat -A PREROUTING -p udp -d 10.x.x.4 --dport 1010 -m state --state NEW -m statistic --mode nth --every 3 --packet 0 -j DNAT --to-destination 10.x.x.1:1010 

iptables -t nat -A PREROUTING -p udp -d 10.x.x.4 --dport 1010 -m state --state NEW -m statistic --mode nth --every 3 --packet 0 -j DNAT --to-destination 10.x.x.2:1010 

iptables -t nat -A PREROUTING -p udp -d 10.x.x.4 --dport 1010 -m state --state NEW -m statistic --mode nth --every 3 --packet 0 -j DNAT --to-destination 10.x.x.3:1010 

當我執行時,前4個數據包被正確路由到每個ipaddress。 第5個數據包不會被路由並正在被丟棄。

如何調試此問題。我應該增加給 - 包的價值嗎?什麼應該是正確的規則?

+3

不是SO的問題。嘗試[sf]或[unix.se] – 2013-10-09 19:10:42

+1

@sm_view,[this](http://stackoverflow.com/a/27397989/3903832)回答你的問題。 – Yoel

回答

2

您應該在每個命令行中增加 - 從0到n-1。其中n是作爲--every參數給出的數字。