The setup:
- Raspberry 3B running Raspbian Stretch 9 on an external HDD and using ZRAM
- Raspi used as a webserver running LAMP and MERN stacks and accessed remotely via SSH with 1 IDE (Coda for Mac OS)
- SSH port forwarded by router with static IP
- fail2ban running
The problem:
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.
What I've tried:
- SSH in verbose mode from remote location:
debug1: Local version string SSH-2.0-OpenSSH_8.1
kex_exchange_identification: read: Connection reset by peer
- SSH in verbose mode from local network (I actually SSH another machine on the local network remotely, then SSH the Raspi from that machine). Same result:
Connection reset by peer
- Checked
/etc/hosts.allow
and/etc/hosts.deny
=> Nothing there - Checked iptables via
iptables -L --line-number
=> Nothing there - Checked logs:
/var/log/fail2ban.log
andsudo journalctl -t sshd
=> Nothing striking there - Updated
sshd_config
withno DNS
- Re-installed SSH via
apt-get --reinstall install openssh-server openssh-client
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 ?