Putty keeps disconnecting

On a recent vacation, taking a train across the entire country, I was using my cell phone’s 3G connection to provide my Internet connection. Every little tunnel and other signal interference along the way would cut off the SSH connection I was sending all my traffic through.

While googling, still on the train, I found the PuTTY FAQ, which says this is actually a Windows problem. In short, the solution is to increase the amount of times Windows will attempt to resend lost TCP packets.

This is done by going into the Windows registry, using “regedit” or another suitable tool You can launch regedit by typing WinKey+r, then entering “regedit” into the dialog box.

Once in, browse to the following path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\

In there, change (or create, if missing), the following keys and values:

TcpMaxConnectRetransmissions => 16
TcpMaxDataRetransmissions => 32

Depending on your registry tool, it might ask you to specify a type for the (new) variables. Use DWORD, and the 32-bit kind of DWORD if your tool allows you to specify that.

Reboot and try again.

After doing this, no railroad tunnel could break my SSH connection. Everything would just pause for a few seconds while Windows was sending the same packets over and over, trying to reach the server.

You can probably set these variables to higher numbers too, but I already increased them quite a bit from the values the PuTTY FAQ told me to use, and these are the ones that worked for me.

1 Comment

  • sysadmin says:

    I had a similar issue and fixed it by setting “Seconds between keepalives” parameter to 120 (default is 0) in the “Connection” tab.

Leave a Reply

Your email address will not be published. Required fields are marked *