I have two machines on my local network, both connected to a wireless router. From machine A, if I ping my router, I get this:
10 packets transmitted, 10 received, 0% packet loss, time 9038ms
rtt min/avg/max/mdev = 0.836/2.488/3.749/0.931 msFrom machine B, if I ping my router, I get this:
10 packets transmitted, 10 received, 0% packet loss, time 9017ms
rtt min/avg/max/mdev = 2.068/3.452/4.908/0.795 msBut if I ping B from A, I get
10 packets transmitted, 10 received, 0% packet loss, time 9010ms
rtt min/avg/max/mdev = 3.077/223.724/507.174/186.355 mswith similar results for pinging A from B.
What could possibly be causing this, and how would I fix it? Both machines use Arch Linux, fully up to date.
51 Answer
Wi-Fi hardware will usually try to enter a low-power state as much as possible, during which the AP will buffer packets and the client device will only check for waiting incoming packets at certain intervals.
When the machine sends a ping packet first, its Wi-Fi interface will stay online for a while expecting a response to arrive, so there will not be any significant latency. But when the machine is completely idle and is about to receive the first packet from another device, it won't immediately see that you're trying to ping it until the next poll, which could take a long time.
If you expect to use the machine as a server (on AC power, accepting incoming SSH or other connections) you can disable the power save features using:
iw wlan0 set power_save offThis can be added to a udev rule to apply it on every boot, or an acpid script to apply it whenever the system is connected to AC. (It can impact battery life though, so I would not disable it just for the sake of making ping mylaptop look nicer.) I'm writing this while halfway asleep.