0

A month ago I could connect to a remote server via ssh, but for a week, I can't. At the moment I have access to the server locally and when I try to connect to localhost, to test if it works, I can connect. ssh username@localhost

it's okay locally.

But from a remote machine:

ssh username@ip-address-of-server

I get this message:

ssh: connect to host ip-address-of-server port 22: Connection timed out

On this server is running a webpage also, of course on port 80. The webpage is works.

Note: I can ping the server, with 0% packet loss, so I received all the transmitted packets.

I've already tried to restart the ssh on server, but still not working. Only locally to localhost, but not remotely.

I tried from different remote machines with no success.

So, why could I connect earlier, and not now? What's the problem?

I asked this already on [stackoverflow.com][1], but now it's put on hold as off-topic there.

5
  • What does netstat -nlt | grep -w 22 show, on the server?
    – ams
    Commented Apr 1, 2016 at 12:01
  • tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp6 0 0 :::22 :::* LISTEN Commented Apr 1, 2016 at 12:33
  • Looks fine. If the auth.log shows nothing then I'd say there's a firewall or broken NAT port mapping somewhere.
    – ams
    Commented Apr 1, 2016 at 12:34
  • And how can be fix these problems? Commented Apr 1, 2016 at 12:37
  • You have to find them first; if you didn't set up a firewall on your server then the problem is most likely elsewhere, but you can check the rules with iptables -L.
    – ams
    Commented Apr 1, 2016 at 12:44

2 Answers 2

0

Do the following at your remote server while trying to connect via ssh:

tail -f /var/log/auth.log

Is there any getting error logged? If you cant see any logs produced by your attempted login, this is propably a network problem (firewall, switch acls, etc.).

2
  • No logs received. Probably the problem is with the firewall of the server? Commented Apr 1, 2016 at 12:34
  • Did you set up a server firewall? I was talking about a "real" network firewall.
    – hub
    Commented Apr 1, 2016 at 13:14
0

As you describe the scenario, you want to perform "inside access" and "outside access". In your case, I understand that inside access gets done from a host towards a SSH server both residing on the same IP subnet. On the other hand, you mention "remote access" which I suppose you refer to getting access to the SSH server from a host that resides on another IP subnet (outside access). The only way to do the latest is via a router and on the top of this, the router should be able to perform a very basic functionality called Port Forwarding. Having said that, for some reason your router has lost the port forwarding capability. There are two possibilities: to restart the router because it became "buggy" or to revise the port forwarding configuration on the router that forwards the external call towards the SSH port of the router to the SSH port of the internal SSH server. Please note that many other factors may apply but the description does not provide enough information to further support the case. In either case, the troubleshooting efforts should be put on router analyzing if the router receives SSH calls/hits on the external interface and if so, analyzing why the router does not forward the SSH traffic towards the internal SSH server. If you got the solution to work in the past as "per magic" without "doing anything", please check the UPnP activation/capabilities on both, the router and the server.

You must log in to answer this question.

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