Laggy SSH sessions on local network
I have two machines:
- Windows 7 connected by ethernet to a router
- NixOS laptop, connected wirelessly to same router
My issue is that sshing from Windows to NixOS is extremely laggy. If I ping NixOS from Windows, I get times of about 100ms - 200ms. If I do the reverse- ping Windows from NixOS- I get times < 10ms.
The NixOS install is recent. Prior to this, I had Arch Linux, which did not suffer the same problem. I don't recall any other changes.
Additionally, I can ssh to a remote server not on the LAN. SSHing from either Windows or NixOS to the remote server has no issues whatsoever with lag.
I have tried the following:
- setting this option in sshd's config:
UseDNS no
- setting my nameserver to
8.8.8.8
However, these haven't helped (seems to be a lower-level issue than sshd)
My question: what do I need to do to stop SSH lagging?
I found this thread, which suggests running the following command as root:
iw wlp2s0 set power_save off
I ran this on my NixOS machine. This turns off power saving for the wifi network device wlp2s0
. If you have a differently-named device (like wlan0
), you need to use that name instead.
SSH is now much more responsive, and ping times are also back down to < 5ms.
Since this is also a Nix related question, I'd put my two cents in as I strumbled into this problem as well.
I'm using networkmanager so the wifi powersave can be disabled by setting the following config:
networkmanager.wifi.powersave = false;
For wpa_supplicant
I think it should be the following configuration, but I have not tested it by myself:
networking.wireless.extraConfig = ''
power_save=0
'';