When attempting to connect to an SSH server, if ssh_exchange_identification: read: Connection reset by peer appears, and you have access to the SSH server, and the SSH server is a Linux system, check the /var/log/secure file on the SSH server. In this example, the log on the SSH server indicates that the connection was refused.
[root@machine2 ~]# tail /var/log/secure
Jan 28 10:57:06 server1.example.com sshd[11467] refused connect from ldz76dh4a
On the SSH server, ensure connections are allowed in the /etc/hosts.allow file and not denied in the /etc/hosts.deny file.
On the SSH server, ensure connections are allowed in iptables or firewalld.
If the /var/log/secure file on the SSH server displays the IPv6 address instead of the IPv4 address of the client, you can try to disable IPv6 on the client to see if the issue is due to IPv6.
[root@machine2 ~]# sysctl -w net.ipv6.conf.default.disable_ipv6=1
[root@machine2 ~]# sysctl -w net.ipv6.conf.all.disable_ipv6=1
Did you find this article helpful?
If so, consider buying me a coffee over at