Country code for Wi-Fi operation

OpenWrt is free software, but not free as in “free of responsibilities”. Your one simple responsibility when operating a OpenWrt device with Wi-Fi, is to use Wi-Fi according to your countries regulation. For obvious reasons, applying OpenWrt on any purchased device does not change your responsibilities regarding compliance to your country's Wi-Fi regulations.

When setting up Wi-Fi, it is mandatory, to set the correct country code, where your router is currently being operated.

This config field is not meant, to set where you were born and not the country where you would prefer to live happily forever end ever with Katy Perry. And it's also not some optional “cloud usage statistics” input field.

This country setting ensures that your router will only enable Wi-Fi radio settings that conform with the countries official regulatory laws.

You can find this country setting in the web admin GUI (LuCi) unter → Menu: Network/Wireless

  • click “Edit” on any of your Wi-Fi radios, then open the “Advanced Settings” tab - and there is the “Country Code” field.
  • If you do not see any “Edit” button, then you have not yet configured any Wi-Fi radio configuration using “Add”

On the command line you can set the country with iw reg set

Needless to say that some Wi-Fi frequencies are still for indoor use only, no matter if OpenWrt or the vendor firmware runs on your device. OpenWrt can by itself enforce settings like the maximum transmit power, but it cannot not tell, if you have setup your OpenWrt device outdoors. So know your allowed frequencies, before providing Wi-Fi to the roses at to the far end of your garden.

The following is for informational purpose for technically interested readers, you do not have to worry about the low level stuff. There is nothing you have to do beyond setting your proper country code. OpenWrt automatically takes care of everything else for you.

OpenWrt relies on the OpenWrt-firmware-contained CRDA database, containing the regulation details for each supported country.

If you are curious about specific details for your country, run iw reg get on the command line: Example output for Belgium:

country BE: DFS-ETSI
        (2402 - 2482 @ 40), (N/A, 20), (N/A)
        (5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW
        (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW
        (5490 - 5710 @ 160), (N/A, 27), (0 ms), DFS
        (57000 - 66000 @ 2160), (N/A, 40), (N/A)

Note: this is not what your Wi-Fi hardware is technically capable of.
These are the max values your hardware is allowed to use, according to your country's regulation.
If your hardware could do more, it will be capped by this regulatory limits during operation.

Explanation of some commonly used values in iw output:

  • “(2402 - 2482)” : the first set of brackets in each line is an allowed Wi-Fi frequency range (in this case of the 2.4GHz Wi-Fi. The output will not show actual Wi-Fi channel numbers)
  • “(N/A, 20)”: The second set of brackets in each line is the antenna transmit power limit for this frequency range. If there is no unit label “mW” given (as in this example: 20 = 20dBm), the limit is stated in exponential “dBm” notion. dBm notion values are exponential: +3=doubling the power, e.g. 17 dBm = 50 milliwatts, 20 dBm = 100 milliwatts transmit power
  • “@ ..” in the first bracket is the maximum allowed channel width in the given frequency range
  • “AUTO-BW: “Auto-bandwidth”: The Wi-Fi stack may automatically decide about the channel width
  • DFS“: “dynamic frequency selection”: Wi-Fi networks operating in those bands are required to employ a radar detection and avoidance capability.
  • “NO-OUTDOOR”: Frequency range must not be used for outdoor usage.

See the CRDA database for explanation of further values.

The following is for informational purpose for technically interested readers, you do not have to worry about the low level stuff, there is nothing you have to do beyond setting your proper country code. OpenWrt automatically takes care of everything else for you.

Regulatory requirements for DFS-marked frequency require that OpenWrt automatically scans these Wi-Fi frequencies for 60seconds for any weather radar activity, before actually using them for Wi-Fi activities.

An effect that you may notice about this scan delay is a temporary user-unexpected Wi-Fi downtime. Such a short downtime may be experienced, when OpenWrt's Wi-Fi software stack switches to a DFS channel or when OpenWrt is done booting, but does not yet offer Wi-Fi for connection.

This delay isn't due to a bad software implementation, it's only due to a regulatory requirement. Factory firmware either does not support DFS channels at all or has to implement the same scan delays. Future hardware may support extra antennas for transparent DFS-scanning in the background to remove the user-noticable delays on such Wi-Fi frequencies.

It could happen rarely, but if any changes happen in your country's wireless regulation, these changes will be reflected as part of a new regular OpenWrt firmware update. So you as the Wi-Fi device operator are responsible to keep the device within the current limits of your regulatory laws. And practically you can achieve this simply by keeping the firmware of your OpenWrt firmware up to date and apply newer releases from OpenWrt from time to time.
In rare cases even new frequencies get added to the allowed Wi-Fi spectrum of your country.

It may be that your device has been branded by the vendor to be sold in a specific country and therefore has some additional hardcoded Wi-Fi limits for that particular country.

The Wi-Fi radio chip of your device might enforce such limits in addition to the country limits OpenWrt brings. Such hardware limits will precede OpenWrt regulatory settings.

If your take such a limited device to a different country, such hardware-encoded limitation will cause your hardware to still enforces the stronger limits of the original country. There is nothing you can do about such hard-encoded limits, you cannot circumvent them, you have to live with these extra-applied Wi-Fi limits.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2021/12/04 23:46
  • by hackerb9