Computer NetworkingComputersLinux

Ubuntu Linux – slow wireless network speed – force adapter speed

In the past I have had very poor networking performance on my wireless network (Wireless LAN / WiFi) which appeared to have been caused by interference from other networks. I’ve since upgraded to a Belkin N Wireless Cable router which has certainly improved performance, but I notice that I’m still get some quite slow WiFi speeds on my home network.

Wireless Network Standards

First here’s a bit about the different standards for Wireless Networks.
Or if you want you can skip direct to the solution of how I doubled my network speed with a simple command.

11Mbps to 54Mbps – IEEE 802.11 a/b

The first standards in common use were defined in 1999 when the IEEE created the 802.11a and the 802.11b standards. These were both for wireless networking with the two working at different frequencies and the 802.11a at 5Ghz with a maximum speed of 54Mbps and 802.11b working at 2.4GHz.

As 802.11a worked at a higher frequency it was harder to manufacturer (and hence more expensive and less reliable) and it was also initially not available in Europe due to regulatory issues. Therefore the 802.11b became popular.

There newer standards (listed below) are backwards compatible with 802.11b.

54Mbps IEEE 802.11 g

The next significant standard was the IEEE 802.11g in 2003, but many products were available prior to ratification, which were usually called g-pre or g draft. 802.11g works at the same frequency as 802.11b but increased the speed to 54Mbps.

This was hugely popular and most wireless equipment these days supports at least 802.11g. Much of the equipment being sold is still designed for 802.11g and are often available cheaper than the 802.11n products.

100Mbps+ IEEE 802.11n

The latest version is IEEE 802.11n which works at either 2.4GHz and 5GHz as a replacement for the previous network standards. It provides speeds of up to 100Mbps and even faster with the draft standards.

 

The speeds provided above are all theoretical maximum speeds. There are many factors that will affect the actual throughput, this includes other wireless users, wireless CCTV cameras, wireless keyboards and mice and even microwave ovens. The speed also changed depending upon the power saving status if using a laptop. Typical speeds may be half of the theoretical maximums or less.

Real Wi-fi network speeds

The majority of network traffic does not need the high speeds quoted. Most of my network access is to the Internet which is limited by my 10Mbps broadband, which in reality runs at nearer 5Mbps download (much slower upload). The high speed can be useful if streaming data over the internal LAN and in my case for transferring backups, but the speed is much better than before.

I have two portable computers that I use at home. I have a Dell Inspiron laptop with 802.11g/n built-in and a Asus EeePC netbook with 802.11n. Both of these are capable of running at 802.11n network speeds, but in reality I have only been able to get these to work at the equivalent of 802.11g speeds.

EeePC

My Eee PC works better with the wireless network at home compared. It worked well with the 802.11g wireless access point and performs the same on the 802.11n router. On Unbutu Linux the wireless driver loaded is the rt800pci and the interface known as wlan0. It appears to show that it is running between 1Mb/s and 54Mb/s, but in tests gave an actual throughput of around 20 to 23Mbps.

Dell Inspiron Laptop

The following is based on Ubuntu Linux.

It is my Dell laptop that had the performance issues that I now solved. The driver loaded is called wl providing interface eth1. Initially it was giving speeds shown as between 1M and 8M, but is now showing as connected at 54Mbps and running at up to 14Mb. This is still much slower than the network is theoretically capable of and less than the speed of the Eee PC, but is adequate for what I need.

Testing the speed of the Wireless network

Before attempting to fix the problem the first step is to check the current performance of the network to quantify the improvements.

Wireless connection information – speed setting

The first place to look for the wireless network speed is in the network manager. Right click on the wireless icon in the top right of the screen and choose “Connection Information”.

Wireless network connection information - NetworkManager applet in Ubuntu Linux

The above screenshot shows the speed as 54Mb/s which is typical of an 802.11g network. A low reading (eg. 1Mb/s, 8Mb/s or 12Mb/s) in this speed field does not necessarily mean that it is running so slow as the speed will vary depending upon actual activity and relevant power saving settings. Instead monitor the applet for a period of time whilst performing something that places a large demand on the network (eg. watching a YouTube video).

If working normally then you should see the speed increase.

Testing speed of the local network (Netpipe-tcp)

The value from network manager gives an approximate guide, but to check the actual throughput involves transferring some data over the network and monitoring that. This is exactly what netpipe-tcp does.

To use NetPipe-tcp needs another Linux computer over the network. Fortunately I have a Linux server as my firewall & router using the Wireless router as a Wireless Access Point (WAP) instead of a router.

To use Netpipe-tcp it first needs to be installed on both computers.
This can be done using:
sudo apt-get install netpipe-tcp

On the server run the command
NPtcp

On client run
NPtcp -h <serverip>

It will take a while to run. It’s the later values that show your true network speed as they put a significant load on the network and will have increased the speed if power saving mode is enabled.

Solution to network speed issue

If the speed is less than you expect and the network manager is showing a speed of less than 54Mbps then you can try forcing it to use 54Mbps using iwconfig.

There is no point though if it is already showing 54Mbps in Network Manager (even if it keeps dropping down when inactive) as that is the normal operation already.

First establish the name of the interface. This can be taken from the Connection Information panel in Network Manager. It’s in brackets on next to the interface information.

Or you can find out by running iwconfig with no options.
This is eth1 on my Dell laptop, but wlan0 is a common interface name which is what it is on my EeePC net book. I’ve used eth1 in the example below.

Change the setting dynamically using the following command:
sudo iwconfig eth1 rate 54M

If you have 802.11n you could also use 100M, but on my system this made it slower. Also 54Mbps is a good value to use as this will work with 54g networks if you travel to another area (I’m not sure what the effect is of trying to force 100M on a 54M network).

After making the changes try using NetPipe again and see if the speed has increased.

Making the network speed changes permanent

When running the iwconfig command it will be forgotten when the system next restarts.

To make the changes permanent a file should be created in the /etc/network/if-up.d directory.

On some systems (eg. Fedora / Redhat) then there is instead a single file per interface:
eg. /etc/sysconfig/network-scripts/ifcfg-eth1

In Ubuntu create a new file in /etc/network/if-up.d
you can give it any name, but try and make it meaningful (eg. wireless-speed)

Contents should be as follows:


#!/bin/sh -e
#
# Sets speed of interface to 54M

if [ "$IFACE" = "eth1" ] ; then
        iwconfig eth1 rate 54M
fi

obviously changing the entries form eth1 as appropriate. The command should be made executable:
sudo chmod 755 wireless-speed

The scripts in the /etc/network/if-up.d directory are all run whenever a network interface is brought up. The script checks to see if it is the interface in question and if so runs the iwconfig command that we ran earlier.

Summary

Actual results may vary, but on my system this provided almost a doubling of network throughput speed.