15

How can I find out what the MAC address (BSSID) of the wireless access point I'm connected to is?

kiri
  • 28,246
  • 16
  • 81
  • 118
gro
  • 155
  • Though this question has been marked as a duplicate, the accepted answer here is what gave me the info I needed. The highest ranked answer on the linked question gives me more info than I need, which didn't let me figure out which of the two MAC addresses my printer was listing belonged to the SSID my laptop is connected to. If there's ever a cleanup of duplicates, perhaps the answers can be merged? – hlongmore Mar 03 '19 at 09:03

2 Answers2

21

Any of these 3 works:

  • arping 192.168.0.1 Change the IP adress to whatever you use. The MAC address is in the reply between brackets.

  • iwconfig | grep "Access Point". Access point will be colored and behind it the MAC address.

  • iwlist wlan0 scan | grep Address same as previous command (color etc).

Seth
  • 58,122
Rinzwind
  • 299,756
  • iwlist wlan0 scan|grep worked, thank you a lot :) – gro Nov 27 '12 at 13:17
  • The iwlist option gives me a message saying the interface doesn't support scanning; the arping option gives me what is probably a cached version of the wired connection I unplugged. Happily, the iwconfig option gives me the info I needed. – hlongmore Mar 03 '19 at 08:51
17

If you are using a recent desktop version of Ubuntu (with interfaces managed by network-manager) then nmcli is a more configurable option than nm-tool. For example, to list some common information including SSID, access point MAC (BSSID), channel frequency, signal strength etc. for all the access points seen by the active wifi device you can use

nmcli dev wifi list 

You can limit the output to specific fields e.g. to see just the access point MAC addresses (BSSIDs) and connection status, use

nmcli -f BSSID,ACTIVE dev wifi list

To return just the MAC address to which the wifi device is currently connected (i.e. the access point whose ACTIVE field is 'yes'), you can use

nmcli -f BSSID,ACTIVE dev wifi list | awk '$2 ~ /yes/ {print $1}'
steeldriver
  • 136,215
  • 21
  • 243
  • 336