I have some iptables configuration in my /etc/firewall.user and it works as expected.
Recently I have added some UDP rules in it. Now my firewall.user
looks like:
ip route add local default dev lo table 100
ip rule add fwmark 1 lookup 100
iptables -t mangle -A BREAKWALL -p udp -j TPROXY --on-port 1080 --tproxy-mark 1/1
iptables -t mangle -A PREROUTING -p udp --dport 53 -j BREAKWALL
iptables -t mangle -A OUTPUT -p udp --dport 53 -j MARK --set-mark 1
ip rule list
via logread
, I could confirm that ip rule list
prints the expected result (the fwmark
line):
daemon.notice procd: /etc/rc.d/S19firewall: 0: from all lookup local
daemon.notice procd: /etc/rc.d/S19firewall: 32765: from all fwmark 0x1 lookup 100
daemon.notice procd: /etc/rc.d/S19firewall: 32766: from all lookup main
daemon.notice procd: /etc/rc.d/S19firewall: 32767: from all lookup default
However when I run ip rule list
in shell, the rule I added had gone:
# ip rule list
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
Did I put ip rule add
in the wrong place?