0

I have a Raspberry Pi Zero W that is connected to my router over a wireless connection. I initially had trouble connecting because I use the same SSID for both the 2.4 and the 5GHz band, so other clients in my network can choose which band to use based on signal strength.

In order to get my Raspi to connect I changed the SSID of the 2.4 GHz band to “NAME-2.4” in order to make sure the Raspi could distinguish between the two bands. It seemed impossible to get the Raspi to connect to my router when both bands had the same name, I’m not sure why. This is especially weird because the Raspi zero W is only equiped with a 2.4GHz antenna.

Is there any way I can make my Raspi distinguish between the two different networks if I go back to the situation where I give them both the same name? Perhaps by “hardcoding” the MAC address of the 2.4 GHz antenna in the wpa_supplicant.conf, or someway via SSH, assuming that I can still connect to the device somehow.

1

You can define the access point you want the Pi to connect to by adding the MAC address of the access point into wpa_supplicant.conf

Edit the network entry to have the line bssid in it with he AP MAC address:

network={
        bssid=00:11:22:33:44:55
        ....
}

e.g.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB

network={
    bssid=00:11:22:33:44:55
    ssid="DualFreq"
    psk="..."
}

This will try to connect to the 'DualFreq' network on the AP MAC address 00:11:22:33:44:55 with password '...'

If you have multiple access points and do not with to connect to one, then you can use:

network={
        bssid_blacklist=00:11:22:33:44:55
        ....
}

One final option, though I have not had this working on a Pi Zero (TBH not tried since Stretch) is to define the possible frequencies the Pi is to use:

network={
        freq_list=2412 2417 2422
        ....
}

In the above - replace the numbers with the relevant frequencies you AP uses (and are legal in your country). Do not use the channel numbers but use the centre frequency of the channel and list all the AP can use else the Pi gets left behind in the AP hops frequency.

The good news is that with this selection being in wpa_supplicant.conf, this can be updated at any time by:

  1. Use SSH and editing /etc/wpa_supplicant/wpa_supplicant.conf (sudo required)
  2. Recreating the file in the /boot partition on the SD Card on a PC/MAc/Linux box
1
  • see @lngo's answer, Pi Zero does not support 5 GHz Jan 6 at 21:47
4

That's curious. The Raspberry Pi Zero W is only working with the 2.4 GHz band. It is not able to detect and use the 5 GHz band because it's WiFi device simply does not support 5 GHz. I'm afraid to distinguish between the two bands will not help because it doesn't see the 5 GHz band. It should always only connect with frequencies on the 2.4 GHz band by hardware restriction. I would look at your hotspot why it does not connect to the RasPi on 2.4 GHz.

Anyway, to be on the save side and to complete the other answers you can just add the possible frequencies either to the global section or to a network section in /etc/wpa_supplicant/wpa_supplicant.conf, for example:

ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
update_config=1
country=DE

freq_list=2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472
#freq_list=5170 5180 5190 5200 5210 5220 5230 5240 5260 5280 5300 5320 5500 5520 5540 5560 5580 5600 5620 5640 5660 5680 5700

network={
    ssid="RPiNet"
    psk="verySecretPassword"
    #freq_list=2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472
    #freq_list=5170 5180 5190 5200 5210 5220 5230 5240 5260 5280 5300 5320 5500 5520 5540 5560 5580 5600 5620 5640 5660 5680 5700
}

Just comment/uncoment the freq_list you want. In the example above there are only all 2.4 GHz frequencies globally enabled. All connections specified in network blocks will only use this band.

3
  • Thanks for your answer! I figure adding the bssid to the wpa_supplicant.conf will do the trick, but I haven’t tried yet. Just out of curiosity, what made you assume I’m in Germany? Or is “DE” just picked randomly as country in your conf file?
    – Joep
    Dec 19 '20 at 10:25
  • @Joep I'm from Germany. That's my example.
    – Ingo
    Dec 19 '20 at 10:38
  • Aha, danke sehr!
    – Joep
    Dec 20 '20 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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