4

I am running ubuntu server 20.04 and out of the blue I am getting operation timeout. I was wondering how can I troubleshoot the issue.

I am using ufw and the connection port is open. so when I use sudo ufw status , it shows me that the port is accessible.

When I run systemctl status sshd I get that the process is active and that sshd is listening to 0.0.0.0 port xx and :: port xx

I can log on to the machine using my user, so the credentials are not an issue here. I am also able to ping the server from another machine and the ping is working well.

Edit: I am able to connect to the server on the intranet, but not from outside. Is there a way for ssh to be blocked from the internet and not from the intranet?

user68186
  • 33,360
RC-
  • 145
  • The router is serving a website, it is behind a router and the website is functionning. Do you think it might be something in the router? – RC- Aug 30 '21 at 02:42
  • Thank you for pointing this out. It is true, the port is not forwarded on the router. Can you move your comment as an answer so I can mark it as correct? – RC- Aug 30 '21 at 03:15
  • 1
    To the admins and close voters, I know this is not strictly an Ubuntu problem. However, it manifests as one to new home Ubuntu users not familiar with some of the networking concepts. I have voted to close similar questions before, but they keep popping back. I think this question deserves a place in this site. – user68186 Aug 30 '21 at 16:21

1 Answers1

3

Port setup

See the Wikipedia on Port Forwarding to learn more about why you need it.

ssh uses port 22 by default. I will assume you have not changed that. If you changed that port, then you will need to make changes in the instructions below accordingly.

Router setup

Make sure port 22 is forwarded to the Ubuntu server's internal IP address in the home router. This will allow anyone from outside the home LAN use ssh to connect to the home computers.

The instructions are router specific and beyond the scope of this answer as it has nothing to do with Ubuntu.

Some routers allow specifying both incoming port (from the Internet) as well as outgoing port (to the internal IP address of the LAN for the Ubuntu server). In that case, you may want to use a different port, say 2200, when you connect from the outside, and setup your router accordingly:

enter image description here

The picture above is just an example. The settings in your router may look different.

If you have changed the default port in /etc/ssh/sshd_config then you will need to set the internal port above to that port, instead of port 22.

To learn how to setup ssh to work within the home lAN, see Connect two computers with SSH in a home LAN

Here is another port forwarding: how to guide for reference.

Hope this helps

user68186
  • 33,360