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

推荐订阅源

Engineering at Meta
Engineering at Meta
博客园_首页
H
Help Net Security
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
B
Blog
I
InfoQ
SecWiki News
SecWiki News
T
Tailwind CSS Blog
Spread Privacy
Spread Privacy
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
P
Palo Alto Networks Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Vercel News
Vercel News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
M
MIT News - Artificial intelligence
S
Schneier on Security
T
Threat Research - Cisco Blogs
F
Fortinet All Blogs
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
aimingoo的专栏
aimingoo的专栏
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The Cloudflare Blog
Recent Announcements
Recent Announcements
Security Latest
Security Latest
G
GRAHAM CLULEY
IT之家
IT之家
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
腾讯CDC
Google DeepMind News
Google DeepMind News
V
V2EX
S
Securelist
TaoSecurity Blog
TaoSecurity Blog
B
Blog RSS Feed
S
SegmentFault 最新的问题
博客园 - 叶小钗
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Project Zero
Project Zero
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
F
Full Disclosure

基础知识系列 on 打工人日志

Tmux 安装和使用教程 使用 ElasticSearch Curator 7天定期删除日志 GNU/Linux 一键更换系统软件源脚本 在windows上安装appium 可观测性和监控的区别 基础知识-计算机系统 systemd 守护命令 Linux crontab 命令 linux常用命令 linux基础知识 yaml 语法 网络基础知识 linux服务基础知识 mysql基础知识 shell基础知识 TCP/IP详解 运维知识图谱
iptables 基础知识
2021-12-27 · via 基础知识系列 on 打工人日志

iptables 基础知识

内核包过滤与 NAT 管理工具.是 linux 系统中在用户空间中运行的运来配置内核防火墙的工具。它可以设置,维护和检查 linux 内核中的 ipv4 包过滤规则和管理网络地址转换(NAT)。
ipatbles 命令仅支持 ipv4,如果使用的 IP 协议是 ipv6 则需要使用专门的管理工具 ip6tables。

常用参数

参数作用
-t<表>指定要操纵的表
-A向规则链中追加条目
-D从规则链中删除条目
-I向规则链中插入条目
-R替换规则链中的相应条目
-L显示规则链中的已有条目
-F清除规则链中的现有条目。不改变规则链的默认目标策略
-Z清空规则链中的数据包计数器和字节计数器
-N创建新的用户自定义规则链
-P定义规则链中的默认目标(策略)
-h显示帮助信息
-p<协议>指定要匹配的数据包的协议类型
-s<源地址>指定要匹配的数据包的源 IP 地址
-j<目标>指定要跳转的目标
-i<网络接口>指定数据包进入本机的网络接口
-o<网络接口>指定数据包离开本机做使用的网络接口
-c<包计数>在执行插入、追加和替换操作时初始化包计数器和字节计数器

参考实例

显示内核当前的 filter 表:

显示内核当前的 nat 表:

禁止本机对 192.168.20.20 地址的访问:

1iptables -t filter -A OUTPUT -d 192.168.20.20 -j DROP

显示 filter 表的 OUTPUT 链:

1iptables -L OUTPUT -t filter