if connections to other ports are normal, then network failures along the packet path and temporary server overload can be eliminated.
perhaps, somewhere along the packet path, filters are triggered, limiting the number of new connections per unit time to a given port.
I proceed further from the assumption that any of the distributions of the gnu / linux operating system are installed on the server.
To determine whether this is happening on your server, or even before it, it is worth making sure that connection attempts are recorded in logs ( /var/log/auth.log
, /var/log/audit/audit.log
, etc.) in those moments when you get an error about the expiration of the connection time.
It is also worth inspecting the netfilter rules on your server for limiting rules :
$ sudo iptables-save | grep limit
update about another port :
and, of course, it makes sense to try connecting to another port: add the port номер_порта
(in addition to the existing port 22
) on the server in /etc/ssh/sshd_config
and connect using this port ( sshd will need to be restarted):
$ ssh -p номер_порта пользователь@машина
номер_порта
makes sense to choose from the range “greater than 1024” (maximum number - 2 16 = 65536).
and in order not to specify the port each time, add a couple of lines to ~/.ssh/config
:
host машина port номер_порта