OpenWrt Forum Archive

Topic: Setting Country Code

The content of this topic has been archived on 26 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello,

I live in USA and bought a bunch of Arduino YUN and put some custom OpenWRT software on it.

People from many different countries are interested in this software so I want to send the ARDUINO YUN to them with the software, however since  those people are not in USA, I have to change the country code before I send it to them.

I read up on country code, but it seems a bit complicated to change, and I'm not sure exactly how to do it perfectly.

1. The country code seems to be either 2 letters or a number, how do I know which?

2. Where are the country codes (letters and numbers) listed for all the countries?

3. Do I have to change anything else besides country code, what about channels etc?

4. My OpenWRT is operating as a WiFi access point, does that affect the country code setting for the different countries or channels or whatever?

5. Since I'm in USA and not in those other countries, after I change the country code, how do I test to see if it works or i did it correctly from USA since I dont have any WiFi equipment from every country to connect to the access point to see if it can connect?

6. Is there a generic country code or channels setting, that will make it work for all countries?

Thanks
iosdev1024

(Last edited by iosdev1024 on 3 Feb 2016, 17:04)

iosdev1024 wrote:

Hello,

I live in USA and bought a bunch of Arduino YUN and put some custom OpenWRT software on it.

People from many different countries are interested in this software so I want to send the ARDUINO YUN to them with the software, however since  those people are not in USA, I have to change the country code before I send it to them.

I read up on country code, but it seems a bit complicated to change, and I'm not sure exactly how to do it perfectly.

1. The country code seems to be either 2 letters or a number, how do I know which?

2. Where are the country codes (letters and numbers) listed for all the countries?

3. Do I have to change anything else besides country code, what about channels etc?

4. My OpenWRT is operating as a WiFi access point, does that affect the country code setting for the different countries or channels or whatever?

6. Is there a generic country code or channels setting, that will make it work for all countries?

Thanks
iosdev1024

Country code is used by radio to get a proper info about channels and tx power levels allowed by law.
current regulatory domain database is here - http://git.kernel.org/cgit/linux/kernel … ree/db.txt
for openwrt you need only to setup country code in /etc/config/wireless

5. Since I'm in USA and not in those other countries, after I change the country code, how do I test to see if it works or i did it correctly from USA since I dont have any WiFi equipment from every country to connect to the access point to see if it can connect?

hardware is the same for all over the world, u have to change a country code for your wireless adapter (usually in the driver settings, or globally for whole system for some kind of hardware) and try

(Last edited by stas2z on 3 Feb 2016, 18:12)

I changed the country code on the YUN Access Point to several different countries, rebooting each time, but seems no matter what country code i put in there, i can still connect to the YUN Access Point WiFi using my mac desktop and also using my android phone.

Is this how it should work? i thought i wouldnt be able to connect anymore if the YUN has a different country code from the client?

So maybe the country code does nothing? or is the android and mac automatically adapting?

anybody knows? its really urgent!

thanks

iosdev1024 wrote:

So maybe the country code does nothing? or is the android and mac automatically adapting?

All it does is limit what channels can be selected on the wifi.  If two different countries allow the same channel to be in operation then there is no reason the two devices cannot communicate.  Otherwise if you travelled overseas your devices wouldn't be able to work if they were bought in a different country.  That is just silly.

I'm in USA, i changed the country code in the YUN to maybe 20 different countries, each time rebooting, yet i can still use my cell phone and mac to connect to it no matter what the country code.

npkamen - are you saying this is ok? its supposed to work this way?

iosdev1024 wrote:

I'm in USA, i changed the country code in the YUN to maybe 20 different countries, each time rebooting, yet i can still use my cell phone and mac to connect to it no matter what the country code.

npkamen - are you saying this is ok? its supposed to work this way?

Yes

By setting the country code to USA for the wifi network adapter it just stops the AP transmitting on frequencies that may be used for other things in that country.  Clients also will have restrictions but I imagine they will only have restrictions when they are in AP mode, not client mode.

iosdev1024 wrote:

I'm in USA, i changed the country code in the YUN to maybe 20 different countries, each time rebooting, yet i can still use my cell phone and mac to connect to it no matter what the country code.

npkamen - are you saying this is ok? its supposed to work this way?

2.4GHz band difference is a few, it's only affects restricted txpower and channels 11-14 sometimes.
Just for example

country US: DFS-FCC
    (2402 - 2472 @ 40), (30)

it means 1 - 11 channels allowed with 30dBm max txpower (12-13 are also allowed but with txpower restriction)


country DE: DFS-ETSI
    # entries 279004 and 280006
    (2400 - 2483.5 @ 40), (100 mW)

1 - 13 channels with 20dBm txpower

(Last edited by stas2z on 4 Feb 2016, 07:33)

what about "country_ie" does that have to be set when changing the country code?

the documentation reads....

https://wiki.openwrt.org/doc/uci/wireless

country_ie - Enables IEEE 802.11d country IE (information element) advertisement in beacon and probe response frames. This IE contains the country code and channel/power map. Requires country.


I wasnt setting that, maybe this is why i could connect to it even when the country code was different, maybe because it wasnt enabled it wasnt doing anything with the country code until this is set?


How can I know if the code should be 2 letters or a number, it depends on if im using mad-wifi, how can i tell if i'm using mad-wifi? how can i easily check which driver im using from command line?

thanks

(Last edited by iosdev1024 on 4 Feb 2016, 13:11)

iosdev1024 wrote:

what about "country_ie" does that have to be set when changing the country code?

the documentation reads....

https://wiki.openwrt.org/doc/uci/wireless

country_ie - Enables IEEE 802.11d country IE (information element) advertisement in beacon and probe response frames. This IE contains the country code and channel/power map. Requires country.


I wasnt setting that, maybe this is why i could connect to it even when the country code was different, maybe because it wasnt enabled it wasnt doing anything with the country code until this is set?


How can I know if the code should be 2 letters or a number, it depends on if im using mad-wifi, how can i tell if i'm using mad-wifi? how can i easily check which driver im using from command line?

thanks

it's not required but can be set in case of troubles with apple devices (apple wifi drivers scan each nearby ap's for country code IE to set internal country code automatically and it hurts sometimes, when your neighbours using AP's with a wrong country code set)

The discussion might have continued from here.