MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.9k stars 499 forks source link

wifi hotspot fails on 5 GHz #6636

Open lukaszsobala opened 1 year ago

lukaszsobala commented 1 year ago

Details:

MichaIng commented 1 year ago

Thanks for testing WiFi 6.

enable wifi6 branch https://github.com/MichaIng/DietPi/pull/6575

What do you mean with wifi6 branch? The branch of the linked PR was a feature branch which does not exist anymore, but has been merged into regular DietPi master branch. If not done, please try to update to latest DietPi v8.22.

However, the related code has not changed. I'm quoting again the description of the modes from the example config:

# Operation mode (a = IEEE 802.11a (5 GHz), b = IEEE 802.11b (2.4 GHz),
# g = IEEE 802.11g (2.4 GHz), ad = IEEE 802.11ad (60 GHz); a/g options are used
# with IEEE 802.11n (HT), too, to specify band). For IEEE 802.11ac (VHT), this
# needs to be set to hw_mode=a. For IEEE 802.11ax (HE) on 6 GHz this needs
# to be set to hw_mode=a. When using ACS (see channel parameter), a
# special value "any" can be used to indicate that any support band can be used.
# This special case is currently supported only with drivers with which
# offloaded ACS is used.
# Default: IEEE 802.11b
hw_mode=g

So hw_mode=a implies IEEE 802.11a, but is also correct for IEEE 802.11ac (5 GHz) and "IEEE 802.11ax on 6 GHz". It does not explicitly mention "IEEE 802.11ax on 5 GHz", but there is no other mode which could possibly be correct/required for this.

But just to rule it out, since the AX210 supports 6 GHz as well, could you just try to enter one of the 6 GHz channels? Interestingly some of them have the same numbers as 2.4 GHz channels, so I hope also hostapd supports them in combination with hw_mode=a: https://en.wikipedia.org/wiki/List_of_WLAN_channels#6_GHz_(802.11ax_and_802.11be)

And of course also try some of the other 5 GHz channels. 36 seems to be the most compatible one, but I'm not sure whether it works in all countries/with all country codes.

Last but not least, I guess the kernel does not come with a driver for this WiFi adapter OOTB. Where did you get it from? Probably it has limitations with hostapd. Does it work well with WiFi 4 and 5?

MichaIng commented 1 year ago

Frequency 5180 (primary) not allowed for AP mode, flags: 0x30053 NO-IR

https://github.com/lwfinger/rtw88/issues/29

Anyway, no IR means it's restricted in your country, which channel 36 happens to be. Just change the iw region to a different one.

So indeed it's the country code in combination with this channel. Which country code do you use, respectively where is the AP located? Try a different WiFi 5 channel, or for testing, temporarily change the country code, to verify that generally 5 GHz channel 36 is supported by the adapter. Note that it is illegal to operate an AP like this.

lukaszsobala commented 1 year ago

I actually did not set any locale and it might have been the problem, but I don't think so.

Today I used a fresh install and set all the locales to mine (PL). What combinations work?

5 GHz doesn't work at all.

I can't seem to change the channel for WiFi 5 GHz, it defaults to channel 36 but when I try to get to the list, no channels are available. It's as if the channel list for 5 GHz did not exist (I tried a few country codes).

AX210 works because these files are present in the image (it came with them in /lib/firmware/ and /lib/firmware/intel/ - and many others - predownloaded):

https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/intel/ibt-0041-0041.sfi
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/intel/ibt-0041-0041.ddc
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/iwlwifi-ty-a0-gf-a0-59.ucode

At the time when I installed that version of DietPi, the branch was probably still unmerged. With this fresh install I just updated to 8.22.

The good thing is that WiFi 6 works as expected, I get a little "6" when connected with it enabled. Also, I think that there must be a way to make the hotspot use both 5 GHz and 2.4 GHz bands like every WiFi 6 router does (without specifying it - I think that with WiFi 6 enabled there should be an option saying "2.4 + 5", for example). Maybe even use the 6 GHz band as WiFi 6E should be able to. But the hardware capabilities might be tricky to detect within dietpi.

MichaIng commented 1 year ago

I actually did not set any locale and it might have been the problem, but I don't think so.

The locale is irrelevant, but the WiFi country code is mandatory. Channel 36 btw worked well here with German (DE) country code.

I can't seem to change the channel for WiFi 5 GHz, it defaults to channel 36 but when I try to get to the list, no channels are available. It's as if the channel list for 5 GHz did not exist (I tried a few country codes).

Oh, and this is a bug. It should be an inputbox (no list, as of the fragmented and per-country supported codes). Fixed with: https://github.com/MichaIng/DietPi/commit/f943e3c

Please try this:

sed -i "s/G_WHIP_MENU 'Please enter a 5 GHz WiFi channel/G_WHIP_INPUTBOX 'Please enter a 5 GHz WiFi channel/" /boot/dietpi/dietpi-config
dietpi-config

Now you should be given an inputbox, with 36 entered as default, and the URL given to the Wikipedia article I linked above to find a suitable channel.

lukaszsobala commented 1 year ago

Indeed, now I can choose the channel but still none of the services are able to start up on 5 GHz, even with the exact country code/channel combination that you used.

MichaIng commented 1 year ago

@lukaszsobala Does your Wi-Fi 6 router support WPA3, or better, does it even enforce WPA3 when Wi-Fi 6 is enabled? According to this info, WPA3 is mandatory for Wi-Fi 6, but we know that it is often confused with 6 GHz, so would be good to know which one is actually meant. Actually you tested Wi-Fi 6 with 2.4 GHz and WPA2 successfully already, it seems, but probably it would then work with 5 GHz (and even 6 GHz) as well when using WPA3. The link contains an example config, and you can adjust the related settings in /etc/wpa_supplicant/wpa_supplicant.conf and then retry connecting to the network via ifup wlan0.

For reference: #6636

lukaszsobala commented 1 year ago

I don't see how my router is relevant here as it is the dietpi system that serves as an access point creating its own independent network.

Yes, my router (Huawei AX3) supports it but that's another network. I have WPA3 set up but I can change it to WPA2 if needed. Some devices that don't yet support WPA3 are still able to connect, magically.

Ah, the setting on the router is: WPA2 PSK/WPA3 SAE, so WPA2 devices can still connect. There is no way to enforce pure WPA3. But any wifi 6 chip will be capable of using pure WPA3.

I will try messing with wpa_supplicant using info in the link. And yes, dietpi-hotspot does work with 2.4 GHz.

MichaIng commented 1 year ago

Ah right, of course, I was not thinking correctly, just remembered the 5/6 GHz issue with Wi-Fi 6 here after reading the requirements.

However, the underlying issue might be the same. So you could try to add the ieee80211w=1 to /etc/hostapd/hostapd.conf and for WPA3 wpa_key_mgmt=WPA-PSK SAE, i.e. just adding "SAE" space-separated to that config. So that way WPA2 and WPA3 should be supported. I cannot find any up-to-date hostapd.conf manpage or documentation, but some forum threads which indicate this possibility:

The second link would then be WPA3-only.

lukaszsobala commented 1 year ago

Indeed, I managed to change it to WPA3 (even enforcing SAE) by editing hostapd.conf, deleting WPA-PSK and adding SAE, but I don't know what to edit to get 5 GHz working. I tried changing the channel in that file to "36" but this did nothing except it made hostapd not start after a restart.

Confusingly, the option wpa=3 doesn't mean WPA3 but WPA 1 or 2 (for WPA3 it needs to be wpa=2)

actraiser30 commented 10 months ago

Hi I also noticed that when I select the 5ghz band the max speed set is 54mbps instead of 300mbps or moreI don't know if this is a bug also