Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to detect if a certain AP address is alive, i.e. by "PING" its SSID or MAC address (both known).

What program can I use to achieve that? I'm making a simple script that run as root.

(I hope I wouldn't be doing this by something like iwlist scan | grep XX)

share|improve this question

what iw(list) scan does is sending ProbeRequest messages on all channels (one by one) without specifying target SSID, all AP in range on the channel answer with ProbeResponse

what you want is to send ProbeRequest for specific SSID, you can do that by iw wlanx scan ssid xxx or iw wlanx scan freq xxxx ssid xxxx

if you don't want to parse iw output you might write a simple program using nl80211 interface to do scanning (command NL80211_CMD_TRIGGER_SCAN) and have access to raw scan results or use a nice library like this to do the work for you

share|improve this answer

Generally, you cannot ping an AP as it is a layer 2 device, this means it operates at the datalink layer. This layer will not respond to ICMP echos. In the layer the only way to know if the AP is working is to see if you can ping your next hop (generally your gateway). To check the AP specifically you want have to find out in a layer two manner if there is a traffic coming to you.

Note: If you can associate with the AP it generally means the AP is OK.

However, to check if your AP is working correctly. First find out your AP's SSID (MAC address) via iwlist. After doing so run a tcpdump and check to make sure you are getting packets from the SSID to your computer's MAC address.


tcpdump -i wlan0 -e -nn 'ether src XX:XX:XX:XX:XX:XX && ether dst FF:FF:FF:FF:FF:FF'

By seeing this traffic you will see that you are recieving traffic from the AP and you are associated properly.

tcpdump -i wlan0 -e -nn 'ether src XX:XX:XX:XX:XX:XX && ether dst YY:YY:YY:YY:YY:YY'

Replace the XXs with the MAC address of the AP (the SSID) and the YYs with the MAC address of your wireless interface. If you see traffic here, you know that the AP is specifically sending traffic to your wireless interface, which shows more conclusively what you are connected.

This answer assumes you are trying to make sure that the error you are having is with a connection to an AP.

If you want something different - i.e. a NetworkManager-like application which will connect to any available SSID, add that to your question.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.