Wednesday, November 5, 2014

Get on up to the 5GHz side! - Change OSX WiFi over to an available 5GHz Channel or any other Channel

Traveling on the road a lot, it's typical to get a Hotel and see, well not the greatest of WiFi designs.  On this latest trip I got to my hotel room, popped open Metageek inSSIDer only to discover the unfortunate channel plan below.



My laptop, running OS X Mavericks, connected to Channel 9 with the stats listed below.



In seeing Channel 36 off all by its lonesome at a great signal strength, and without a bunch of other Access Points stomping all over it, there had to be a way to switch on over.

That's where the airport command comes in to play.  The airport command is located in the /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources directory in OSX Mavericks.

To get the available options for the airport command, navigate to the directory listed above and type './airport -h'.  Below are the available options:



To scan for the available networks, type './airport -s', from within the directory path listed above to see SSID, BSSID, RSSI, Channel, HT, Country Code and Security.  From the results listed below, you can see Channel 9 at -46 and Channel 36+1 at -56.  The better signal strength on Channel 9 (10 dB higher than Channel 36) is why the laptop joined Channel 9 versus Channel 36.



To switch on over to Channel 36, the following was performed using sudo in Terminal:
  1. Use the airport command to disassociate from the current Access Point
    • $ sudo ./airport -z
    • You will be disconnected from the WiFi Network as indicated by the WiFi Icon
  2. Use the airport command to set the desired channel, in my case 36:
    • $ sudo ./airport --channel=36
  3. Click on your WiFi Icon and select the desired SSID
NOTE: To enable the root user in OS X Mavericks, refer to the instructions in this Apple Support article.

You can confirm the WiFi channel, by pressing the OPTION/Alt key and clicking on the WiFi Icon.




Additionally, you could type './airport --getinfo' within the Terminal to list the current connection information.

Based on the connection information, you can see the results of changing to a lesser congested channel.

Other observations related to this change were the following:
  • Performing this action does not lock your WiFi card into the configured channel.  If the configured channel is not available, the normal scanning process will occur and your laptop will Associate to the WiFi network on another Channel.
  • When returning the location and the same Channel was still available, the laptop automatically connected back to the desired Channel.
  • If you do not connect back to the desired Channel, perform a scan to ensure the channel you think you are connecting to is still available.  For example, above Channel 36 was selected, however, in returning to the same location, Channel 36 was no longer available and changed to Channel 40.  The result was my WiFi connecting to a 2.4GHz Channel again due to the higher signal strength.  The commands listed above were re-run to connect to Channel 40.
To avoid having to type out that long directory name listed above, check out this article on creating aliases and adding them to your .profile file.

For additional information in adjusting network settings from the Terminal command line, check out this CNET article.





3 comments:

  1. Nice, but --channel didn't work on Yosemite. Change it with -c.

    ReplyDelete
  2. Vivien -- Thanks for the comment and updated flag for Yosemite!

    ReplyDelete