R
R
Ruslan Absalyamov2018-04-08 13:57:24
SSH
Ruslan Absalyamov, 2018-04-08 13:57:24

Why when you don’t work for a long time or in some places you can’t connect to ssh?

I have such a problem, the server itself is located on a virtual machine via bitrixvm. The first time after the connection everything works fine. After some time, when the site left in the browser, it stops working and ssh writes

[email protected]:~$ ssh [email protected]
ssh: connect to host 192.168.0.103 port 22: No route to host

But when you restart your computer everything works fine. What causes this problem? And how do you know where to look?
And I tried to do this if it helps
[email protected]:~$ sudo netstat -tpln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3386/sshd

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
chromimon, 2018-04-08
@rusline18

Use not SSH, but Mosh.
This is such a thing that establishes the initial connection via SSH, and then works itself.
Since Mosh has a connection not based on TCP like SSH, but via UDP, the connection does not break for days. Even if you move, for example, with a 3G / 4G router in an area where at times there are gaps in mobile Internet coverage.
Mosh also knows how to predict, that is, it gives you an answer before it actually receives it from the server (when it receives a real answer, it will correct its prediction).
As a result, working on slow/poor quality links with Mosh is much more convenient than with SSH.
Visually and functionally, the session looks the same as with SSH.

K
key don, 2018-04-08
@keydon2

If everything is ok with the connection, then tweak the TCP KEEPALIVE settings on the client and on the server.
And if the connection is unstable, then the solution was suggested above.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question