I'm a bit confused of the country property in wpa_supplicant.conf. In official Raspberry Wifi Documentation it says this:

On the Raspberry Pi 3 Model B+, you will also need to set the country code, so that the 5G networking can choose the correct frequency bands. You can either use the raspi-config application and select the localisation option, or edit the wpa_supplicant.conf file and add the following. (Note you need to replace 'GB' with the ISO code of your country. See Wikipedia for a list of country codes.)

So far everything was clear, until I encountered Wifi problems. I live in Spain 'ES', but I've set the country code to 'US' as the client I would ship the Raspbian image to is from there. I've sent him my Raspbian image and he mounted it on Pi 3B+ device. He connected to WiFi and obtained a wlan0 IP. The problem was when he wanted to connect to Pi from his device using wlan0 IP (Both devices were connected to same AP). It wouldn't connect and the request would time out eventually.

The fix was that he changed the country=US to country=ES

Therefore, he was using country=ES , while his device is located in the US and it apparently worked.

So what exactly is the purpose of setting the country in wpa_supplicant.conf? How come he was able to connect to Pi using wlan0 IP only after setting the country to ES?

  • 2
    the issue you describe is impossible ... fact is, "he" got an IP address, therefore the pi successfully connected to "his" router and successfully obtained, via DHCP, an IP address - that means the wifi on the pi and the AP are compatible ... don't trust what "he" says fixed the issue, "he" is probably mistaken - However, I do have a theory as to how changing the country code could behave that way - but the issue is not with the Pi Commented Jan 30, 2019 at 10:53
  • Did the address start with 169? Afaik dhcpcd on Raspbian by default sets a link local address if it cannot obtain one.
    – Mantriur
    Commented Mar 29, 2021 at 12:11

2 Answers 2


Because the bands of 2,4 GHz also differ per country (see the list here https://en.wikipedia.org/wiki/List_of_WLAN_channels) it is true 1-11 are accepted everywhere, but 12, 13 are valid in Europe and Japan but not in the USA and 14 is only valid in Japan.

So to connect to a wifi network operating on (in USA illegal) channel 12 or 13 the country code should be set to a European country like ES (Spain)


The frequency allocations for 5GHz band differ between countries and there is NO UNIVERSAL SUBSET which is legal everywhere. (The 2.4GHz band supports channels 1-11 everywhere.)

It is a licensing condition that only supported bands are used - thus the need to set Country. (It is illegal to use unauthorised bands - but practically only bands supported by licensed routers would be used.)

  • But - why the OP has to use country=ES in the US instead of country=US?
    – Ingo
    Commented Jan 31, 2019 at 1:12
  • 1
    @Ingo I was answering the OP's question "So what exactly is the purpose of setting the country in wpa_supplicant.conf?" It is impossible and futile to answer ill-defined questions with no evidence of an actual problem.
    – Milliways
    Commented Jan 31, 2019 at 1:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.