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 refused connect from ldz76dh4a
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