id="info"

Networking

Using iwconfig to configure settings on wireless cards

Scott Reeves shows you a command that allows you to set and change parameters of a wireless card, including changing the bitrate.

This post is about the iwconfig command. The command iwconfig is perhaps a little known command, especially when compared to the venerable ifconfig command. But it does a few things that are pretty useful.

So what is iwconfig? It is a CLI command that allows you to set and change parameters of a wireless card. You can also use it to list the current wireless parameters set on a card. Running the string iwconfig eth2 produces the below output.

root@gudaring:~# iwconfig eth2
eth2      IEEE 802.11bg  ESSID:"nogudar"
          Mode:Managed  Frequency:2.422 GHz  Access Point: 00:19:DB:0C:EC:9D
          Bit Rate=54 Mb/s   Tx-Power:24 dBm
          Retry min limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=5/5  Signal level=-41 dBm  Noise level=-57 dBm
          Rx invalid nwid:0  Rx invalid crypt:9694  Rx invalid frag:0
          Tx excessive retries:28  Invalid misc:0   Missed beacon:0
root@gudaring:~#

From the above output, a few points can be noted. Firstly, the transmit power (denoted by TX-power) is 24dBm. Secondly, the bit rate is 54MB/s. Of interest also are the Signal Level and the Noise level. As this post is more about configuring the card, we'll leave the discussion about signal level and noise level to a future post.

The transmit power can be changed using iwconfig. This is not necessarily recommended if you have a heavily utilised network. The main reason you may want to lower the transmit power is if you want to conserve battery life, and if the network is not heavily utilised. Changing the transmit power can be done by using the command string iwconfig eth2 txpower 20. This will reduce the transmit power to 20dBm. The command string and the output are as shown below.

root@gudaring:~# iwconfig eth2 txpower 20
root@gudaring:~# iwconfig eth2
eth2      IEEE 802.11bg  ESSID:"nogudar"
          Mode:Managed  Frequency:2.422 GHz  Access Point: 00:19:DB:0C:EC:9D
          Bit Rate=54 Mb/s   Tx-Power:20 dBm
          Retry min limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=5/5  Signal level=-40 dBm  Noise level=-57 dBm
          Rx invalid nwid:0  Rx invalid crypt:9849  Rx invalid frag:0
          Tx excessive retries:28  Invalid misc:0   Missed beacon:0
root@gudaring:~#

You can also set the bit rates using iwconfig. Run iwlist eth2 bitrate first to check what bit rates are supported and what the current bitrate is.

root@gudaring:~# iwlist eth2 bitrate
eth2      12 available bit-rates :
        1 Mb/s
        2 Mb/s
        5.5 Mb/s
        6 Mb/s
        9 Mb/s
        11 Mb/s
        12 Mb/s
        18 Mb/s
        24 Mb/s
        36 Mb/s
        48 Mb/s
        54 Mb/s
          Current Bit Rate=54 Mb/s
root@gudaring:~#

One reason for selecting a lower bit rate is that you have a low signal level compared to the noise level. A higher bit rate (say 54MB/s) means that the data bits are packed more closely together, and can therefore be more prone to corruption of the signal. Lower bit rates (say less than 10MB/s) are less densely packed, and therefore less prone to corruption. The issue is that a corrupted frame leads to retransmission requests or to frames being dropped, which has an impact on the actual throughput. I prefer to set the network card to the highest bit rate, but append auto, which means that the rate will be dropped according to the signal strength. There are some circumstances where you may want to fix a bit rate lower than the maximum rate of the card. This is usually when you are located some distance from the access point.

The command string to use then to change the bitrate is iwconfig eth2 bitrate 24M. This will change the maximum bitrate to 24Mb/s. Below is the command string, together with the output following the running of the command.

root@gudaring:~# iwconfig eth2 rate 24M
root@gudaring:~# iwconfig eth2
eth2      IEEE 802.11bg  ESSID:"nogudar"
          Mode:Managed  Frequency:2.422 GHz  Access Point: 00:19:DB:0C:EC:9D
          Bit Rate=24 Mb/s   Tx-Power:20 dBm
          Retry min limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=5/5  Signal level=-42 dBm  Noise level=-57 dBm
          Rx invalid nwid:0  Rx invalid crypt:9849  Rx invalid frag:0
          Tx excessive retries:28  Invalid misc:0   Missed beacon:0
root@gudaring:~#

The output of iwconfig also shows the ESSID. A digression here; if you are cloaking your ESSID, then it may be better if you don't. A wireless network detection tool such as kismon (covered in an earlier post) will eventually detect a cloaked ESSID. Hiding an ESSID does not make a wireless network more secure.

If you like the command line, then iwconfig is a good command to know. It has many more options than are covered here.

About

Scott Reeves has worked for Hewlett Packard on HP-UX servers and SANs, and has worked in similar areas in the past at IBM. Currently he works as an independent IT consultant, specializing in Wi-Fi networks and SANs.

Editor's Picks