Linux 之iptables (1)相关概念

本文详细解析了iptables中数据包的流转路径,包括到本机、流经本机及本机发出的数据包的流向。阐述了不同链(prerouting, input, forward, output, postrouting)中的规则表作用,如filter、nat、mangle和raw的功能及它们在链中的匹配顺序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一:数据包经过内核的流向

到本机的数据包:prerouting->input

流经过本机的数据包:prerouting->forward->postrouting

本机发出的数据包:output->postrouting

数据包需要经过以上链的一一允许,才能流通。

 

二:规则表

以上的5条链

prerouting,input,forward,output,postrouting,中都有多张表。

filter:过滤功能,作为防火墙;内核模块,iptables_filter

nat:网络地址转换功能;内核模块:iptables_nat

mangle:拆解报文修改并重新封装;内核模块:iptables_mangle

raw:关闭nat上启用的连接追踪机制,内核模块iptables_raw,(具体还不知道)

四个表在同一条链中时,数据包匹配规则的顺序  raw->mangle->nat->filter

 

三:表链关系

prerouting链中存在的表:raw,mangle,nat

input链中存在的表:mangle,nat,filter

forward链中存在的表:mangle,filter

output链中存在的表:raw,mangle,nat,filter,

postrouting链中尽的表:mangle,nat

 

raw表能付在的链:prerouting,output

mangle表能付的链:prerouting,postrouting,input,output,forward

nat表:prerouting,postrouting,output,input

filter:input,forward,output

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值