This post is now out of date. If you have this problem on a more recent version of Ubuntu, you want my more recent post on this.
Yesterday I had an important video call that I needed to carry out under Ubuntu as I need to demo some of my work. About two minutes before it was due to begin, I noticed that my pings to the home network router were ridiculously variable and high:
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. 64 bytes from 192.168.0.1: icmp_req=1 ttl=64 time=60.3 ms 64 bytes from 192.168.0.1: icmp_req=2 ttl=64 time=82.9 ms 64 bytes from 192.168.0.1: icmp_req=3 ttl=64 time=105 ms
Unfortunately, two minutes before an important call is not the time to be tinkering with network settings, so I left it at the time. Fortunately, it didn't seem to adversely affect the call.
Later, I booted into Windows to find my pings were perfectly normal (1 ms)1. So, what's the issue under Linux?
What it turns out to be is wireless power management. You can easily test this by trying:
sudo iwconfig wlan0 power off
and remeasuring the pings:
64 bytes from 192.168.0.1: icmp_req=1 ttl=64 time=0.970 ms 64 bytes from 192.168.0.1: icmp_req=2 ttl=64 time=1.04 ms 64 bytes from 192.168.0.1: icmp_req=3 ttl=64 time=0.994 ms
Thanks to this forum thread, I found an easy way to make this fix permanent, you need to do something like:
sudo nano /etc/pm/power.d/wireless
and add the following lines to the newly created file:
#!/bin/sh /sbin/iwconfig wlan0 power off
sudo chmod +x /etc/pm/power.d/wireless
so that this script is executable.
Next time you reboot, the fix should still be in place.
I have a feeling that I disabled any wireless power management on Windows when I first installed it a few months back; it may be that you'd suffer a similar problem in Windows too otherwise. ↩