I'm trying to redirect all local connections with destination matchs port 22 to specified tunnel using iptables MARK, but, something is going wrong.
188.8.131.52 my public address 184.108.40.206 tunnel public address 220.127.116.11 my local tunnel address
Here the configs:
# ip rule show 1: from all fwmark 0x14 lookup 20 # ip route show table 20 default via 18.104.22.168 dev tun0
And I have created following rules on iptables:
iptables -t mangle -A PREROUTING -p tcp --dport 22 -j MARK --set-mark 20 iptables -t mangle -A OUTPUT -s 22.214.171.124 -j MARK --set-mark 20
And when I try to ssh some server(dreamhost in this case) I get:
tcp 6 299 ESTABLISHED src=126.96.36.199 dst=188.8.131.52 sport=37152 dport=22 packets=4 bytes=221 src=184.108.40.206 dst=220.127.116.11 sport=22 dport=37152 packets=2 bytes=133 [ASSURED] mark=0 secmark=0 use=2
Packet is not getting marked and going out through default route, which is 18.104.22.168
I don't know what I'm doing wrong..
Anyone have any idea??