备忘:iptables recent模块限制连接数中的问题


添加如下规则:
iptables -I RH-Firewall-1-INPUT  1 -p tcp --dport 80 --syn -m recent --name web --rcheck --seconds 30 --hitcount 50 -j LOG --log-prefix 'DDOS:' --log-ip-options
iptables -I RH-Firewall-1-INPUT  2 -p tcp --dport 80 --syn -m recent --name web --rcheck --seconds 30 --hitcount 50 -j DROP
iptables -I RH-Firewall-1-INPUT  3 -p tcp --dport 80 --syn -m recent --name web --set -j ACCEPT


可能会遇到

iptables unknown error 2147483648

之类的错误

 

问题在于ipt_recent模块默认的hitcount是有大小限制的

#modinfo ipt_recent
parm:           ip_list_tot:number of IPs to remember per list (uint)
parm:           ip_pkt_list_tot:number of packets per IP to remember (max. 255) (uint)
parm:           ip_list_hash_size:size of hash table used to look up IPs (uint)
parm:           ip_list_perms:permissions on /proc/net/ipt_recent/* files (uint)

方法:

修改/etc/modprobe.conf,增加:

options ipt_recent ip_pkt_list_tot=100

 

#service iptables stop
#modprobe -r ipt_recent
#modprobe ipt_recent
#service iptables start


ps:

如在modprobe -r ipt_recent时提示

WARNING: /etc/modprobe.conf line x: ignoring bad line starting with ´option

多半是/etc/modprobe.conf中的内容增加有问题

man 5 modprobe.conf

可以看到

options modulename option...


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值