Answer the question
In order to leave comments, you need to log in
How to do SNAT port forwarding on iptables or shorewall?
Hello.
Tell me what I'm doing wrong.
I have interfaces on Debian:
ens18 ip 192.168.1.125/24 - server locale 192.168.1.0/24
ens19 looks to the Internet ABCD/24 white IP
ens20 ip 192.168.10.250 looks to telephony locale 192.168.10.0/24
iptables -A FORWARD -j ACCEPT
iptables -t nat -A PREROUTING -d A.B.C.D/32 -p tcp -m tcp --dport 4899 -j DNAT --to-destination 192.168.10.3:4899
iptables -t nat -A POSTROUTING -d 192.168.10.3/32 -o ens20 -p tcp -m tcp --dport 4899 -j SNAT --to-source A.B.C.D
nmap A.B.C.D -p4899
4899 RAdmin <b>filtered</b>
Answer the question
In order to leave comments, you need to log in
iptables -t nat -A POSTROUTING -d 192.168.10.3/32 -o ens20 -p tcp -m tcp --dport 4899 -j SNAT --to-source ABCD
Show the output after applying your rules.
sudo iptables -nvL
sudo iptables -nvL -t nat
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question