When attempting to connection from machine1 to machine2 using ssh, if ssh_exchange_identification: read: Connection reset by peer appears on machine1 (the client), check the /var/log/secure file on machine2 (the OpenSSH server). In this example, the log on machine2 to indicates that the connection from machine1 was refused.
[root@machine2 ~]# tail /var/log/secure . . . Jan 28 10:57:06 machine2 sshd refused connect from machine1
On machine2 (the server), ensure machine1 (the client) is allowed in the /etc/hosts.allow file.
On machine2 (the server), ensure machine1 (the client) is allowed in iptables.
If the /var/log/secure file on the server displays the IPv6 address instead of the IPv4 address of machine1, you can try to disable IPv4 on machine1 (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