How can I get the MAC address for the wireless access point in Ubuntu?
-
2Not programming...– leppieJan 22, 2011 at 18:43
-
@leppie: it could be a programming question, if the asker would say, instead, "in bash, how do I..."– David WeiserJan 22, 2011 at 18:56
-
@MAMProgr: Do you want to know how to do this in bash, or using the GUI? If you want to use the GUI to do this, this question should be asked on su.– David WeiserJan 22, 2011 at 18:57
-
@David: The fact that it is tagged with ubuntu and not some programming platform or language pretty much excludes that hypothesis.– leppieJan 22, 2011 at 19:57
-
@leppie: doesn't the bash shell come with ubuntu? Until the asker gives more information, I don't think there's much of a onclusion that could be drawn.– David WeiserJan 22, 2011 at 20:04
4 Answers
Either connect to the point, and do
iwconfig | grep "Access Point"
or find your access point in the output of
iwlist wlan0 scan
(if you have wireless interface called not wlan0
, substitute appropriately).
Use the arping
utility with your AP's IP as an argument:
$ arping 192.168.0.1 ARPING 192.168.0.1 from 192.168.0.200 eth0 Unicast reply from 192.168.0.1 [00:48:6C:38:B7:4D] 0.660ms Unicast reply from 192.168.0.1 [00:48:6C:38:B7:4D] 0.590ms Unicast reply from 192.168.0.1 [00:48:6C:38:B7:4D] 0.610ms Unicast reply from 192.168.0.1 [00:48:6C:38:B7:4D] 0.410ms Sent 4 probes (1 broadcast(s)) Received 4 response(s)
You can see the MAC address in the reply.
linux command
iwlist wlan0 scan
is a very good one, however if you'll have lot's of WIFI AP around (like in the multi-floor buildings) - you'll get the following error message in result:
wlan0 Failed to read scan data : Argument list too long
in this case the only way to get MAC of your AP would be:
sudo iw wlan0 scan | egrep "^BSS|SSID:" |grep -n1 <your AP name>
as an output you'll get following:
104-BSS 44:ce:7d:7b:e7:9e(on wlan0)
105: SSID: <your AP name>
where 1st line would be the MAC and 2nd line would be your AP name
on MacOSX similar information could be possible to obtain by executing:
/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -s |grep <your AP name>
as an output you'll get following:
<your AP name> 44:ce:7d:7b:e7:9e -58 1 Y -- WPA2(PSK/AES/AES)
You may try dmesg when connecting/connected to wireless access point:
$ dmesg | grep "probe to"
On my box (Fedora 14), I get line like this:
[ 5257.283188] wlan0: direct probe to 00:23:eb:3a:99:e0 (try 1)
Not sure whether under different kernel or other configuration on other distro like ubuntu has the same info printed out. Please try.