title: SSH "kex_exchange_identification: read: Connection reset by peer"
body: <p><strong>The setup:</strong></p>
  
  <ul>
  <li>Raspberry 3B running Raspbian Stretch 9 on an external HDD and using ZRAM</li>
  <li>Raspi used as a webserver running LAMP and MERN stacks and accessed remotely via SSH with 1 IDE (Coda for Mac OS)</li>
  <li>SSH port forwarded by router with static IP</li>
  <li>fail2ban running</li>
  </ul>
  
  <p><strong>The problem:</strong></p>
  
  <p>When accessing the raspberry from a remote location (over the Internet) via SSH, it works until the connection hangs. This occurs randomly. 
  I can sometimes SSH it again after few minutes, and sometimes not until I restart the Raspi.</p>
  
  <p><strong>What I've tried:</strong></p>
  
  <ul>
  <li>SSH in verbose mode from remote location:</li>
  </ul>
  
  <pre><code>debug1: Local version string SSH-2.0-OpenSSH_8.1
  kex_exchange_identification: read: Connection reset by peer
  </code></pre>
  
  <ul>
  <li>SSH in verbose mode from local network (I actually SSH another machine on the local network remotely, then SSH the Raspi from that machine). <em>Same result</em>: <code>Connection reset by peer</code></li>
  <li>Checked <code>/etc/hosts.allow</code> and <code>/etc/hosts.deny</code> <em>=> Nothing there</em></li>
  <li>Checked iptables via <code>iptables -L --line-number</code> <em>=> Nothing there</em></li>
  <li>Checked logs: <code>/var/log/fail2ban.log</code> and <code>sudo journalctl -t sshd</code> <em>=> Nothing striking there</em></li>
  <li>Updated <code>sshd_config</code> with <code>no DNS</code> </li>
  <li>Re-installed SSH via <code>apt-get --reinstall install openssh-server openssh-client</code></li>
  </ul>
  
  <p>I am running out of ideas here and no clue about what's happening.
  As someone encountered the same problem with SSH connection before ?
  Could it be a load issue on the raspberry ?</p>