Get MAC address of a network access point [duplicate]
Solution 1:
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).
Solution 2:
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}'