Disabling Ubuntu's Broken Wi-Fi Driver

Since I started using Ubuntu on more of my machines, I've encountered myriad issues relating to the wireless internet. Every few minutes, my wireless internet would simply dropout without warning and often without even realizing that the connection had vanished. Reconnecting was a nightmare, and was frequently most easily accomplished by simply rebooting my machine. Even when the wireless was 'working', pinging (with ping would be slow and unreliable. Worst of all, this issue would often even limit my ability to get any work done for stretches of time, not to mention that it would invariably put me in a foul mood.

Admittedly, this post is mostly for my own reference, since it's decently well documented online if you know what you're looking for. However, if it can be helpful to any of you, that's motivation enough for putting this here.

Fixing the Problem

Fortunately, I seemed to have found a solution (by googling the sophisticated phrase "Why does my wireless drop out on Ubuntu?"). After a bit of extra digging beyond this helpful StackExchange post, I discovered that a rather shocking number of people have trouble with iwlwifi, the Intel WiFi driver for Linux. It would appear that the issue boils down to some kind of shortcomming with the 802.11n protocol (check out this informative blog post for more details).

At any rate, there is a solution to this problem! Running modinfo iwlwifi in the terminal (open a new terminal on Ubuntu with ctrl-alt-t) will show us the configuration options for the driver. Among them is the following:

parm: 11n_disable:disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX (uint)

Aha! I can switch off this "functionality" using the following commands:

sudo modprobe -r iwlwifi
sudo modprobe iwlwifi 11n_disable=1

The difference was immediately apparent, and pinging worked substantially faster than before:

$ ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=58 time=1.45 ms
64 bytes from icmp_seq=2 ttl=58 time=3.93 ms
64 bytes from icmp_seq=3 ttl=58 time=1.48 ms
64 bytes from icmp_seq=4 ttl=58 time=3.06 ms
-- ping statistics --
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 1.459/2.485/3.934/1.059 ms

However, this change is not perminant, and upon rebooting your computer, you will need to run these commands again. To fix this, we need to update the /etc/modprobe.d/iwlwifi.conf file and set the same 11n_disable option as before. This can be done with the following line in the terminal:

echo "options iwlwifi 11n_disable=1" | sudo tee /etc/modprobe.d/iwlwifi.conf

After making these changes, I found that the performance of my wireless internet vastly improved, and I was finally able to stay connected with some degree of reliability.