You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

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

Wrong country code set on my Mac's Airport WiFi interface is blocking me from using channels 12 and 13

Hey guys,


After searching the forums, it turns out that the MacBook's Airport WiFi interface (under OSX Lion) upon turning on is picking up the first WiFi signal in the area and setting the interface's country code to the one of that router's signal.


I live at the moment in the Netherlands and it's quite a busy country in the cities especially when it comes to WiFi networking. In my house the best channel is 13... not any other. So it's quite frustrating for me that my Mac cannot use it properly when my router (bought in here) is standing 1 meter away from my Mac.


It turns out that some nasty neighbor of mine has a Canadian router which sets my Mac's Airport to country code CA. This renders channels 12 and 13 useless for me. Since I can't vaporize my neighbor's router, I'm left wondering why is it that all other WiFi gadgets in my house work properly under channel 13 ? (I mean they all have wireless cards in there.. you could say the Mac is following the specification correctly and setting the country code to the first network is picks up but this is assuming a lot of things). Anyway it's pretty frustrating...


There was a script I found that would reset the WiFi card continuously until it picks up the right setting. I made a slight modification so that it really expects to see channel 12 (which then means 13 is also available) in the list of supported channels (whereas the original expected to see the wifi types g/n/ etc). Must be run with sudo and it "works around" the issue for me right now but I find it very stupid having to turn the WiFi on and off until it works... and not sure if it's very good for the hardware to turn it on and off intermitently..


Anyone found a better solution by now ?


Anyway here's the script... save it to a file and run it in the terminal with "sudo ./youscript.sh"



#!/bin/bash


# This script will turn the AirPort on and off

# until the country code is different from "SY"

#

# author: Martin Bartos (f1lth@msn.com)

# modified: Szilveszter Molnar (mail@moszi.net)



if [[ $EUID -ne 0 ]]; then

echo " This script must be run as root" 1>&2

exit 1

fi



cont=1



while [[ $cont -ge 1 ]]; do

echo

log=`system_profiler SPAirPortDataType |grep "Supported Channels:" | cut -d "," -f 12`



if [[ $log != " 12" ]]; then

echo $log

echo -n " Restarting AirPort [$cont] ... "

sudo networksetup -setairportpower en1 off

sleep 6

sudo networksetup -setairportpower en1 on

sleep 2

let "cont+=1"

echo " DONE"

else

echo $log

echo " Happy Networking "

echo

cont=0

fi

done

exit 0

MacBook Pro, Mac OS X (10.7.2)

Posted on Jan 15, 2012 11:37 AM

Reply
5 replies

Jan 28, 2012 8:03 AM in response to mindwalker

Hi,


thank you I can confirm this worked for me and I can use channel 13 on my wifi now (less interferance from neighbours). Please note people in the US should not do this as channel 12 and 13 are not allowed to be used in the US!


For those with a little less knowledge on scripting and want to get channel 12 and 13 working.


First of all check which channels you have by running this in terminal:

system_profiler SPAirPortDataType


you should see channel 12 and 13 missing. It will also tell you which interface number your wireless is, en0 or en1 depending what mac you have and number of interfaces.


If required edit the above script wifi restart section depending on your interface number:

sudo networksetup -setairportpower en1 on

the off section needs to be changed too obviously.

Depending what your wireless router is configured to change the channel number too from 12 to 13 in these sections:

log=`system_profiler SPAirPortDataType |grep "Supported Channels:" | cut -d "," -f 12`


if [[ $log != " 12" ]]; then


There must be a way to configure this manually by the way, anyone?

Jul 16, 2013 5:00 AM in response to mindwalker

I had the luxury of messing around with this in an isolated location with no other routers, and this is what I found (10.6.8):


When you turn on AirPort, the first packet it picks up from a 802.11d enabled router on channels 1-11 is what the country code gets set to. Note that is only looks on channels 1-11 for country codes, so if the only router in the area is on channel 12 or 13 you won't see it. So it is making the (sometimes false) assumption that if you are in a country that allows ch. 12 and 13 there will be other routers with your country code in the ch. 1-11 range. Now once it picks up the country code, you can actually change the channel number to say 13 and it will follow along and stay connected. But as soon as you turn AirPort off or resume from sleep it won't work again.


So to make this work reliably you might need to set up a "dummy router" that broadcasts on channels 1-11 with your country code if you want to use your main router on one of the country-specific channels. If you have an old 802.11b router you can use that (doesn't have to be connected to anything, but does need to have 802.11d support). If it still won't work, try associating to the dummy router to set the correct country code, then hopefully the network you want will show up (country code seems to always match that of the associated network).


By setting the country code to Japan on the router I was able to get channel 14 to work after changing the channel from 11 (802.11b operation only).


I tried changing the time zone setting, but that had absolutely no effect on anything (e.g. ch. 14 still works with non-Japan time zone).

Sep 19, 2015 4:29 PM in response to julian206

Hi Julian206 I run as your recommendation and find:

Software Versions:

CoreWLAN: 5.0 (500.35.2)

CoreWLANKit: 4.3 (430.38.1)

Menu Extra: 10.3 (1030.34)

System Information: 9.0 (900.9)

IO80211 Family: 7.3 (730.60)

Diagnostics: 4.2 (420.71)

AirPort Utility: 6.3.5 (635.2)

Interfaces:

en0:

Card Type: AirPort Extreme (0x14E4, 0xE9)

Firmware Version: Broadcom BCM43xx 1.0 (7.15.166.24.3)

MAC Address: .......

Locale: Japan

Country Code: JP

Supported PHY Modes: 802.11 a/b/g/n

Supported Channels: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140

Wake On Wireless: Supported

AirDrop: Supported

Status: Connected

Current Network Information:

Rede Wi-Fi de Samuel:

PHY Mode: 802.11n

BSSID: .........

Channel: 11

Country Code: JP

Network Type: Infrastructure

Security: WPA2 Personal

Signal / Noise: -73 dBm / -84 dBm

Transmit Rate: 52

MCS Index: 5

Is there a way to change it and stay with the same code as my airport express ? that is AT (Austria),

by the way my router country code is Q2, I have no idea what it means! is there salvation for me?

I have started all off this because I can not exchange files between macbook and time capsule, but this is another pain!!!

Thank you very much

Samuel

Wrong country code set on my Mac's Airport WiFi interface is blocking me from using channels 12 and 13

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