I recently replaced my cable modem and wanted to measure the increase in speed that I used as the rationale for the upgrade. (For those of you that are married, you know exactly why I needed to do this.) But along the way, I ran into a few surprises–most notably that I wasn’t getting anywhere near the speeds I expected until I tweaked the settings of my wireless network card.
A quick hardware inventory
Grepping the output of lspci, my network controller appears as:
|
1 2 |
ricky@yzerman:~$ sudo lspci | grep Network
07:07.0 Network controller: <strong>RaLink RT2561/RT61 rev B 802.11g</strong> |
I picked up this RaLink card for about $8 US in a bargain bin at the local MicroCenter, and it has worked out pretty well. I knew beforehand that this chipset had Linux support, but I didn’t realize until later that the firmware implementation was not entirely freedom-respecting software. (Shame on me. I will remedy this problem in the near future.) If you’re interested in a list of hardware that supports GNU/Linux, check out the Free Software Foundation’s hardware database. More specific to this blog post is the Wireless Cards & USB section of the database.
To round out the setup, I am using Debian Lenny 5.0.4 64-bit (with all free software except that firmware thing I mentioned), a Motorola SB6120 cable modem, and an old Linksys WRT54G2 wireless router. The software I use to benchmark my Internet speed is the online service at Speedtest.net.
Before and after the tweak
With all the defaults on the card and the firmware, and letting NetworkManager do its thing, the results of my speed test are:
6.07Mbps download and 2.24Mbps upload speed?! That’s terrible. So, after a little searching and twice as much thinking and tinkering, it turns out the problem is in the automatic rate negotiation between my wireless card and router. Here’s the output from iwconfig:
|
1 2 3 4 5 6 7 8 9 10 |
ricky@yzerman:~$ sudo iwconfig wlan0
wlan0 IEEE 802.11bg ESSID:"calebscreek.local"
Mode:Managed Frequency:2.412 GHz Access Point: 00:1E:E5:XX:XX:XX
<strong>Bit Rate=54 Mb/s</strong> Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=62/70 Signal level=-48 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0 |
The key here is Bit Rate=54 Mb/s, which seems reasonable at first (since the card is capable of that speed), but my broadband connection simply does not provide that much bandwidth. While Comcast tells me that my connection is capped at 12Mbps, I can consistently get between 16 and 17Mbps when connecting a wired NIC directly to the cable modem. So, knowing that the wireless router will never have any more available bandwidth than 16-17Mbps, I decided to manually set the bit rate on the wireless NIC to the next available setting above that ceiling–which turns out to be 18Mbps.
|
1 2 3 4 5 6 7 8 9 10 11 |
ricky@yzerman:~$ <strong>sudo iwconfig wlan0 rate 18M</strong>
ricky@yzerman:~$ sudo iwconfig wlan0
wlan0 IEEE 802.11bg ESSID:"calebscreek.local"
Mode:Managed Frequency:2.412 GHz Access Point: 00:1E:E5:XX:XX:XX
<strong>Bit Rate=18 Mb/s</strong> Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=66/70 Signal level=-44 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0 |
With this change, my new speed test results are:
16.01Mbps download and 9.15Mbps upload. Much more goodness.
Now, I am not an expert on the technical details around why this tweak helps, so I leave it to you and your favorite search engine to research if you’re interested. You should also research and decide on how to make this tweak automatic/permanent so that you don’t have to manually set it after each reboot. Something else to note is, while I haven’t tested it, I see no reason why this tweak would not apply on Debian-based distros like Ubuntu or Mint, but your mileage may vary.
And one last tidbit is that 18Mbps is not a magick number that applies to all situations; it just happens to be the value that works best with my particular setup. Your setup might do better with some other bit rate value like 12Mbps or 24Mbps, or even 54Mbps if you’re that lucky. Here’s a snippet from the iwconfig manpage for the rate setting:
rate/bit[rate]
For cards supporting multiple bit rates, set the bit-rate in b/s. The
bit-rate is the speed at which bits are transmitted over the medium, the user speed of the link is lower due to medium sharing and overhead.You must append the suffix k, M or G to the value (decimal multiplier : 10^3, 10^6 and 10^9 b/s), or add enough ’0′. Values below 1000 are card specific, usually an index in the bit-rate list. Use auto to select the automatic bit-rate mode (fallback to lower rate on noisy channels), which is the default for most cards, and fixed to revert back to fixed setting. If you specify a bit-rate value and append auto, the driver will use all bit lower and equal than this value.
Examples :
iwconfig eth0 rate 11M
iwconfig eth0 rate auto
iwconfig eth0 rate 5.5M auto
I tried pretty much every available setting and speed tested each before figuring out that 18M was best for me. I hope this helps. Cheers!




One Response to “HOW-TO: Increase your wireless network card speed in Debian GNU/Linux”