Wi-Fi channel auto-selection

Hello !

https://openwrt.org/docs/guide-user/network/wifi/basic
Name: channel
Type: "auto"

Channel auto-selection once when the router is turned on ??

Thank

A few more words would help massively to understand your actual question.

That said, ACS/ auto should never be used. There is no smart algorithm behind auto, it just sets the first legal channel for your environment (so effectively ch1 or ch36) - regardless of your environment or if other channels would be better or completely free. Always select a channel manually, based on your surrounding.

3 Likes

That is, Auto is not the choice of the most free channel according to, for example, the algorithm CCA (Clear Channel Assessment) ?

No, it always selects 1 or 36.

1 Like

Thank, slh !
In OpenWRT there is no CCA or other algorithm of the periodic auto-selection of the free channel yet ?

that is not true.

I only have 1 other Wifi on channel 36 here (from neighbors) and with auto channel selection turned on my device chooses a channel different than 36.

Maybe there is a problem measuring the interference on some devices.

On my device setting channel to auto sets channel=acs_survey in the generated hostapd-phyX.conf.

https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf

# If CONFIG_ACS build option is enabled, the channel can be selected
# automatically at run time by setting channel=acs_survey or channel=0, both of
# which will enable the ACS survey based algorithm.

You can verify the ACS algorithm in the log output from hostapd.
logread | grep hostapd | grep ACS

daemon.notice hostapd: ACS: Automatic channel selection started, this may take a bit
daemon.notice hostapd: wlan0: interface state COUNTRY_UPDATE->ACS
daemon.notice hostapd: wlan0: ACS-STARTED
daemon.notice hostapd: ACS: Automatic channel selection started, this may take a bit
daemon.notice hostapd: wlan1: interface state COUNTRY_UPDATE->ACS
daemon.notice hostapd: wlan1: ACS-STARTED
daemon.notice hostapd: wlan1: ACS-COMPLETED freq=2437 channel=6
daemon.notice hostapd: wlan1: interface state ACS->ENABLED
daemon.notice hostapd: wlan0: ACS-COMPLETED freq=5260 channel=52
daemon.notice hostapd: wlan0: interface state ACS->HT_SCAN

There are also other options supported, like:
acs_chan_bias, acs_exclude_dfs, chanlist

# acs_chan_bias is a space-separated list of <channel>:<bias> pairs. It can be
# used to increase (or decrease) the likelihood of a specific channel to be
# selected by the ACS algorithm. The total interference factor for each channel
# gets multiplied by the specified bias value before finding the channel with
# the lowest value. In other words, values between 0.0 and 1.0 can be used to
# make a channel more likely to be picked while values larger than 1.0 make the
# specified channel less likely to be picked. This can be used, e.g., to prefer
# the commonly used 2.4 GHz band channels 1, 6, and 11 (which is the default
# behavior on 2.4 GHz band if no acs_chan_bias parameter is specified).
#
# Defaults:
#acs_num_scans=5
#acs_chan_bias=1:0.8 6:0.8 11:0.8

But actually, I don't understand this option.
The total interference factor for each channel gets multiplied by the specified bias value. The total interference factor for each channel gets multiplied by the specified bias value before finding the channel with the lowest value
So it would make more sense if the bias value would be negative.

# Exclude DFS channels from ACS
# This option can be used to exclude all DFS channels from the ACS channel list
# in cases where the driver supports DFS channels.
#acs_exclude_dfs=1
# Channel list restriction. This option allows hostapd to select one of the
# provided channels when a channel should be automatically selected.
# Channel list can be provided as range using hyphen ('-') or individual
# channels can be specified by space (' ') separated values
# Default: all channels allowed in selected hw_mode
#chanlist=100 104 108 112 116
#chanlist=1 6 11-13

chanlist = channels in openwrt wifi config.

acs_exclude_dfs doesn't work on my device because the driver doesn't report DFS channels (correctly), I guess.

And chanlist/channels work better for me than acs_chan_bias.
option channels '1 6 11'
vs
option acs_chan_bias '1:0.8 6:0.8 11:0.8'

If your surrounding WiFis use a 4 Channel plan, like 1-5-9-13
It's better to use:
option channels '1 5 9 13'
or
option acs_chan_bias '1:0.8 5:0.8 9:0.8 13:0.8',
I guess.

I think, its also better to use chanlist/channels because acs_chan_bias allows hostapd to choose channels other channels then 1,6,11/1,5,9,13.
So maybe your wifi radio ends up using channel 3, which will cause (side-channel) interference for channels 1-6.
See this graphic here from cisco (3 channels plan):


4 Channels plan:

But most likely you will end up using the 3 channels plan because most devices are defaulting to it, even in Europe.
If you are setting up a wifi on large area where no other rogue WiFis are around you can of course deploy a 4 channels plan.

3 Likes

Are you running vanilla OpenWrt on that device?

Latest trunk version with no modifications to hostapd, so yes it's vanilla?

I can't find any commit log for acs_survey but for acs_chan_bias.

So there must be support for ACS at least since 2017?

acs_exclude_dfs was added this year.

So this will not work on stable OpenWRT release.

//edit
looking through the make files of hostapd and wpa-supplicant, like this for example:

#CONFIG_ACS=y

Seems like all makefiles have this line commented.
Idk why this feature is enabled.

1 Like

When you post a "this works for me" answer, I think it would be nice to disclose that you are using a snapshot, to avoid confusing users that are running a stable release.

The mac80211.sh script in 18.06 has support for acs_survey, so it should work?

ACS is algorithm for channel selection ?
Which is better ACS or CCA ?

Short precise questions make one tick. I did my best to collect answers in the same manner.

ACS is algorithm for channel selection ?

Yes.

Which is better ACS or CCA ?

Those can not be compared. Supposed the acronyms mean what they are written to above, ie. Automatic Channel Selection (ACS) and Clear Channel Assessment (CCA).

ACS explained here: https://wireless.wiki.kernel.org/en/users/documentation/acs

CCA explained here (one source from many, the definitive being IEEE 802.11-2016 Standard): https://www.extremenetworks.com/extreme-networks-blog/what-is-a-clear-channel-assessment-cca/

Dynamic Frequency Selection (DFS) in channels on 5GHz is one more acronym affecting channel selection, description 1: https://forum.openwrt.org/t/wireless-config-channel-auto/1015/2 and description 2 https://en.wikipedia.org/wiki/Dynamic_frequency_selection.

A note: CCA and DFS are defined in 802.11 ammendments and standards, ACS seems not.

Disclaimer: I'm not an expert in 802.11 radios or standards, just a nerd trying to understand the pieces the 802.11 is made of and who's controlling what.

1 Like

I got tired of having to change the channels due the surrounding AP's continuously moving over onto the same channel that I use, so I decided to try the auto channel. Despite everyone saying that that doesn't work and the first channel is always selected, that does not seem to be so. It is selecting channels and while I do not quite agree with the 2.4Ghz selection, the channels chosen for 5GHz are empty, so a good choice.

So, is this feature working or not? This is the latest 19.07 with non-ct firmware.

daemon.notice hostapd: ap2: ACS-STARTED
daemon.notice hostapd: ap2: ACS-COMPLETED freq=2462 channel=11
daemon.notice hostapd: ap2: interface state ACS->ENABLED
daemon.notice hostapd: ap2: ACS-STARTED
daemon.notice hostapd: ap5: ACS-STARTED
daemon.notice hostapd: ap2: ACS-COMPLETED freq=2412 channel=1
daemon.notice hostapd: ap2: interface state ACS->ENABLED
daemon.notice hostapd: ap5: ACS-COMPLETED freq=5300 channel=60
daemon.notice hostapd: ap5: interface state ACS->HT_SCAN
daemon.notice hostapd: ap2: ACS-STARTED
daemon.notice hostapd: ap5: ACS-STARTED
daemon.notice hostapd: ap2: ACS-COMPLETED freq=2412 channel=1
daemon.notice hostapd: ap2: interface state ACS->ENABLED
daemon.notice hostapd: ap5: ACS-COMPLETED freq=5260 channel=52
daemon.notice hostapd: ap5: interface state ACS->HT_SCAN
daemon.notice hostapd: ap5: ACS-STARTED
daemon.notice hostapd: ap5: ACS-COMPLETED freq=5300 channel=60
daemon.notice hostapd: ap5: interface state ACS->HT_SCAN
daemon.notice hostapd: ap5: ACS-STARTED
daemon.notice hostapd: ap2: ACS-STARTED
daemon.notice hostapd: ap2: ACS-COMPLETED freq=2412 channel=1
daemon.notice hostapd: ap2: interface state ACS->ENABLED
daemon.notice hostapd: ap5: ACS-COMPLETED freq=5300 channel=60
daemon.notice hostapd: ap5: interface state ACS->HT_SCAN
1 Like

Could it be enabled because of this:

./package/network/services/hostapd/Makefile

DRIVER_MAKEOPTS= \
        CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \
        CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
        CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
        CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \
        CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \

grep -r CONFIG_PACKAGE_kmod-cfg80211 .config
CONFIG_PACKAGE_kmod-cfg80211=y
2 Likes
6 Likes

I'm new to OpenWrt and have been running it for a couple of months on my R7800. Wifi auto channel selection seems to work when I reboot or restart a radio in Network->Wireless. Do any other events trigger channel auto selection?

Not really, channels are only chosen when the interface goes up or when a DFS event requires a change.

3 Likes

That's good to know. Thanks!