iptables的udp负载均衡记录, 最近才学习这些东西,尝试kcptun的随机端口测试用。
客户端client:
iptables -t nat -A OUTPUT -p udp –dport 4444 -m state –state NEW -m statistic –mode nth –every 4 –packet 0 -j DNAT –to-destination 127.0.0.1:1444
iptables -t nat -A OUTPUT -p udp –dport 4444 -m state –state NEW -m statistic –mode nth –every 4 –packet 1 -j DNAT –to-destination 127.0.0.1:1445
iptables -t nat -A OUTPUT -p udp –dport 4444 -m state –state NEW -m statistic –mode nth –every 4 –packet 2 -j DNAT –to-destination 127.0.0.1:1446
iptables -t nat -A OUTPUT -p udp –dport 4444 -m state –state NEW -m statistic –mode nth –every 4 –packet 3 -j DNAT –to-destination 127.0.0.1:1447
服务端server:
iptables -t nat -A OUTPUT -p udp –dport 1445:1447 -j DNAT –to-destination 127.0.0.1:5555
另外要kcptun客户端需要设置:
“conn”: 4,
“autoexpire”: 0,
kcptun要设置端口到4444去
kcptun server端要设置端口到5555去