Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Debian device on my local network (Raspberry Pi, but that's not important) and I wish to SSH from a Windows PC. When I try to connect to it using the local IP, everything works fine. But I wish to connect to it from outside also, so I setup a Dynamic DNS, port forward and I turned off router firewall. SSH is up and running, since I can access it locally and openssh-server is already installed.

When I try to connect using the global IP, I get a "Connection refused" error.

Why I can't connect from outside?

share|improve this question
By local IP, I assume you mean localhost ( – Julian Knight Jan 20 '13 at 15:42
up vote 2 down vote accepted

You can connect from the outside. You just can't connect from the inside using the outside IP address because port forwarding only works on connections from the outside. If you want to connect from inside machines to your outside IP address, you need hairpin NAT (sometimes also called 'loopback NAT') which is a form of dual NAT. Port forwarding won't do it.

I explain why this won't work in detail in this answer.

share|improve this answer
It worked, thanks a lot! – tampe125 Jan 20 '13 at 16:49

Does Debian on the Pi install IPTABLES by default? If so, this is because the IPTABLES firewall has not been configured to allow incoming SSH connections.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .