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

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

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个机房按小时计费,支持支付宝,【点击查看】。