9

I've had a strange problem with SSH connections inside my LAN for a few months. It only happens when I'm using my Windows 10 device to connect to a (barebone) linux machine.

When I connect to a SSH server it's like my input is only sent once every second. If I hold a key, it doesn't print anything for a second and after that second I see every keystroke I did during that time.

This is how it looks on the working servers:

This is how it looks on the ones with the issue:

Things I have tested/found out

  • Changing the "UseDNS" setting in /etc/sshd doesn't fix it
  • It happens with bash (and zsh) on Debian (OpenSSH_7.4p1 Debian-10+deb9u6, OpenSSL 1.0.2r 26 Feb 2019) and Ash on Alpine Linux (OpenSSH_7.9p1, OpenSSL 1.1.1b 26 Feb 2019)
  • It doesn't happen on Alpine Linux OpenSSH_7.7p1, LibreSSL 2.7.4
  • It doesn't happen with every machine, just some (not depending on the distro)
  • resolv.conf is correct
  • Error happens with and without ClientAliveInterval (tested on client and server)
  • Pinging the devices is always fast (less than 1 ms) so it's only SSH
  • It also lags when I ssh from the linux subsystem on Windows 10 and with Putty and with MobaXterm
  • No problems when I connect from Linux instead of Windows

Does anyone have any clues or things I could try? Thanks

1 Answer 1

14

Typically this is a sign of Nagle's algorithm, you can turn that socket option off.

(I have seen similar TCP delays between Linux and Windows before in other cases as well. In one case it was caused by interactions between TCP Windows sizes and PSH (Push) flags which caused Windows to acknowledge late and/or retry.)

5
  • Awesome, thanks for that quick fix! In the Putty settings I unchecked the "Disable Nagle's algorithm" checkbox (which seems to be ticked by default) and now it works!
    – Christian
    Apr 4, 2019 at 19:49
  • @Christian thanks for confirmation, I simplified my answer a bit
    – eckes
    Apr 4, 2019 at 20:04
  • @Christian, I am confused. You enabled Nagle's algortihm, and now the characters do not come in larger packets? That seems the wrong way around to me, so maybe the answer before the edit was actually better.
    – Carsten S
    Apr 5, 2019 at 9:22
  • @CarstenS yes all I did was uncheck the "disable Nagle's algorithm" in Putty meaning I enabled it. But I think it's an older version of Putty so maybe the lable on the checkbox is wrong
    – Christian
    Apr 5, 2019 at 12:47
  • Hm, indeed strange.
    – eckes
    Apr 5, 2019 at 17:12

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