The “Connection reset by peer” error occurs during a network connection when the other end or server closes the connection without reading the transferred data. The peer will return the data packet you sent while sending the RST (reset) bit and forcefully terminate the connection.
This issue usually happens if you are being blocked by the Firewall on any point in the route. But it can also happen due to other reasons. In this article, we mention different causes for the error along with how you may resolve it in each scenario.
Causes for Connection Reset By Peer
Here are some of the potential reasons for the “Connection reset by peer” error:
How to Fix Connection Reset by Peer
First, ensure your system is not too busy. If you have high usage of CPU, memory or network, you’ll experience issues while setting up a new connection.
Also, try restarting the session and retry the attempt to make the connection. Then move on to the possible solution we have provided below.
Most of the steps we have mentioned are fora Debian based Linux server. If you have any other system, you may apply similar steps by searching on the internet for the exact process. Some commands also vary between the different Linux systems. So look out for those as well.
First, you need to check the logs or error messages to narrow down the reason for the error.
If you have access to the server, you may check the server-side logs as well.
For example, if you are experiencing this issue while setting up an ssh connection, you need to check the /var/log/auth.log file. To do so,
It shows the logging information sent by the SSH daemon during the authentication attempts of your remote system.
Check Internet Connectivity and Routing
The next thing you should do is check for internet connectivity issues. you may verify if the public or private server has gone down using IP lookup or similar websites.
you may also use usetracerouteortracertto trace the route between the two endpoints and check which access point is resetting your connection. The syntax is: