Can you explain how to understand what the 'iwconfig' command displays in Ubuntu-9.04?

Solution 1:

wlan0 IEEE 802.11bgn ESSID:""

Means your card supports 802.11 b/g/n standards and you are currently not connected to any network (ESSID, the name identifying network is empty)

Mode:Managed

Operating mode for the device. Depending on your card, you may select one of these:

  • Ad-Hoc (network composed of only one cell and without Access Point)
  • Managed (node connects to a network composed of many Access Points, with roaming)
  • Master (the node is the synchronisation master or acts as an Access Point)
  • Repeater (the node forwards packets between other wireless nodes)
  • Secondary (the node acts as a backup master/repeater)
  • Monitor (the node is not associated with any cell and passively monitor all packets on the frequency)
  • Auto.

Frequency:2.412 GHz

Or channel - same as you see in GUI tools to manage wireless cards - you may input either frequency or channel number

Access Point: Not-Associated

Gives you exact MAC address of AP you're connecting to. If you have multiple AP's in your network and you'd like to figure out to which AP you're connected.

Tx-Power=20 dBm

This is your card's transmit power - basically the higher, the more energy your card will require.

Retry min limit:7

This option describes retry behaviour of your card.

RTS thr:off

This describes whether your card checks for clear channel every time it sends a packet. This may improve performance in some cases.

Fragment thr=2352 B

This describes maximum packet size your card will send - basically if you have a noisy environment, the smaller the packets, the less probable is that your packet would have to be retransmitted, and if it would happen, the less data would have to be transmitted. According to manual, if this value is higher than maximum packet size, the card may send several packets together.

Power Management:off

This option gives information about power management your card use. You may choose to discard some packages (ie. bcast and mcast), set your card's activity cycles and some other options.

Link Quality:0 Signal level:0 Noise level:0

If your card is connected, this is where you'd be looking for link quality:) Signal level and noise level may be given dBm or any arbitrary unit.

Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0

Some statistics about errors during receiving: nwid means that probably there's another network in your neighbourhood using the same channel as yours, invalid crypto is a number of packet you card was unable to decrypt, invalid fragmentation means there were some packets missing.

Tx excessive retries:0

This is the number of packets your card was unable to deliver.

All above is based on iwconfig manual, you may find hml version here.

If you're going to configure your card using command line tools, be sure to turn networkmanager off and use Sathya's answer. If you have your key as a text, use

sudo iwconfig wlan0 key s:your_key

instead of

sudo iwconfig wlan0 key ABCD-1234-5678-EFG2

Solution 2:

I'm surprised no one has bothered to mention this in the answers above but it sounds like you're really trying to get the wifi connection to work under linux -- not so much to understand each iwconfig parameters in all its gory details.

With this in mind it's crucially important to point out that iwconfig does not support WPA/WPA2 negotiation & authentication when connecting to a wlan network. That is to say the only wifi networks you can connect to with iwconfig are open unencrypted networks and WEP enabled networks.

Now the reason you're getting this strange error:

Error for wireless request "Set Encode" (8B2A) :
    SET failed on device wlan0 ; Invalid argument.

is because iwconfig is expecting a WEP-key for the key: parameter. Because of the way WEP works, this key has to meet one of these conditions:

  • ascii string that's exactly 5 characters in length
  • ascii string that's exactly 13 characters in length
  • hexidecimal string that's exactly 10 characters in length
  • hexidecimal string that's exactly 26 characters in length

Of course your key is 6 characters so this won't work and thus the error. Note that my_key technically, isn't a valid PSK either -- WPA/2 requires a minimum of 8 characters.

All this begs the question: so how do you connect to a WPA-TKIP/WPA2-AES enabled wlan? The answer is you have to use yet another program like wpa_supplicant. If you're not too crazy about the commandline method using a gui network manager like wicd manager will make this process much more seamless.

Any secure wifi network won't be using WEP since it's broken so it's important to realize iwconfig by itself can't connect to the more secure WPA/WPA2.

Solution 3:

Just edit /etc/network/interfaces and write:

auto wlan0
iface wlan0 inet dhcp 
                wpa-ssid <ssid>
                wpa-psk  <password>

After that write and close file and use command:

dhclient wlan0