I have a machine running debian 8. I want to forward the packets that arrive to the IP 10.10.12.12:12004 (interface tun0) to the IP 192.168.0.158:12004 (interface eth0).
I have tried the following iptables rules, but unsuccessfully (the rules are not even saved to iptables checking with --list option):
iptables -t nat -A PREROUTING -p tcp -s 0/0 -d 10.10.12.12 --dport 12004 -j DNAT --to 192.168.0.158:12004 iptables -t nat -A POSTROUTING -o eth0 -d 192.168.0.158 -j SNAT --to-source 10.10.12.12
Is there anything wrong in the rules above?