Why do I get 'connection reset by peer' ssh disconnections more frequently from my home internet versus the office internet?

I've been researching this issue on and off for years now and the other questions&answers on this site and Google don't help me.

Here's an actual disconnect example when my internet was otherwise fine:

Read from remote host examplehost.com: Connection reset by peer Connection to examplehost.com closed.

I've been through all the checking of ssh/sshd config, etc., for things like ServerAliveInterval, ServerAliveCountMax, TCPKeepAlive, including esoteric suggestions like enable/disable GSSAPIAuthentication-related settings.

All systems are CentOS servers.

I connect to the same servers, via ssh, from the office and at home. I setup the routers, myself, at both places. The office router is an small-office class DSR-250N and my home router is a home-class DLink DIR-655.

Possibly of interest: I use VPN and, intriguingly, ssh connections over VPN seem to stay up as long as the VPN stays up (days to weeks).

This has been going on for years so I now suspect it has to do with router limitations rather than who provides the internet, but I'm not sure exactly what limitations there might be on a home-class router and what to look for in a new router to ensure these problems are at least reduced significantly.

Maybe it's router memory, maybe it's something like those 'session limit' specs I see on some routers, etc.?

I would be satisfied to know if the problem is just my relatively low-end router (although I think it's upper-middle end for home routers).

Thank you,

  • You say you checked the keep alive settings, but what did you check for? What are they set to? Also, D-Link sucks and you should stop buying it.
    – Daniel B
    Oct 28, 2016 at 16:34
  • Pleas consider making the settings code (```) and maybe mark the error as a quote (>). Do you have different ISPs for home and work? Your home ISP might have a regular scheduled disconnect or might put you into some kind of carrier grade NAT and your server doesn't like it? Are you using a Wifi or wired connection at home?
    – Seth
    Oct 28, 2016 at 16:34
  • @DanielB I mean I setup all those settings with recommended values for sshd and ssh and no combination seemed to help this particular problem. I know DLink seems to have a bad reputation but after going through the top major brands for SOHO routers (Cisco, Linksys, DLink, TP-Link, even Belkin) I was surprised, myself, that I settled on the DSR-250N at work. It's been pretty reliable, fast and just 'not a problem' since we set it up.
    – Shovas
    Oct 28, 2016 at 17:20
  • @Seth Thanks, I highlighted them. Yes, different ISPs, both are the top internet providers in our area. I'm using a wifi bridge on the computer where i get the disconnects. Guess I really should try a wired connection...swear I tried this tho...I'll try again.
    – Shovas
    Oct 28, 2016 at 17:22
  • 2
    I had this problem with my new wifi access point over 5G. I used Wifi Explorer Lite (free) to scan the wifi networks in my area and found that my access point was changing its channel very frequently and it appeared to coincide with when I would lose my ssh connection. My solution that has worked great for almost 2 weeks now was to set the router to a specific channel instead of auto. Hope that helps someone!
    – PRS
    Sep 14, 2018 at 2:11

3 Answers 3


EDIT: The router turned out to be the problem. After switching the router (DIR-655) for a DSR-250N I've had 100% uptime for a week now which is unheard of for my internet in the past few years. So, I'm marking this as the answer. Sometimes it helps to just swap in a different router, I guess.

Update 2018-04-20: Router has been very stable since July 2017 when I replaced it. Not perfect but, for example, my ssh sessions staying up for one or two weeks at a time, whereas before they were crashing within an hour frequently. I suspect some of my disconnects are even due to the ISP rather than the router.

It's a little early to tell but, after having actual internet outages more frequently than I would expect, I swapped out my DIR-655 for a DSR-250N (due to good experience at our office with this router) and it hasn't exhibited any of the previous symptoms either with internet outages or ssh disconnecting.

I'll give it a week and if ssh stays up for longist periods at a time I'll call this the answer.

Who knew? It could just be a bad / deteriorating router...


Edit: This worked for longer than I expected but also quit sooner than configured for. I have a ping server watching my internet connection and it doesn't look like any internet connectivity issues came up. So can't say this is the fix.

After trying countless combinations of client-side and server-side variations of TCPKeepAlive, ServerAliveInterval, ServerAliveCountMax, ClientAliveInterval, and ClientAliveCountMax, I synchronized both client and server to these settings:


TCPKeepAlive no

ServerAliveInterval 60

ServerAliveCountMax 525600


TCPKeepAlive no

ClientAliveInterval 60

ClientAliveCountMax 525600

And I've been running all day (crosses fingers) during which I would have fully expected to have been disconnected frequently and quickly.

Note my AliveCountMax values are questionably large, you should tweak to suit your needs.

  • Still no solution to this. I run a wireless bridge from this computer. I have another computer wired to the home router. I'm going to try running long ssh sessions on that one and see what happens.
    – Shovas
    Feb 18, 2017 at 17:37
  • well, did you try mosh ? mosh.org
    – Thomas
    Jul 27, 2020 at 9:48
  • I did, it had some terminal behaviour oddness I couldn't live with. I logged a bug with them (some others did, too). It's no longer a big issue with me since I got a new router that doesn't exhibit the same problems.
    – Shovas
    Jul 28, 2020 at 21:27

I had the same sort of situation happening with my Netgear XR500 Gaming Router. I talked to their tech support who hadn't heard of anything like this. We did a firmware refresh and factory reset and it got better. I am absolutely amazed that this worked. Kinda makes me want to do that to my old router and see how it behaves.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.