I had this one day connecting to a guest:
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 192.168.71.81 port 22
The cause was indeed a heavily overloaded box that would not respond in time to any actual data sent over network requests, but would accept the initial TCP connection.
Logging on the console also failed, but the memory and CPU usage on the wrapping host was out of the roof.
The only solution was to soft power-cycle the guest.
Very similar to:
You can also have a host who’s memory is so badly fragmented that it can’t allocate a page a contiguous memory to fork the process for hosting an SSH session.
In such a case, you can get either of the messages:
ssh_exchange_identification: read: Connection reset by peeror:
Connection closed by aaa.bbb.ccc.ddddepending on how far the host gets before it bails out.
If memory fragmenting is the apparent cause, the solution is to access the server via other means and to restart some of the pertinent services. I have found Apache and MySQL to be the culprit on VM’s since VM’s don’t have a swap partition. Failing that, reboot the host.
Via: [WayBack] linux – ssh_exchange_identification: Connection closed by remote host (not using hosts.deny) – Unix & Linux Stack Exchange
–jeroen










