iptables -A PREROUTING -t nat -d $external_ip -j DNAT --to-destination $tun iptables -A POSTROUTING -t nat -s $tun -o eth0 -j SNAT --to-source $external_ip
The problem is I need SSH packets to hit the local interface (i.e. not go down the VPN). Solution: add a REDIRECT rule before the DNAT in the PREROUTING chain:
iptables -A PREROUTING -t nat -d $external_ip -p tcp --dport 22 -j REDIRECTThe REDIRECT target sends to localhost (really the same as DNAT with --to-destination 127.0.0.1).
No comments:
Post a Comment