Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Force wifi to specific BBSID. (force 5ghz)

Hello,

I've been trying to find a solution for last two days about a problem I found using Yosemite on my Macbook Air.

I'm sometimes in conferences where there are a lot of people connected to the same router (which is probably the closest determined by every OS) and this router has the same name where ever you go in the building, so anywhere you go you get instant connected to it. Problem is that in conference rooms everyone seems to be connected to the same router which becomes really slow.


There I decided to think: What if I force my mac to connect to another router (others are not that far) maybe I will get a better connection and will not get my VPN disconnected every 5 minutes.


So I did search over the internet and first found the following commands:

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --associate=XXX --bssid=YYY

xxx= SSID/network name yyy= BSSID

The problem is that this command won't work on OS X versions before OS X 10.6, I get an error like (invalid command --associate)... (alright......)


So I found another guy who talked about forcing to connect to a specific canal using this command (let's start some annoying fixing ok..):

sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport --channel=num

num= the canal number (ex: 6, 12, 1)

I did try that last one, without any success.


I'm currently at home, my ISP is Orange and we get a router that supports 2.4 and 5ghz at the same time on different canals but both use the same SSID/network name. When I get close to my router and restart wifi my mac will connect to 5ghz, but when I will go farer and get a -70 RSSI (or more) it will automatically connect to 2.4ghz.

Some people said that they contacted Apple support and this one said that there was no way to connect to connect to the BSSID you want, this is like that.

Can someone confirm?





What came in my mind is: Am I safe?

What annoys me on my macbook is that when I open it, it wakes up and immediately connect to Wifi routers I previously logged on, but ONLY using SSID (network name)!!!

(ex: I can connect to McDonalds public wifi hotspot from one place, if I go to another McDonald it will automatically connect to that one!)

So immediately you think: What if a hacker creates a fake wifi hotspot with name "Company XXX Wifi", my macbook will probably get connected to it (my company has no wifi password) and what if that hacker is rooting this hotspot to the real company one which gets internet/intranet, I will open safari and browse personal informations without even knowing I'm on the fake hotspot! and all my data will go clearly through the hacker)


I can understand it is easier to make it work this way, but what about enterprises?

Is there is a way first, to disable that insecure "auto-connect to known SSID" feature but BSSID instead? (even if it is spoof-able but it makes a layer of protection against hackers kiddies)

Or even to have to choose to connect back or not when you open your computer from sleep?


And of course: How the **** do you select a specific network that has the same name?!

MacBook Air, OS X Yosemite (10.10.1)

Posted on Jan 18, 2015 7:12 AM

Reply
Question marked as Best reply

Posted on Feb 1, 2017 1:51 AM

Hi,


Just tried it and it worked brilliantly with macOS Sierra (10.12.3).


A few tips:

1 - make sure to download the binary file.

2 - grant execution permissions in Terminal (chmod a+x /path/to/airport-bssid)

3 - the interface name to use in the command should be en0, not eth0

4 - if you execute './airport-bssid en0' first, it will scan the network for you, so you can copy-and-paste the BSSID

5 - when executing './airport-bssid en0 BSSID password', make sure to enclose the password in quotation marks.


Hope this helps,

Fabrizio

24 replies

Nov 29, 2016 10:56 AM in response to rccharles

By the way, what did you do to try out the tool? The readme files is a repeat of what is in the git page.


Do I need to compile the command?


What folder is the command in?


I looked at the source, it's only 115 lines long.

/**
* Plan of improvement
*
* <<argument handling>>
* -h, --help: show help
* -i, --interactive: scan and assoc in interactive way
* -s, --scan: scan only
* -k, --use-keychain: let this use keychain on mac. This allows you to omit password input
*
* <<help screen>>
*
* <<interactive assoc>>
*
* <<keychain access>>
*/






R

Nov 29, 2016 11:07 AM in response to rccharles

I didn't compile it; I ran it in a terminal window.


Run terminal, navigate to the directory in which you placed the files, then type ./airport-bssid eth0 <paste in BSSID>


For example:

  1. I downloaded the files to: /Users/<username>/Desktop/personal/airport-bssid-master
  2. The executable is in the Build directory, so: /Users/<username>/Desktop/personal/airport-bssid-master/Build
  3. Then: ./airport-bssid eth0 <paste in BSSID>


I was able to get the BSSID by:

  1. Option+Clicking on the wifi icon in the toolbar
  2. Click on "Open Wireless Diagnostics"
  3. Ignore the window that appears
  4. Go to the Window menu, choose Scan
  5. In that window, find the BSSID that you want and type that into the command line, like: ./airport-bssid eth0 aa:bb:cc:dd:ee:ff


Running the command does something, but it didn't magically associate with the AP associated with the BSSID. Disabling and re-enabling wifi did do something, in that it temporarily attached to the proper AP, but then it crapped out. You might investigate that line of thought (running the command, disable, reenable).

Nov 29, 2016 11:14 AM in response to rccharles

Ok, Here is what I tried. You have any idea what ifname is?

How do I activate the interface name (ifname)? Will not that start my wifi session?

R

mac $ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s
                            SSID BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
               MyComputerNetwork ................. -42  11      N  -- WPA(PSK/TKIP/TKIP) 
mac $ /Users/mac/Downloads/airport-bssid-master/Build/Release/airport-bssid 
usage: /Users/mac/Downloads/airport-bssid-master/Build/Release/airport-bssid <ifname> [<bssid>] [<password>]
mac $ /Users/mac/Downloads/airport-bssid-master/Build/Release/airport-bssid -s
The interface is down. Please activate the interface before connecting to network!
mac $ ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
  options=3<RXCSUM,TXCSUM>
  inet6 ::1 prefixlen 128 
  inet 127.0.0.1 netmask 0xff000000 
  inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
  nd6 options=1<PERFORMNUD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV>
  ether 98:5a:eb:cf:65:eb 
  inet6 fe80::9a5a:ebff:fecf:65eb%en0 prefixlen 64 scopeid 0x4 
  inet 192.168.0.140 netmask 0xffffff00 broadcast 192.168.0.255
  nd6 options=1<PERFORMNUD>
  media: autoselect (100baseTX <full-duplex>)
  status: active
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  ether 78:9f:70:7a:fe:12 
  inet6 fe80::7a9f:70ff:fe7a:fe12%en1 prefixlen 64 scopeid 0x5 
  inet 192.168.0.146 netmask 0xffffff00 broadcast 192.168.0.255
  nd6 options=1<PERFORMNUD>
  media: autoselect
  status: active
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
  options=60<TSO4,TSO6>
  ether 2a:00:00:bf:26:70 
  media: autoselect <full-duplex>
  status: inactive
en3: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
  options=60<TSO4,TSO6>
  ether 2a:00:00:bf:26:71 
  media: autoselect <full-duplex>
  status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
  ether 0a:9f:70:7a:fe:12 
  media: autoselect
  status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1452
  ether 9a:01:47:7c:74:9a 
  inet6 fe80::9801:47ff:fe7c:749a%awdl0 prefixlen 64 scopeid 0x9 
  nd6 options=1<PERFORMNUD>
  media: autoselect
  status: active
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  options=63<RXCSUM,TXCSUM,TSO4,TSO6>
  ether 9a:5a:eb:fc:bd:00 
  Configuration:
  id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
  maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
  root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
  ipfilter disabled flags 0x2
  member: en2 flags=3<LEARNING,DISCOVER>
         ifmaxaddr 0 port 6 priority 0 path cost 0
  member: en3 flags=3<LEARNING,DISCOVER>
         ifmaxaddr 0 port 7 priority 0 path cost 0
  nd6 options=1<PERFORMNUD>
  media: <unknown type>
  status: inactive
mac $ /Users/mac/Downloads/airport-bssid-master/Build/Release/airport-bssid -s awdl0
The interface is down. Please activate the interface before connecting to network!
mac $

Nov 29, 2016 11:23 AM in response to rccharles

I don't think -s is a valid option, or if it is it's being used incorrectly. When I copy and paste your command (airport-bssid -s awdl0) into my computer it gives the exact same error.


You can determine the name of your wifi connection by, again, option+clicking on the wifi icon and looking at the VERY TOP line. On my machine, for example, it says "Interface Name: eth0" (that's a zero).


For you, it's going to be eth0, 1, 2, or 3. In looking at your ifconfig output, I think it's eth1 as eth0 is in full-duplex mode (which makes me think you have an ethernet cable plugged in).


So you'd type: ./airport-bssid eth0 <bbsid>

Nov 29, 2016 12:33 PM in response to talktozee2

Have success, but not sure what it all means. I could set up a second router to see how it might work. Note: I've hidden the router password and MAC addresses partially.


mac $ ifconfig en1
en1: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
  ether 78:9f:..:..:..:12
  nd6 options=1<PERFORMNUD>
  media: autoselect (<unknown type>)
  status: inactive


mac $ sudo ifconfig en1 up
mac $ sudo ifconfig en1 down
mac $ /Users/mac/Downloads/airport-bssid-master/Build/Release/airport-bssid en1 00:19:..:..:..:9a
The interface is down. Please activate the interface before connecting to network!
mac $ sudo ifconfig en1 up
mac $ /Users/mac/Downloads/airport-bssid-master/Build/Release/airport-bssid en1 00:19:5b:..:..:9a
***** Scanned networks *****
* [ssid: MyComputerNetwork      , bssid:  00:19:5b:..:..:9a, channel:  11, rssi: -46 dBm]
****************************
Could not connect to the network: Error Domain=com.apple.wifi.apple80211API.error Code=-3905 "The operation couldn’t be completed. (com.apple.wifi.apple80211API.error error -3905.)"
mac $ /Users/mac/Downloads/airport-bssid-master/Build/Release/airport-bssid en1 00:19:5b:..:..:9a <my-password>
***** Scanned networks *****
- [ssid: DIRECT-05-HP ENVY 5660 series, bssid:  ec:8e:b5:....:06, channel:  6, rssi: -71 dBm]
* [ssid: MyComputerNetwork      , bssid:  00:19:5b:..:..:9a, channel:  11, rssi: -43 dBm]
****************************
Associated to network "MyComputerNetwork" (BSSID: 00:19:5b:..:..:9a)
mac $ ifconfig en1
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
  ether 78:9f:..:..:..:12
  inet6 fe80::...:....:....:fe12%en1 prefixlen 64 scopeid 0x5
  inet 192.168.0.146 netmask 0xffffff00 broadcast 192.168.0.255
  nd6 options=1<PERFORMNUD>
  media: autoselect
  status: active
mac $

Nov 29, 2016 12:31 PM in response to talktozee2

For me in Yosemite.

"Opening Wireless Diagnostics. To open this tool, hold the Option key down on your keyboard, click the Wi-fi icon on the bar at the top of your screen, and select Open Wireless Diagnostics."

http://www.howtogeek.com/211034/troubleshoot-and-analyze-your-mac%E2%80%99s-wi-f i-with-the-wireless-diagnostics-tool/


I could copy the 10.6 version of the command and send it to you. Send me an email. See my profile.

R

Force wifi to specific BBSID. (force 5ghz)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.