合作机构:阿里云 / 腾讯云 / 亚马逊云 / DreamHost / NameSilo / INWX / GODADDY / 百度统计
封禁访问网站次数过多的IP段,默认掩码为16
# 创建ip段集合 bad_ips
ipset create bad_ips hash:net
# 加入IP段
ipset add bad_ips 182.118.0.0/24
ipset add bad_ips 52.230.0.0/24
ipset add bad_ips 182.245.0.0/24
# 创建iptables防火墙规则,阻止bad_ips里的IP访问本机
iptables -I INPUT -m set --match-set bad_ips src -j DROP
# 创建firewalld防火墙规则实现
firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="ipset:bad_ips" drop'
TOP