欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

iptables利用connlimit模块防御DDOS攻击 Debian 

程序员文章站 2022-05-26 17:13:10
...
  
lsmod |grep ipt
查看是否安装ipt_connlimit模块

  
[root@localhost ~]# modinfo xt_connlimit
  #查看xt_connlimit模块

  filename: /lib/modules/2.6.32-358.el6.x86_64/kernel/net/netfilter/xt_connlimit.ko

  alias: ip6t_connlimit

  alias: ipt_connlimit

  license: GPL

  description: Xtables: Number of connections matching

  author: Jan Engelhardt

  srcversion: FD50EBD41C0216E02E65B1E

  depends: nf_conntrack

  vermagic: 2.6.32-358.el6.x86_64 SMP mod_unload modversions



限制一个客户端并发请求为10

  iptables -A INPUT -p tcp –dport 80 -m connlimit –connlimit-above 10 -j REJECT

  限制除用户XXX.XXX.XXX.XXX以外的IP连接数为50

  iptables -I FORWARD -p tcp -s !XXX.XXX.XXX.XXX -m connlimit –connlimit-above 50 -j REJECT

  iptables -p tcp –syn –dport 80 -m connlimit –connlimit-above 16 –connlimit-mask 24 -j REJECT

相关标签: Debian