iptables -t mangle -A PREROUTING -j MARK --set-mark 1提示iptables: No chain/target/match by that name

本文记录了一次解决iptables中使用MARK命令出现的问题的过程。作者尝试了多种配置方式但依旧遇到错误提示,最终发现原因是缺少必要的内核模块加载,并通过手动加载模块解决了问题。

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

不知为何,即使Core Netfilter Configuration和IP: Netfilter Configuration全部采用built-in还是提示这个错误,后来改成module的方式依然不行,最后找到原因是因为它不会自动加载所需要的模块,手动加载即可,modprobe xt_MARK

[root@mpc8315erdb /root]# iptables -t mangle -A PREROUTING -s 192.168.2.0/24 -j
MARK --set-mark 1
iptables: No chain/target/match by that name
[root@mpc8315erdb /root]# modprobe xt_MARK
[root@mpc8315erdb /root]# iptables -t mangle -A PREROUTING -s 192.168.2.0/24 -j
MARK --set-mark 1
[root@mpc8315erdb /root]# iptables -t mangle -L
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination        
MARK       all  --  192.168.2.0/24       anywhere            MARK xset 0x1/0xffffffff

Chain INPUT (policy ACCEPT)
target     prot opt source               destination        

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination        

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination        

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination   

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值