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

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

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