惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
F
Fortinet All Blogs
Vercel News
Vercel News
C
Check Point Blog
P
Privacy International News Feed
Know Your Adversary
Know Your Adversary
Google DeepMind News
Google DeepMind News
T
Troy Hunt's Blog
TaoSecurity Blog
TaoSecurity Blog
I
Intezer
T
The Exploit Database - CXSecurity.com
Security Archives - TechRepublic
Security Archives - TechRepublic
H
Hacker News: Front Page
P
Proofpoint News Feed
GbyAI
GbyAI
Engineering at Meta
Engineering at Meta
Attack and Defense Labs
Attack and Defense Labs
S
Security @ Cisco Blogs
IT之家
IT之家
D
DataBreaches.Net
Hacker News: Ask HN
Hacker News: Ask HN
SecWiki News
SecWiki News
Y
Y Combinator Blog
Project Zero
Project Zero
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
Lohrmann on Cybersecurity
T
Tenable Blog
大猫的无限游戏
大猫的无限游戏
L
LINUX DO - 最新话题
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
Recorded Future
Recorded Future
有赞技术团队
有赞技术团队
Martin Fowler
Martin Fowler
K
Kaspersky official blog
PCI Perspectives
PCI Perspectives
A
Arctic Wolf
Latest news
Latest news
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
Netflix TechBlog - Medium
雷峰网
雷峰网
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
P
Palo Alto Networks Blog
The Hacker News
The Hacker News
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
月光博客
月光博客
Schneier on Security
Schneier on Security
M
MIT News - Artificial intelligence

Rat's Blog - iptables

使用ipset设置防火墙端口白名单,只让指定国家访问 - Rat's Blog Linux VPS一键屏蔽指定国家所有的IP访问 - Rat's Blog iptables封禁BT/PT/SPAM(垃圾邮件)和自定义端口/关键词一键脚本 - Rat's Blog CentOS 7使用iptables开放设置端口 - Rat's Blog 使用iptables封掉所有邮件端口 - Rat's Blog 使用iptables进行端口转发 - Rat's Blog Linux使用iptables封IP或IP段教程 - Rat's Blog iptables之禁ping和ddos向外发包 - Rat's Blog
Linux VPS使用ipset快速屏蔽指定国家的IP访问 - Rat's Blog
博主: Rat's · 2018-04-10 · via Rat's Blog - iptables

说明:ipsetiptables的扩展,它允许你创建匹配整个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


版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!

本文链接:https://www.moerats.com/archives/584/

如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。

Vultr新用户注册送100美元/16个机房按小时计费,支持支付宝,【点击查看】。