Determining Wireless Network Channel Usage

2014-02-09

To determine which wireless channels are used near your Wi-Fi network, execute the following command on a Linux machine in your network (tested under Ubuntu 12.04):

sudo iwlist wlan0 scan | sed -n 's/^.*(Channel \([0-9]*\)).*/\1/p' | sort | uniq -c | sort -n | awk '{ print "Count\t",$1,"\tChannel\t",$2; }'

The command outputs the found Wi-Fi channels along with their count, i.e., the number of access points which use the corresponding channel. The output is sorted by the channel count. Ideally, you should configure your access point to use a channel which does not appear in the list to avoid interference.

The interface name of the Wi-Fi card above is wlan0. Replace it with the name of your interface which you can find out with ifconfig or similar tools. The command iwlist wlan0 scan must be executed as root to actually carry out a scan. If the command is executed by a normal user, a left-over result will be returned (see IWLIST(8)). Moreover, the scan does not find hidden networks and the scope of the scan depends on the network card and its settings. Executing several scans in quick succession may yield different results.

If you want to know how the commands above relate to relational algebra, check out this blog post.