OpenWrt Configure Iptables to randomly dnat a shadowsocks connection to a specific port:
code is as follows |
copy code |
iptables-t nat-a output-p TCP--dport 5688-m State--state new-m- -mode nth --every 4 --packet 0 -j DNAT --to-destination serverip:5688<br /> iptables -t nat -A OUTPUT -p tcp --d Port 5688-m State--state new-m statistic--mode nth--every 4--packet 1-j dnat--to-destination serverip:5689<br/ iptables-t nat-a output-p TCP--dport 5688-m State--state new-m statistic--mode nth--every 4--packet 2- J Dnat--to-destination serverip:5690<br/> iptables-t nat-a output-p TCP--dport 5688-m State--state NEW- M statistic--mode nth--every 4--packet 3-j dnat--to-destination serverip:5691 |
The server side Dnat the port to which the client is connected to the Shadowsocks listening port:
The code is as follows |
Copy Code |
Iptables-t nat-a prerouting-p tcp--dport 5689:5691-j dnat--to-destination serverip:5688<br/> #如果是分散的端口: <br/> Iptables-t nat-a prerouting-p tcp-m multiport--dports 3000,10000-j dnat--to-destination serverip:5688 |