使用iptables限制特定端口连接数量

付费节点推荐

免费节点

节点使用教程

Clash 小火箭 v2ray节点购买

好用的梯子,海外网络,快速稳定

Google
  1. 首先输入命令service iptables stop关闭iptables
  2. 限制端口并发数很简单,IPTABLES就能搞定了,假设你要限制端口8388的IP最大连接数为5,两句话命令:
    iptables -I INPUT -p tcp --dport 8388 -m connlimit --connlimit-above 5 -j DROP
    
    iptables -I OUTPUT -p tcp --dport 8388 -m connlimit --connlimit-above 5 -j DROP
  3. 保存IPTABLES规则即可(service iptables save),其他端口以此类推。
  4. 输入命令service iptables start启动

 

最后用命令查看是否生效

iptables -L -n -v

评论(0)
游客的头像
表情
全部评论
最新