12

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?

2
  • Can you connect the laptop to a wired network? Just to exclude some factors... May 2, 2015 at 19:29
  • Unfortunately I only have one ethernet cable :(. Pinging NixOS from another windows laptop on the wireless network shows similarly slow replies (~ 100-200ms) May 2, 2015 at 20:11

2 Answers 2

17

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.

4
  • And is it faster now?
    – ott--
    May 2, 2015 at 20:47
  • er, yes. embarassed to have neglected that. I will edit the answer. May 2, 2015 at 21:56
  • It's magic. It really works.
    – Bohao LI
    Dec 17, 2020 at 23:21
  • 1
    Can confirm this solved my issue. I went from 30ms to 500ms ping, to 2ms to 6ms ping. Be warned that this setting will reset on reboot, but you can make it permanent by following this answer: unix.stackexchange.com/a/315400/438536
    – DariusK
    Mar 19, 2021 at 15:38
1

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
'';

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .