4

How can I get the MAC address for the wireless access point in Ubuntu?

7
  • 2
    Not programming...
    – leppie
    Jan 22, 2011 at 18:43
  • @leppie: it could be a programming question, if the asker would say, instead, "in bash, how do I..." Jan 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. Jan 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.
    – leppie
    Jan 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. Jan 22, 2011 at 20:04

4 Answers 4

7

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).

1
  • Wonderful. Both commands show the access point MAC address.
    – so_mv
    Mar 1, 2013 at 8:20
1

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.

1

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) 
0

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.

You must log in to answer this question.