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

推荐订阅源

博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
S
SegmentFault 最新的问题
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
DataBreaches.Net
F
Fortinet All Blogs
TaoSecurity Blog
TaoSecurity Blog
D
Docker
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
宝玉的分享
宝玉的分享
腾讯CDC
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
T
The Exploit Database - CXSecurity.com
T
The Blog of Author Tim Ferriss
V
V2EX
S
Securelist
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
Y
Y Combinator Blog
P
Proofpoint News Feed
T
Tor Project blog
AWS News Blog
AWS News Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
博客园 - 聂微东
T
Threat Research - Cisco Blogs
B
Blog
Attack and Defense Labs
Attack and Defense Labs
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
N
News and Events Feed by Topic
博客园 - 司徒正美
H
Help Net Security
C
Cisco Blogs
C
Check Point Blog
S
Secure Thoughts

运维 on 打工人日志

Tmux 安装和使用教程 使用 ElasticSearch Curator 7天定期删除日志 GNU/Linux 一键更换系统软件源脚本 在windows上安装appium 可观测性和监控的区别 systemd 守护命令 Linux crontab 命令 linux常用命令 linux基础知识 yaml 语法 网络基础知识 linux服务基础知识 mysql基础知识 shell基础知识 运维知识图谱
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