Command Line Wireless Tools on Linux

Command Line Wireless Tools on Linux

When you need check your wireless interface, you are able to use wireless tools. To know which tools you have installed on your operating system, just run the command

linux-7tpy:/home/poganin # compgen -abc -A function | grep iw
iwlist
iwgetid
iw
iwconfig
iwevent
iwpriv
iwspy
fliwheel
linux-7tpy:/home/poganin #
fliwheel has nothing to do with Wi-FI, so forget it.

Let’s start with iwconfig that displays current settings for wireless cards on your system. It’s a similar tool to ifconfig but used for Wi-Fi interfaces. It uses the statistics from /proc/net/wireless. In the beginning, it’s good to know the version:

linux-7tpy:/home/poganin # iwconfig –version
iwconfig  Wireless-Tools version 30
          Compatible with Wireless Extension v11 to v22.

Kernel    Currently compiled with Wireless Extension v22.

wlan0     Recommend Wireless Extension v21 or later,
          Currently compiled with Wireless Extension v22.

linux-7tpy:/home/poganin #

Wireless Extension (WE) are special extension for Linux kernels. Now, it’s not being under development because this idea is outdated but still used. In the man page for iwconfig, we can read.

“All  these parameters and statistics are device dependent. Each driver
will provide only some of them depending on hardware support, and  the
range  of  values  may  change.  Please  refer to the man page of each
device for details.”

So be aware that the output on your console may be different or even you will see nothing.

iwconfig

This shows and  configures our wireless network interfaces.

Let’s start:

linux-7tpy:/home/poganin # iwconfig
wlan0     IEEE 802.11bg  ESSID:”XXXXXXXXX” 
          Mode:Managed  Frequency:2.412 GHz  Access Point: XXXXXXXXXXXXX  
          Bit Rate=48 Mb/s   Tx-Power=20 dBm  
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:on
          Power Management:on
          Link Quality=61/70  Signal level=-49 dBm 
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:1   Missed beacon:0

lo        no wireless extensions.

eth0      no wireless extensions.

linux-7tpy:/home/poganin #

So the output shows us that we have one wireless interface, and there are two interfaces that aren’t wireless. We are interested in wlan0.

Also, we can run:

linux-7tpy:/home/poganin # iwconfig wlan0
wlan0     IEEE 802.11bg  ESSID:”XXXXXXXXX” 
          Mode:Managed  Frequency:2.412 GHz  Access Point: XXXXXXXXXXXXX  
          Bit Rate=48 Mb/s   Tx-Power=20 dBm  
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:on
          Power Management:on
          Link Quality=61/70  Signal level=-49 dBm 
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:1   Missed beacon:0

linux-7tpy:/home/poganin #

However, we have got no more information. To get more, just use other commands. With using iwconfig, we can not only show the information, but also manipulate them.Refer to the man page to get more info. The synopsis is:

iwconfig interface parameter value

For example:

iwconfig wlan0 mode Managed

With this command, we will set our wlan0 interface to manged mode. In other words, our computer connects to a network composed of many Access Points with roaming.

iwlist

This showing lists of parameters your wireless card supports.

linux-7tpy:/home/poganin # iwlist
Usage: iwlist [interface] scanning [essid NNN] [last]
              [interface] frequency
              [interface] channel
              [interface] bitrate
              [interface] rate
              [interface] encryption
              [interface] keys
              [interface] power
              [interface] txpower
              [interface] retry
              [interface] ap
              [interface] accesspoints
              [interface] peers
              [interface] event
              [interface] auth
              [interface] wpakeys
              [interface] genie
              [interface] modulation
linux-7tpy:/home/poganin #

So let’s use the scanning parameter:

linux-7tpy:/home/poganin # iwlist wlan0 scanning
wlan0     Scan completed :
          Cell 01 – Address: XXXXXXXXXXXXXXXXX
                    Channel:1
                    Frequency:2.412 GHz (Channel 1)
                    Quality=58/70  Signal level=-52 dBm  
                    Encryption key:on
                    ESSID:”XXXXXXXX”
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=XXXXXXXXXXXXXXXX
                    Extra: Last beacon: 5056ms ago
                    IE: Unknown: XXXXXXXXXXXXXXXXXXXX
                    IE: Unknown: XXXXXXXXXXXXXXXXXXXX
                    IE: Unknown: XXXXXXXX
                    IE: Unknown: XXXXXXXX
                    IE: Unknown: XXXXXXXXXXXXXXXXXXXXXX
                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (1) : TKIP
                        Authentication Suites (1) : PSK
                    IE: Unknown: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

linux-7tpy:/home/poganin #
A lot of useful information.

iwspy

This shows us the quality-of-link information from specific nodes.

linux-7tpy:/home/poganin # iwspy
wlan0     Interface doesn’t support wireless statistic collection

lo        Interface doesn’t support wireless statistic collection

eth0      Interface doesn’t support wireless statistic collection

linux-7tpy:/home/poganin #

Alas, we can’t get the information form our wireless interface. No support! but your interface can support that, so try it out.

iwpriv

This configures optionals (private) parameters of our wireless interface
linux-7tpy:/home/poganin # iwpriv
wlan0     no private ioctls.

lo        no private ioctls.

eth0      no private ioctls.

linux-7tpy:/home/poganin #
Alas, we have no input/output control for our wireless interface because it’s an outdated tool and my openSuse is a modern operating system.

iwgetid

This shows ESSID, NWID or AP/Cell Address of our wireless network

linux-7tpy:/home/poganin # iwgetid
wlan0     ESSID:”XXXXXXXX”
linux-7tpy:/home/poganin #

iwevent

Display Wireless Events generated by drivers and setting changes.

linux-7tpy:/home/poganin # iwevent
Waiting for Wireless Events from interfaces…
14:47:02.119793   wlan0    Scan request completed
14:49:02.123418   wlan0    Scan request completed
^C
linux-7tpy:/home/poganin #
We can see all events. In this case, we got two evens Scan request completed. They are the results of the scan because of running iwlist (iwlist wlan0 scanning).
We can interrupt the command by using Ctrl+C.

At the end, we can also check the /proc/net/wireless file.

linux-7tpy:/home/poganin # cat /proc/net/wireless

Inter- |    sta-  | Quality             |  Discarded packets             | Missed | WE

face   |   tus    | link level noise | nwid crypt frag retry misc | beacon | 22

wlan0:   0000      65. -45. -256         0        0       0      0      2           0

linux-7tpy:/home/poganin #

Many details.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s