我希望将特定IP的连接数(例如,147.0.0.0)限制为端口5566的25个并发连接。
我目前能够限制整个端口和所有IP地址的最大并发连接.但我只想(147.0.0.0)这样做。
任何帮助都将不胜感激。
谢谢!
发布于 2018-08-21 14:57:05
--connlimit-above选项用于connlimit模块应该可以达到您的目标。另见iptables的手册页-扩展。例如,假设tcp:
sudo iptables -A INPUT -p tcp --syn -s 147.0.0.0 --dport 5566 -m connlimit --connlimit-above 25 -j REJECT其结果是:
~$ sudo iptables -v -x -n -L
Chain INPUT (policy ACCEPT 6 packets, 432 bytes)
pkts bytes target prot opt in out source destination
0 0 REJECT tcp -- * * 147.0.0.0 0.0.0.0/0 tcp dpt:5566 flags:0x17/0x02 #conn src/32 > 25 reject-with icmp-port-unreachable
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 4 packets, 624 bytes)
pkts bytes target prot opt in out source destinationhttps://askubuntu.com/questions/1067515
复制相似问题