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

来源:互联网 发布:网络短信接口 编辑:程序博客网 时间:2024/05/24 06:49

不知为何,即使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