How do you force a 5 GHz wifi connection?
Wifi networks are often set up in dual-band mode, with the same SSID served on both 2.4 GHz and 5 GHz bands. I'd like to always use the 5 GHz band (due to interference with Bluetooth and other devices that degrades performance). How do I force Mac OS X to use the 5 GHz base station? (I do not have admin access to the network, so I can't just assign the 5 GHz network a different SSID.)
Note that this question is not asking how to force a particular flavor of 802.11, rather it is asking how to force a particular frequency band.
In short: you can not force a frequency band in OS X 10.9 Mavericks. (On 10.5 you can...)
You want to connect to the device using Basic service set identification (BSSID) instead of regular Service set identification (SSID). Connecting to a BBSID will connect you to a specific device regardless of the connection strength. Connecting to SSID will connect you to a specific network name, if similar network names are available it will connect to the best signal/noise ratio. It must be noted that your OS X chooses the wlan, not your router, and OS X switches to the strongest signal available (2.4GHz or 5GHz).
To find a specific SSID and BSSID combination, you can run:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport scan
Before OSX 10.6 you could connect to a specific BSSID using:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --associate=XXX --bssid=YYY
Where XXX is the SSID/network name and YYY the MAC address of the base station you want to talk to.
On OS X 10.6 and beyond it is no longer possible to connect to BSSID directly. There is no known API for this and no third party Software exists that can do this. So you need to change your 5GHz SSID to a unique name or you need to go back to OS X 10.5, or you can change the 2.4GHz channel from within the router. I think these options are non-valid in your case.
UPDATE As maxim points out, you can force a frequency band and use that to fix to 5GHz.
On linux you can use iwconfig
, but this tool is not available for OS X.
This is a partial-temporary solution. Basically, if the frequencies are on different channel numbers then it is possible to "set" the particular wifi band (worked on OSX Mavericks).
High-level overview:
- Find the channel numbers of 5 GHz and 2.4 Ghz. Are they different? if yes proceed to step 2.
- Set 5 GHz channel number using airport command.
Detailed instructions:
-
Open Wireless Diagnostics.app (it is located in /System/Library/CoreServices/Applications).
-
In the application menu select Window->Utilities (or press cmd+2).Utilities window should appear.
-
Select WiFi Scan from Utilities window and press Scan Now button. This will show you all available networks, info about them and your active connection.
-
Now, verify that BSSIDs of 2.4 and 5 Ghz with the same network name are on different channel numbers. If so, then most likely you can change the band by setting the channel number of the desired frequency band. Alternatively for steps 1-4, just type in the terminal
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport -s
-
Turn Wifi off on your computer
-
Open the Terminal.app and type:
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport --channel=**num**
where **num** is the channel number to set. This command will only work under administrator account (so make sure that you are log as an Administrator i.e. su YourAdministratorAccount)
-
Turn Wifi On and connect to the network again
-
You can check your active connection by Alt+Clicking on the WiFi icon on the OSX menu bar, re-scanning with Wireless Diagnostics or using the terminal :-).
That's all!
For 10.11.x, because the options for controlling the Broadcom driver are limited, you will want to first disable roaming,
sudo defaults write /Library/Preferences/com.apple.airport.opproam disabled -bool true
Then make a mesh out of maybe 1/2" chicken wire and stick it over your laptop to penalize the 2.4 GHz signal. Once you are able to connect to the 5 GHz AP,
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I
you can remove the mesh and hopefully OSX will not switch BSSID.
http://www.compliance-club.com/archive/keitharmstrong/990810n.gif