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

付费节点推荐


免费节点


节点使用教程


  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

未经允许不得转载:Bcoder资源网 » 使用iptables限制特定端口连接数量

相关推荐

更多优质资源关注微信公众号: bcoder

bcoder
赞 (1)
分享到:更多 ()

评论 0

评论前必须登录!

登陆 注册