My ssh server is set up on the standard port, and I forwarded the correct port in my router, but I'm still getting a "connection refused" message when trying to connect from the outside. I can connect from the inside just fine.

closed as off-topic by David Foerster, wjandrea, Sumeet Deshmukh, Charles Green, Zanna May 19 '17 at 4:31

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – David Foerster, wjandrea, Sumeet Deshmukh, Charles Green, Zanna
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    If you can connect to the SSH server from the local network but not from the general internet the issue lies not with Ubuntu. – David Foerster May 18 '17 at 22:28

If you can connect from your local network, Ubuntu most likely has nothing to do with it - it's a network configuration issue.

Many ISPs block incoming connections on "unusual" ports (or all incoming connections). Some ISPs have a setting in their control panel enabling/disabling port blocking.

As a diagnostic - try exposing port 80 (Apache running some webpage) - I'm almost sure you'll find it doesn't work either.

You can also fiddle with modem settings (how do you know you forwarded "the correct port"?), but this would only help after you triple-checked your provider doesn't block you.

  • 1
    +1 also just to add that the M-Lab set of tools are quite comprehensive, and can sometimes help with more obscure connection problems. – Tom Brossman Feb 24 '12 at 8:05

For testing purpose, add another non standard listening port (say 2222) in /etc/ssh/sshd_config file, then do sudo service ssh restart and forward this port in your router too. Then try to ssh from outside with option -p2222.

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