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

推荐订阅源

W
WeLiveSecurity
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
The Register - Security
The Register - Security
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
S
SegmentFault 最新的问题
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
AI
AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
U
Unit 42
腾讯CDC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
H
Help Net Security
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
博客园 - 聂微东
S
Securelist
大猫的无限游戏
大猫的无限游戏
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog

Rat's Blog - iptables

使用ipset设置防火墙端口白名单,只让指定国家访问 - Rat's Blog Linux VPS一键屏蔽指定国家所有的IP访问 - Rat's Blog Linux VPS使用ipset快速屏蔽指定国家的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 iptables之禁ping和ddos向外发包 - Rat's Blog
Linux使用iptables封IP或IP段教程 - Rat's Blog
博主: Rat's · 2015-09-24 · via Rat's Blog - iptables

说明:iptables是一个linux的基础组件,主要应用于防火墙应用,例如禁止某IP访问,或者禁止一些端口,提升网站的安全性。一般情况下,系统默认就会安装,如果没有安装,可自行安装。

yum install iptables #centos系统
apt-get install iptables #debian/ubuntu系统

一、先说一下几个常用命令:

service iptables -status #查看iptables是否运行
iptables -F #大写F,清空当前所有规则
iptables-save #注意s-之间无空格,保存当前规则
iptables -L -n #列表显示当前规则

二、常见封ip命令:

iptables -A INPUT -s 123.45.67.89 -j DROP #封掉单个IP地址

#屏蔽整个段(A类地址)即从192.0.0.1到192.255.255.254,则添加以下规则。
iptables -I INPUT -s 192.0.0.0/8 -j DROP

#封IP段(B类地址)即从192.168.0.1到192.168.255.254,则添加以下规则。
iptables -I INPUT -s 192.168.0.0/16 -j DROP

#封IP段(C类地址)即从192.168.200.1到192.168.200.254,则添加以下规则。
iptables -I INPUT -s 192.168.200.0/24 -j DROP

三、查看及删除命令:

iptables -L -n --line-numbers #按行列表显示当前规则
iptables -D INPUT 15 #删除第15条规则

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

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

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

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