2

Recently I tried to set my Ubuntu 14.04 desktop computer (I will call it "computer A") as a ssh server so I could access it remotely from my laptop (I will call it "computer B"). I installed openssh-server, and up till this point have not modified the /etc/ssh/sshd_config file.

The problem is, I believe I set up everything correctly, and although I can access computer A from computer B through ssh using computer A's permanent internal IP address on the router while in the same network (and also through localhost within computer A):

ssh [email protected]

I cannot access computer A using the external IP address, as in:

ssh -vvv username@the-external-ip-adress

After a long while I get:

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to the-external-ip-adress [the-external-ip-adress] port 22.
debug1: connect to address the-external-ip-adress port 22: Connection timed out
ssh: connect to host the-external-ip-adress port 22: Connection timed out

I tried connecting through the external address both from inside and outside the network. This adress I found it at canyouseeme.org and by googleing it. I also used canyouseeme.org with my IP and port 22 which is the one specified in my sshd_config by default and also finds it unable to access the service due to connection time out.

I have checked pretty much every forum and post about similar problems, sometimes of seemingly the exact same problem, but found no solution. Based on all what I have read, I provide screenshots with information about my router configuration (port forwarding and so on) that is or may be relevant.

I also:

  • have enabled port 22 on my firewall ("sudo ufw allow 22")
  • have tried disabling the firewall
  • have tried reenabling the firewall
  • have tried disabling the router's firewall
  • have tried reenabling the router's firewall
  • have tried adding the port to the iptables ("sudo iptables -A INPUT -i eth1 -p tcp --dport 22 -j ACCEPT")
  • found the /var/log/auth.log only with local records
  • found the /var/log/daemon.log empty
  • have tried ping with 100% package loss
  • have rebooted computer A
  • have rebooted the router
  • have checked for access restrictions in the /etc/ssh/sshd_config file but did not find any.

SCREENSHOTS

Any suggestions? Please keep in mind that I can perfectly ssh into computer A and use it from within the network and using computer A's IP local address, as well as localhost from within computer A. As far as I understand, this suggests that there's nothing wrong with the ssh server configuration of computer A. But I may be wrong.

UPDATE: I also recently noticed that the IP (external IP) is constantly changing (after very long periods of time), of course I always try to connect to the current IP. Could having a non-static IP have something to do?

11
  • How did you find and set up "the-external-ip-adress"?
    – dadexix86
    May 2, 2016 at 8:02
  • In addition to @dadexix86 's question, can you ping A with A's external IP? Try hosting a http server like apache and check if it's reachable. I'm suggesting http because it never creates problem with firewalls and is easy to setup as well.
    – 7_R3X
    May 2, 2016 at 8:34
  • @dadexix86 Hello dadex. I Googled it. Also canyouseeme.org provides it by default.
    – E C
    May 2, 2016 at 8:53
  • @7_R3X Hello 7_R3X. I did ping it as I wrote in the post; it goes on forever and when I cancel it returns a 100% package loss. Never gets to connect.
    – E C
    May 2, 2016 at 8:54
  • @EduardoCasillasAllen you googled what exactly? If you put in that website the public address of your router, what you are trying to do is access your router, not your computer behind it. So, i ask again. How did you find and set up your "external-ip-adress"? Remember that you have to forward the traffic on that door to the router to your server behind it. Have a look at help.ubuntu.com/community/ServersBehindNAT
    – dadexix86
    May 2, 2016 at 10:00

3 Answers 3

2

The problem with this was that the Internet Service provider wasn't allowing me to properly port forward. I changed provider and problem solved.

0

It is also possible that your wireless ISP is blocking ssh traffic and/or traffic to the router. The -vvvv options can be involved on the client and debug data requested on the server. -d option is useful to troubleshoot the daemon. If you check the manpage for sshd, it is there. So, stop the normal sshd (service stop) and manually run it - sudo /usr/sbin/sshd -d then watch the debug output as you attempt connections from the other box. Might want to tee the output to a log file - that output is to stderr, not just stdout, so do any redirection desired.

0

You should check that you have a Gateway defined in your network config file.

2
  • 2
    how to do so ?, Aug 28, 2018 at 4:15
  • Welcome to askubuntu. Please answer question with full steps and explanation to the solution. If you are uncertain how a good answer is written, resort to askubuntu.com/help/how-to-answer
    – mondjunge
    Aug 28, 2018 at 7:15

You must log in to answer this question.

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