I've got a working domain for my Raspberry Pi to which I can ping to. I forwarded the port for SSH (Port 22) on my router as well, but I still cannot connect from outside to my Raspberry.

Connecting to it via the local IP address in the local net works perfectly fine. However, ssh [username]@[domain] is not working. Connection refused to port 22. I'm using Ubuntu. Have you got any ideas?

1 Answer 1


Have we got any ideas? Probably.

  • Try opening up your firewall using iptables -A INPUT -p tcp --dport 22 -j ACCEPT
  • Maybe your router (or Pi) uses DHCP and your port forward isn't valid anymore. Try running ifconfig -a and check the IP of your network interface (probably eth0).
    • Check if inet addr still matches the one on your port forward.
  • Double-check your domain's A record. Some ISPs assign IP addresses using an address pool and DHCP. Maybe your domain's A record isn't your IP address anymore.
    • You can just ping the domain the run curl icanhazip.com on your Pi and check if the IP addresses match.
  • Maybe your ISP is a butt and placed you behind a transparent proxy (since maybe they have a limited IP pool). This is actually the primary reason I switched ISP. Check using http://www.lagado.com/proxy-test
  • it doesnt work. with the "nmap" i found out that the port 22 is "closed". thats why i changed the port to be listened from 22 to 7. Surely i portforwarded port 7 as well. i'm still not able to connect to my raspberry pi. ssh [name]@[domain.com] -p 7 does not work. im out of ideas.
    – Quving
    Commented Apr 25, 2016 at 21:18
  • @Vinhi Check the last bullet.
    – Aloha
    Commented Apr 26, 2016 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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