Finding the BSSID of the Access Point your Macintosh is connected to


I have three APs in my house (upstairs, downstairs and in my lady’s chamber;)) and in following the principles of good networking design, I have given them all the same SSID. Trouble is, when I move from upstairs to downstairs of the other way around, I sometimes suspect that my Mac (or my phone, or my ipad or..) doesn’t change allegiance to the AP that it was previously connected to, at least not for a long time. I wanted to find out which access point I had connected to.

I needed a utility (preferably a BSD command) that would let me see which AP I had associated with. After some digging around I found this webpage that told me that there is indeed a command (very well hidden) right there in the OS. For some reason, it is not in the path, but as the article explains, it’s pretty easy to create a link to the command.

So the command is simply airport, and it can do some fancy stuff, reporting signal levels and even packet captures. Here’s a couple of samples:

chriswelsh@macropidia:bin$ airport -s
      SSID BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
   RedNectar 00:1c:df:cb:8d:55 -38  2,+1    Y  -- WPA2(PSK/AES/AES) 
   RedNectar 14:d6:4d:0f:fd:e5 -62  1       Y  DE WPA2(PSK/AES/AES) 
 myneighbour 00:1c:df:9b:ba:57 -80  6,-1    Y  US WEP
   RedNectar 00:0f:b5:93:57:31 -36  6       N  -- WPA2(PSK/AES/AES)

So you can see that I’ve made a boo-boo somewhere, with one AP on channel 1 and another on channel 2! (I’ll change the 2 to 11 later). But back to the task in hand, I can see that the strongest signal is from BSSID 00:0f:b5:93:57:31, so I should be associated with that AP. Let’s see:

chriswelsh@macropidia:bin$ airport -I
     agrCtlRSSI: -40
     agrExtRSSI: 0
    agrCtlNoise: -90
    agrExtNoise: 0
          state: running
        op mode: station 
     lastTxRate: 54
        maxRate: 54
lastAssocStatus: 0
    802.11 auth: open
      link auth: wpa2-psk
          BSSID: 0:f:b5:93:57:31
           SSID: RedNectar
            MCS: -1
        channel: 6

So that seems just right for now. No doubt I’ll have fun running upstairs and downstairs and saying my prayers from now on!

Now all I have to do is find equivalent applications for a PC, iPad, iPhone and android phone! (All suggestions welcome)

Oh! In case I forget or the reference above disappears:
The airport command lives in /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
You can create a link in /usr/sbin using the command:

sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport
About these ads

About RedNectar Chris Welsh

Professional IT Instructor. All things TCP/IP, Cisco or VoIP
This entry was posted in BSSID, Mac OS X, Macintosh, SSID, wifi, wireless network and tagged , , , , , . Bookmark the permalink.