CodexBloom - Programming Q&A Platform

Ubuntu 22.04 - SSH Connection Timeout with 'Connection reset by peer' scenarios after Network Change

👀 Views: 25 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-08
ubuntu ssh networking bash

I'm building a feature where I'm optimizing some code but I've tried everything I can think of but I've looked through the documentation and I'm still confused about After updating the network configuration on my Ubuntu 22.04 server, I am working with SSH connection timeouts with the behavior message 'Connection reset by peer'... The server was previously accessible, but after changing the network interface from static to DHCP, the scenario started occurring. I verified that the SSH service is running with the command: ```bash sudo systemctl status ssh ``` The output indicates that the service is active (running). I also checked the SSHD configuration in `/etc/ssh/sshd_config` and did not find any obvious issues. The relevant parts of the configuration are as follows: ```plaintext Port 22 PermitRootLogin no PasswordAuthentication yes ``` To troubleshoot, I attempted restarting the SSH service: ```bash sudo systemctl restart ssh ``` But still encountered the same connection reset behavior. I also checked the firewall settings using `ufw` and confirmed that SSH traffic is allowed: ```bash sudo ufw status ``` The output showed that the SSH rule is enabled. I ran `ip a` and noted that the new IP address assigned by DHCP is correct and reachable from the local network, but when I try to connect via SSH, it gives me the timeout. I also looked at the logs in `/var/log/auth.log` for any clues, but there are no specific entries corresponding to the connection attempts. I suspect there may be a deeper network scenario or that the new DHCP settings are causing some kind of conflict. Has anyone encountered a similar scenario after changing from static to DHCP, or is there something specific I might be missing in my SSH configuration? I'm working on a service that needs to handle this. How would you solve this? I'm working on a service that needs to handle this. Any suggestions would be helpful. Any advice would be much appreciated. What am I doing wrong?