iptables ip 规则 fwmark 不起作用
iptables ip rule fwmark doesn' t work
我正在尝试创建 iptables 并将其标记为 ip 规则。
标记不起作用。
# ip rule
0: from all lookup local
32762: from all fwmark 0x2 lookup rteth4
32763: from all fwmark 0x1 lookup rteth4
32764: from all to 93.xxx.xxx.xxx lookup rteth4
32765: from 93.xxx.xxx.xxx lookup rteth4
32766: from all lookup main
32767: from all lookup default
# iptables -A INPUT -j MARK --set-mark 2
# iptables-save > /etc/network/iptables.up.rules
# iptables-apply
# iptables -L INPUT --line-number
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 MARK all -- anywhere anywhere MARK set 0x2
如何应用:iptables -L INPUT --line-number
使用 table rteth4?
以及如何创建匹配 localhost:port 请求的 iptables 命令?
谢谢
IPTABLES 与路由 tables 没有任何关系,什么意思应用 iptables 来使用 table rteth4.
要标记数据包,最好在 PREROUTING
链中,最好是 mangle
table.
要标记一个数据包以匹配 localhost:23,你可以这样做:
iptables -t mangle -I PREROUTING -d localhost -p tcp --dport 23 -j MARK --set-mark 2
我正在尝试创建 iptables 并将其标记为 ip 规则。 标记不起作用。
# ip rule
0: from all lookup local
32762: from all fwmark 0x2 lookup rteth4
32763: from all fwmark 0x1 lookup rteth4
32764: from all to 93.xxx.xxx.xxx lookup rteth4
32765: from 93.xxx.xxx.xxx lookup rteth4
32766: from all lookup main
32767: from all lookup default
# iptables -A INPUT -j MARK --set-mark 2
# iptables-save > /etc/network/iptables.up.rules
# iptables-apply
# iptables -L INPUT --line-number
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 MARK all -- anywhere anywhere MARK set 0x2
如何应用:iptables -L INPUT --line-number 使用 table rteth4? 以及如何创建匹配 localhost:port 请求的 iptables 命令?
谢谢
IPTABLES 与路由 tables 没有任何关系,什么意思应用 iptables 来使用 table rteth4.
要标记数据包,最好在 PREROUTING
链中,最好是 mangle
table.
要标记一个数据包以匹配 localhost:23,你可以这样做:
iptables -t mangle -I PREROUTING -d localhost -p tcp --dport 23 -j MARK --set-mark 2