我有以下的iptables链:
sudo iptables -N BLOCK24 sudo iptables -A BLOCK24 -m recent --name blocked --set sudo iptables -A INPUT -m state --state NEW -m recent --set sudo iptables -A INPUT -m state --state NEW -m recent --update --seconds 300 --hitcount 200 -j BLOCK24 sudo iptables -A INPUT -m recent --name blocked --rcheck --seconds 86400 -j BLOCK24 sudo iptables -A BLOCK24 -j LOG --log-prefix='[NETFILTER] ' --log-level 7 sudo iptables -A BLOCK24 -j REJECT
这会在300秒内请求> = 200个连接时阻止IP 24小时。
无论如何,我可以手动插入一个IP到这个链? 就像是?
iptables -A BLOCK24 -s 192.168.1.100 -j DROP
像这样: echo +192.168.1.100 >/proc/net/xt_recent/blocked ,或者如果你需要sudo, echo +192.168.1.100 | sudo tee /proc/net/xt_recent/blocked echo +192.168.1.100 | sudo tee /proc/net/xt_recent/blocked
资料来源: man iptables-extensions