How to connect to a specific Wi-Fi band (2.4 GHz or 5 GHz) or channel from wpa_cli or wpa_supplicant in Linux?

1

1

I am using the Wi-Fi chip on my board. I've successfully connected to Wi-Fi in the 2.4 GHz band, but for the 5 GHz Wi-Fi band I need to select the channel or band before connecting.

What extra arguments need to be given to the wpa_cli or wpa_supplicant utility so that it will connect to only the 5 GHz Wi-Fi band?

pankil

Posted 2015-02-24T15:44:50.603

Reputation: 11

Set the 2.4ghz SSID different from the 5.0 Ghz SSID. – Ramhound – 2015-02-24T16:10:59.413

same ssid will work on 5Ghz and as well as on 2.4 Ghz. SO need to differentiate before connecting, so that it will connect to only 5GHz. – pankil – 2015-02-25T05:03:30.337

I am suggesting you make them different. But how you force your adapter to connect at 5 ghz to a dual band network depends on the network adapter in question. – Ramhound – 2015-02-25T11:52:03.487

Answers

1

Tobi's answer is almost correct but they're the wrong way around, freq_list can be set outside the network block, but scan_freq can't: https://w1.fi/cgit/hostap/tree/wpa_supplicant/wpa_supplicant.conf#n861

singe

Posted 2015-02-24T15:44:50.603

Reputation: 11

you're right, doesn't make sense to limit the frequencies inside a network block... – Tobi – 2020-01-06T09:10:31.757

it's fixed now, thx – Tobi – 2020-01-06T09:16:48.530

0

You can limit the allowed frequencies in wpa_supplicant.conf:

add this outside of the network block:

freq_list=5500 5520 ... (all frequencies allowed in your country and in the desired band)

or you can also limit the scanned frequencies for a specific network (results in faster scans). Add to the config, inside the network block:

scan_freq=5500 5520 ...

Tobi

Posted 2015-02-24T15:44:50.603

Reputation: 61