2
0
I am having trouble connecting to an SSH server behind a NAT on an ubuntu workstation. I've installed openssh package(both the client and the server) and forwarded port 22 through the NAT and tried to connect remotely:
ssh sebi@xxx.xxx.xxx.xxx
However, the connection is being refused. I ran iptables -L which gives:
$ sudo iptables -L
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 destination
Afterwards, I added an entry for all inbound connections on port 22
sudo iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT
The issue is not fixed. After having read about SSH port forwarding I noticed that I had to add the following line
GatewayPorts yes
to /etc/ssh/sshd_config on the server box. I've restarted the service but I still can't connect. Is there something I'm missing?
You do not need
GatewayPorts
for this. That setting is not at all relevant to what you are doing. The problem is very likely something configure on your router performing the NAT. In any case, just do something simple like runningtcpdump -qni any port 22
on the ssh server, then attempt to connect. If you don't see any output then your NAT is not working. – Zoredache – 2014-01-31T22:45:29.260