I am able to get an RPi Zero W working just fine in Access Point (AP) mode using the image at https://openwrt.org/toh/raspberry_pi_foundation/raspberry_pi without issues. However, I have been trying to get it to connect to my wireless network as a client, using Luci (the web interface) and uci (the command line), without any success.
Here is a minimal non-working example configuration:
root@OpenWrt:/# cat /etc/config/wireless
config wifi-device 'radio0'
option type 'mac80211'
option path 'platform/soc/20300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1'
option channel 'auto'
option disabled '0'
config wifi-iface 'default_radio0'
option device 'radio0'
option network 'lan'
option mode 'sta'
option ssid 'XXXX'
option encryption 'psk2'
option key 'XXXXXXXX'
root@OpenWrt:/# cat /etc/config/network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fddc:dc26:9e82::/48'
config device
option name 'br-lan'
option type 'bridge'
list ports 'wlan0'
config interface 'lan'
option device 'br-lan'
option proto 'dhcp'
I'm connected to the RPi by serial console. When I do /etc/init.d/network restart
, I get no kernel messages and I don't see any connection attempts in my home router (which is also running openwrt).
What am I doing wrong? How can I diagnose this further?
---- Here is what else I've tried: ----
Before all this, I installed raspbian and got it to connect to my home WiFi just fine. I have also tried the config above with option country 'GB'
and option channel '3'
, but that seems to make no difference.
The openwrt install image comes with AP mode configured but disabled. When I enable the AP, it works find and I am able to connect to it and login with Luci. In the web interface, in the wireless settings, I am able to 'scan' for my WiFi and get Luci to set it up, which generates the interface default_radio0
like I have shown above. However, it then fails to connect to my WiFi. I see these kernel messages:
[ 1642.087635] ieee80211 phy0: brcmf_escan_timeout: timer expired
[ 1642.558109] br-lan: port 1(wlan0-1) entered disabled state
[ 1642.890438] br-lan: port 1(wlan0-1) entered blocking state
[ 1642.897341] br-lan: port 1(wlan0-1) entered forwarding state
[ 1643.608769] br-lan: port 1(wlan0-1) entered disabled state
[ 1644.282848] br-lan: port 1(wlan0-1) entered blocking state
[ 1644.289585] br-lan: port 1(wlan0-1) entered forwarding state
[ 1644.768828] br-lan: port 1(wlan0-1) entered disabled state
[ 1644.887450] br-lan: port 1(wlan0-1) entered blocking state
[ 1644.894181] br-lan: port 1(wlan0-1) entered forwarding state
[ 1654.887633] ieee80211 phy0: brcmf_escan_timeout: timer expired
[ 1655.361775] br-lan: port 1(wlan0-1) entered disabled state
[ 1655.686428] br-lan: port 1(wlan0-1) entered blocking state
[ 1655.693719] br-lan: port 1(wlan0-1) entered forwarding state
[ 1656.408787] br-lan: port 1(wlan0-1) entered disabled state
[ 1657.106593] br-lan: port 1(wlan0-1) entered blocking state
[ 1657.113308] br-lan: port 1(wlan0-1) entered forwarding state
[ 1657.612989] br-lan: port 1(wlan0-1) entered disabled state
[ 1658.456191] br-lan: port 1(wlan0-1) entered blocking state
[ 1658.463160] br-lan: port 1(wlan0-1) entered forwarding state
[ 1658.931869] br-lan: port 1(wlan0-1) entered disabled state
[ 1659.851091] br-lan: port 1(wlan0-1) entered blocking state
[ 1659.857719] br-lan: port 1(wlan0-1) entered forwarding state
[ 1660.329569] br-lan: port 1(wlan0-1) entered disabled state
[ 1661.232759] br-lan: port 1(wlan0-1) entered blocking state
[ 1661.239640] br-lan: port 1(wlan0-1) entered forwarding state
[ 1661.710538] br-lan: port 1(wlan0-1) entered disabled state
[ 1662.625207] br-lan: port 1(wlan0-1) entered blocking state
[ 1662.631844] br-lan: port 1(wlan0-1) entered forwarding state
[ 1663.101137] br-lan: port 1(wlan0-1) entered disabled state
[ 1663.255249] br-lan: port 1(wlan0-1) entered blocking state
[ 1663.261842] br-lan: port 1(wlan0-1) entered forwarding state
And on my home router I see:
Sat Dec 17 17:07:51 2022 daemon.notice hostapd: wlan0: AP-STA-DISCONNECTED b8:27:eb:4d:02:47
Sat Dec 17 17:07:51 2022 daemon.info hostapd: wlan0: STA b8:27:eb:4d:02:47 IEEE 802.11: disassociated
Sat Dec 17 17:07:52 2022 daemon.info hostapd: wlan0: STA b8:27:eb:4d:02:47 IEEE 802.11: authenticated
Sat Dec 17 17:07:52 2022 daemon.info hostapd: wlan0: STA b8:27:eb:4d:02:47 IEEE 802.11: associated (aid 7)
Sat Dec 17 17:07:52 2022 daemon.notice hostapd: wlan0: AP-STA-CONNECTED b8:27:eb:4d:02:47
Sat Dec 17 17:07:52 2022 daemon.info hostapd: wlan0: STA b8:27:eb:4d:02:47 WPA: pairwise key handshake completed (RSN)
Sat Dec 17 17:07:52 2022 daemon.notice hostapd: wlan0: EAPOL-4WAY-HS-COMPLETED b8:27:eb:4d:02:47
Sat Dec 17 17:07:53 2022 daemon.notice hostapd: wlan0: AP-STA-DISCONNECTED b8:27:eb:4d:02:47
Sat Dec 17 17:07:53 2022 daemon.info hostapd: wlan0: STA b8:27:eb:4d:02:47 IEEE 802.11: disassociated
Sat Dec 17 17:07:54 2022 daemon.info hostapd: wlan0: STA b8:27:eb:4d:02:47 IEEE 802.11: authenticated
Sat Dec 17 17:07:54 2022 daemon.info hostapd: wlan0: STA b8:27:eb:4d:02:47 IEEE 802.11: associated (aid 7)
Sat Dec 17 17:07:54 2022 daemon.notice hostapd: wlan0: AP-STA-CONNECTED b8:27:eb:4d:02:47
Sat Dec 17 17:07:54 2022 daemon.info hostapd: wlan0: STA b8:27:eb:4d:02:47 WPA: pairwise key handshake completed (RSN)
Sat Dec 17 17:07:54 2022 daemon.notice hostapd: wlan0: EAPOL-4WAY-HS-COMPLETED b8:27:eb:4d:02:47
Sat Dec 17 17:07:54 2022 daemon.notice hostapd: wlan0: AP-STA-DISCONNECTED b8:27:eb:4d:02:47
So this is what I get when I'm trying to get the wireless to work in AP+STA mode using Luci. Supposedly, that should work because iw list
shows:
...
valid interface combinations:
* #{ managed } <= 1, #{ P2P-device } <= 1, #{ P2P-client, P2P-GO } <= 1,
total <= 3, #channels <= 2
* #{ managed } <= 1, #{ AP } <= 1, #{ P2P-client } <= 1, #{ P2P-device } <= 1,
total <= 4, #channels <= 1
...