Restrict RPi 4 to 2.4GHz

I have a handful of RPi 4s that are connected to WiFi. I can tell using nmcli device wifi that the Pis are connected to a 5 GHz channel. Unfortunately I don’t have control over the access point so I can’t separate the channels to 2.4 GHz and 5 GHz. Is there a mechanism to restrict the Pi to joining only 2.4 GHz channels or a specified list of channels?

Hi

Can you try scanning the network using iw and getting the list of BSSIDs along with the SSID?
Once you have the BSSID, you can connect using nmcli but use the BSSID instead of the SSID.
For networks that have the same SSID, the BSSID will still be different - so your 2.4 and 5GHz networks should have different BSSIDs.

For scanning using iw - iw wlan0 scan
The syntax for nmcli remains the same - nmcli device wifi connect <SSID|BSSID> password <password>

Thanks for the super-swift reply. I can get the list of BSSIDs and they are indeed unique but attempting to join any of them yields ‘No access point with BSSID XX:XX:XX:XX:XX found’.

Another option that may work for you, is to limit the “band” that can be connected to by the device, and set it to ‘bg’. There is an entry on this page that describes how to limit which networking bands to connect to:

https://developer.gnome.org/NetworkManager/stable/nm-settings.html

Look for the section called “802-11-wireless setting”, and see the “band” attribute.

That may help restrict the device to the 2.4ghz spectrum. Thanks!

Thanks. I found the config file in mnt/boot/system-connections and was able to add this line, which has worked for me.

For the benefits of anyone else reading this in future, an initial attempt at modifying the resin-wifi-01 file at the above path was not successful. Following the reference at the link provided by dtischler I added this to the file:

[802-11-wireless]
band=bg

It actually appears that in this file ‘802-11-setting’ is substituted with ‘wifi’ so I instead added the ‘band=bg’ line under this, pre-existing section and it all seems to work. I’ve not found somewhere that documents exactly how the fields in this file translate to NetworkManager settings. I’m assuming it’s something Balena-specific. Anyway, in case it’s of future help…

These files are directly loaded by NetworkManager - the files in the boot partition will be copied into the /etc filesystem and if you already had a file with that name then it wouldn’t be overwritten (I don’t think). I am not aware of anything getting substituted etc.

With regards to the file content though, it’s just a system connection file used by NetworkManager :+1:

Found the key piece of info I was missing under ‘Name aliases’ here https://developer.gnome.org/NetworkManager/stable/nm-settings-keyfile.html

I think I found that any modifications to the files under /etc were lost on reboot, but I’d have to go back and test again to be absolutely sure.

Hi @Archie

Glad to see that you found the Name aliases information, thanks for providing the link.

Assuming you’re referring to /etc/NetworkManager/system-connections - that is a persistent folder bind mounted to the state partition, so changes are not lost on a controlled reboot. However, if you change something and do not sync the filesystem and cold plug it for example, changes may be lost. But a normal controlled reboot will persist the changes.

What also happens is that on boot the contents of /mnt/boot/system-connections gets copied over /etc/NetworkManager/system-connections/, but nothing should get deleted.

Kind regards
Alida