说明:ipset
是iptables
的扩展,它允许你创建匹配整个IP
地址集合的规则。可以快速的让我们屏蔽某个IP
段。这里分享个屏蔽指定国家访问的方法,有时候还可以有效的帮网站阻挡下攻击。
方法
首先需要得到国家IP
段,下载地址:http://www.ipdeny.com/ipblocks/。这里以我们国家为例。
1、安装ipset
#Debian/Ubuntu系统
apt-get -y install ipset
#CentOS系统
yum -y install ipset
2、创建规则
#创建一个名为cnip的规则
ipset -N cnip hash:net
#下载国家IP段
wget -P . http://www.ipdeny.com/ipblocks/data/countries/cn.zone
#将IP段添加到cnip规则中
for i in $(cat /root/cn.zone ); do ipset -A cnip $i; done
3、开始屏蔽
iptables -I INPUT -p tcp -m set --match-set cnip src -j DROP
4、解除屏蔽
#-D为删除规则
iptables -D INPUT -p tcp -m set --match-set cnip src -j DROP
方法参考:Blocking attack Ips/ddos Ips from China
未经允许不得转载:嘟嘟 » Linux VPS使用ipset快速屏蔽指定国家的IP访问
最新评论
请问下,python3 tg_username_update.py都会提示下面这个是因为什么啊 Traceback (most recent call last): File "tg_username_update.py", line 21, in <module> cake = emojize(":cake:", use_aliases=True) TypeError: emojize() got an unexpected keyword argument 'use_aliases'
不可以了
# Install [Debian] [bullseye] [amd64] Downloading... grep: (standard input): binary file matches Error! grub.cfg. root@RRR2:~#
博主你好,请问cloudfront 上传收费这个是事实吧,已经找了几个贴子确认了。 那有什么好办法能够避开这个收费呢?如果不能避开感觉还是cloudflare 比较稳。
来看看
第5步添加自定义主机名进去后等txt验证提示custom hostname does not name to this zone
那没事了,我静态博客。谢谢
为什么缓存键和源请求那里不设置缓存?