%3A%20RULE_APPEND%20%E3%81%8C%E5%A4%B1%E6%95%97%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%20(%E7%84%A1%E5%8A%B9%E3%81%AA%E5%BC%95%E6%95%B0)%3A%20%E3%83%81%E3%82%A7%E3%83%BC%E3%83%B3%E5%86%85%E3%81%AE%E3%83%AB%E3%83%BC%E3%83%AB%20OUTPUT.png)
Debian 10 で次の iptable ルールを適用しようとしています:
ip rule add fwmark 1 table 100
ip route add local 0.0.0.0/0 dev lo table 100
iptables -t mangle -N V2RAY
iptables -t mangle -A V2RAY -d 127.0.0.1/32 -j RETURN
iptables -t mangle -A V2RAY -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A V2RAY -d 255.255.255.255/32 -j RETURN
iptables -t mangle -A V2RAY -d 192.168.0.0/16 -p tcp -j RETURN
iptables -t mangle -A V2RAY -d 192.168.0.0/16 -p udp ! --dport 53 -j RETURN
iptables -t mangle -A V2RAY -p udp -j TPROXY --on-port 12345 --tproxy-mark 1
iptables -t mangle -A V2RAY -p tcp -j TPROXY --on-port 12345 --tproxy-mark 1
iptables -t mangle -A PREROUTING -j V2RAY
iptables -t mangle -N V2RAY_MASK
iptables -t mangle -A V2RAY_MASK -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A V2RAY_MASK -d 255.255.255.255/32 -j RETURN
iptables -t mangle -A V2RAY_MASK -d 192.168.0.0/16 -p tcp -j RETURN
iptables -t mangle -A V2RAY_MASK -d 192.168.0.0/16 -p udp ! --dport 53 -j RETURN
iptables -t mangle -A V2RAY_MASK -j RETURN -m mark --mark 0xff
iptables -t mangle -A V2RAY_MASK -p udp -j MARK --set-mark 1
iptables -t mangle -A V2RAY_MASK -p tcp -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -j V2RAY_MASK
しかし最後にエラーが発生:
iptables v1.8.2 (nf_tables): RULE_APPEND failed (Invalid argument): rule in chain OUTPUT
答え1
Debian 9 -> 10 にアップグレードした後にこの問題が発生しました。問題は古いカーネル (4.9) にあり、カーネルを 4.19 (Debian 10 の標準) にアップグレードすることで解決しました。
答え2
OUTPUT
最後のルールでは、チェーンをチェーンで結合しますV2RAY_MASK
。これは間違っていると思います-t mangle
。
iptables -A OUTPUT -j V2RAY_MASK