Answer the question
In order to leave comments, you need to log in
Iptables port forwarding?
I'm trying to make port forwarding for ssh through a machine on the same network:
there is a machine 192.168.0.2
there is a second machine 192.168.0.4
both machines on centos 7
forwarding allowed and fixed in sysctl
echo '1' | sudo tee /proc/sys/net/ipv4/conf/eth0/
forwarding
iptables -t nat -A PREROUTING -d 192.168.0.2 -p tcp --dport 2222 -j DNAT --to-destination 192.168.0.4:22
iptables -t nat -A POSTROUTING -d 192.168.0.4 -p tcp --dport 22 -j SNAT --to-source 192.168.0.2
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destinatio
Answer the question
In order to leave comments, you need to log in
I try to ssh 192.168.0.4 -p 2222 I get a fig
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question