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 need to measure RSSI between two peers of nodes in same network. If I have these two information:

  1. SSID for their network.
  2. IP for the target node to get the RSSI regarding it.

So I found this command: iwspy but it seems that not found in the kernel and I see this link that talk about:

We removed iwspy support a very long time ago because it is useless, but forgot to stop claiming to support it. Apparently, nobody cares, but remove it nonetheless.

share|improve this question
What type of network ? If it is IBSS, Mesh or your interface is in access point mode, then iw dev wlan0 station dump will list them and their RSSI. And yes, iwspy, iwconfig, iwlist iwpriv sucks and are deprecated. – BatchyX Mar 10 '13 at 17:03
actually i used WIFI DIRECT network where the owner node will act as access point and others as client. So what are suitable commands in my case ??? – Hanaa Mar 10 '13 at 17:06

If your interface is in IBSS, Mesh point, or AP/P2P Group Owner mode, then you can dump the stations's MAC and their signal level as perceived by your network card with iw dev wlan0 station dump.

As for fetching the MAC from the IP address, a suggestion would be to use the ARP table with ip neigh. Note that you may have to ping the IP address to populate the ARP table.

So, to fetch the RSSI for a node claiming address A, it could be:

MAC="$(ip neigh show to A dev wlan0 | cut -f 3 -d ' ')"
if [ -n "$MAC" ]; then
    iw dev wlan0 station get "$MAC" | sed -nre "s@\s*signal:\s*@@p"
    # no ARP entry. Ping the address and retry.

If, however, your interface is not on this type (e.g. Non-AP sta), then you will have to fiddle with monitor mode, and you have no reliable way to get a MAC address from an IP address (hint: if the station is routing, then it will use the IP of the sender, not his own).

As said before, iwconfig/iwspy/iwlist/iwpriv are deprecated and sucks. they use a kernel API (wireless extensions) which is deprecated and is only implemented for retrocompatibility purpose, and only if enabled in the kernel configuration. Many part of it are thereby faked or lacks many features, including Wi-Fi direct. If you are using Wi-Fi direct, then you are already using the modern nl80211 kernel API, and you should forget about the wext API and iwconfig/iwspy.

And yes, you need the MAC address of the node. Wi-Fi operates at layer 1 and 2 on the OSI model and does not care about the upper layer. An IP and a MAC address serves different purpose and are not the same thing.

share|improve this answer
do i need Mac instead of IP???? and i didn't get every thing here !!! we can't use iwspy, iwconfig any more ? – Hanaa Mar 10 '13 at 17:37
also i used android here – Hanaa Mar 10 '13 at 17:39
@Hanna: Updated the answer. Using Android will not change the kernel API, so if iw is not available, you will have to compile it or create a program which does the same thing using the nl80211 API. – BatchyX Mar 10 '13 at 18:14
if i have these information as above : the owner IP as following : public String getHostAddress () Returns the numeric representation of this IP address (such as ""). – Hanaa Mar 10 '13 at 18:27
and SSID as follow public String getNetworkName () Get the network name (SSID) of the group. Legacy Wi-Fi clients will discover the p2p group using the network name. – Hanaa Mar 10 '13 at 18:28

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.