Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 (127.0.0.1)? –  Julian Knight Jan 20 '13 at 15:42
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.