Jump to content

Orange Pi Zero 3 hotspot/access point not working


av4625

Recommended Posts

Imho trying OpenWRT isn't a direct 'solution' of a problem. A notion is that 'it works in A OS' and 'doesn't work in B OS' normally won't give a clue to fixing the problem in 'B OS', except for the cases of *strictly a config problem*.

rather if you have A OS with a particular config that works and another A OS that has a config that doesn't work, then one'd be better comparing the 2 different configs between the 2 A OS, it would more likely find the 'config error'.

in theory if it is strictly config error, then you may as well copy over the 'correct' config and it should work.

 

my guesses as it has come this far is that it may not be simply a config problem. i.e. that there is (or at least may be) no problem with configs.

there is 'something else' that cause the problem, and it may not be config.

the thing is we do not know what that 'something else' is.

 

We can't rule out hardware differences, there are different memory sizes for Orange Pi zero 3 ( 1, 1.5, 2, 4 GB) as it has not been discussed here. But even then that is just one of the possible factors.

 

for the record, I've been using hostapd, Armbian on Orange Pi Zero 3, and it is practically my desktop WiFi hotspot, it 'just works', at least that Android connects to it flawlessly,  and yes WPA2 (see prior comments)

It runs for months literally without reboot and offers fast > 100 Mbps (throughput across both wifi and ethernet interfaces) WiiFi5 on 5 ghz band.

And I think (or I observed) that iphones connect just fine ! (we need inputs from other iphone users who have successfully done the same that if that 'just works'. Then maybe it is easier to compare on the same basis.

not easy to narrow down what that 'something else' is.

 

For now, based on prior analysis a few comments prior (especially about the hostapd/wpa_supplicant 'discovery', perhaps rebuild the  Armbian image (kernel + distribution) from source may help !

Still it is a gamble, as I do not know the root cause of it.

 

edit:

@av4625

there is one other thing, and this relates to config

https://gist.github.com/ag88/de02933ba65500376d1ff48e504b1bf3

in my hostapd.conf example I specified channel=0 (that should literally should mean auto selection of channel)

in actual fact, I used a specific channel 

# "a" simply means 5Ghz
hw_mode=a
# the channel to use
channel=36
ieee80211ac=1

 

the relevant channel is selected by running 

sudo iw list

which gives a detailed list of the frequencies / channels that can be set

then simply pick a channel that is legal and that one prefers (e.g. by checking that no other AP visible is using it) and set that in the hostapd.conf as above

if that is the problem, maybe it helps.

it is perhaps overlooked as the assumption is that only WPA/WPA2 is the issue.

 

Link to comment
Share on other sites

If a feature works on the board under OS A and does not under OS B, given both are Linux based, one can rule our HW issue.

By comparing kernel patches, one can rule out drivers, same with kernel configs/build options and lastly userland SW

That's all I meant.

Remember, OpenWRT, DDWRT, etc. are built with networking/AP functionality in mind, have large user base using exactly feature in question and there might be hints on their forums, wiki, etc.

Link to comment
Share on other sites

I'd guess that 

channel=36

specifier in hostapd.conf 2 comments above would likely make a difference.

prior, i stated channel=0 and I'm assuming ACS (automatic channel selection).

I think ACS may not be working after all, hence, it is necessary to specify the channel manually.

the easiest way to list all channels and frequencies is 

sudo iw list

 

and to list APs that are visible accordingly it is 

nmcli dev wifi

or 

sudo iw dev wlan0 scan

I think iw dev wlan0 scan and nmcli dev wifi needs to be done without hostapd or an AP (e.g. on Network Manager) running

 

I think on Android (and/or iphone?) there are also apps available to list visible WiFi APs and their frequencies / channels

even if it conflicts (e.g. 2 AP on the same channel) I'd guess it'd still work, just that there'd be 'interference' and possibly lower throughput.

 

---

blurb:

yes OpenWRT, Armbian, ... are among the earliest 3rd party open sourced implementations to run on Orange Pi Zero 3.

using Armbian (vs OpenWRT) is just my personal preference, partly as it is a complete linux distribution (e.g. debian). One can run various other things in addition to simply using it as a 'router'.

And that deban, ubuntu style apt update ; apt upgrade or apt install xxyy is very mature and setting up many different apps is simply a one liner apt install xxyy.

And not least Ambian build framework is one of the highlights

https://github.com/armbian/build

one can catch up to the (bleeding) 'edge' of Linux if one wants to.

 

another blurb, using SBC (Single board computers) as WiFi hotspot running  open sourced implementations e.g Armbian, OpenWRT etc is 'very significant'.

Well, these days there are dedicated 'mesh' routers, those are likely faster e.g. WiFi 6 etc (cost wise may actually be equal) 
but that running Armbian (etc) means one can literally customize the use including  setting it up as a router / WiFi hotspot and customize the network setup to work around problems that may not be possible on 'standard' consumer box routers.

And in addition running apps, e.g. file server (lan based storage) , web server with apps, stream media, databases (mysql?)  etc  in addition.

 

Link to comment
Share on other sites

8 hours ago, MaxT said:

given both are Linux based, one can rule our HW issue.

 

I wish this would be that simple :) First, all distros are (usually) re-building packages at different time, thus by default bringing different code base. That change can be small (using same main version of kernel) or big (6.1 vs. 6.10 for example). Then. Armbian adds (ATM) 436 general patches to the kernel and we add several 3rd party drivers to the kernel. We actively maintain this kernel, unlike others. Some distributions are using our kernel, while OpenWRT AFAIK not. Which means they use some version of mainline Linux kernel with their own patches. Their focus is networking (protocols), so I would assume they are fixing those things. I doubt they are doing anything related to this hardware (wifi chip) besides adding device tree (if not yet in mainline). Fixing wireless drivers in its core is done by very few people that are not tied to any distribution in particular https://github.com/morrownr/USB-WiFi  https://github.com/kimocoder ... experience will be different, especially in area of this particular hardware.

Link to comment
Share on other sites

Lots of replies here, thanks everyone!

 

I tried specifying the channel, but it didn't help. I also tried 5GHz instead of 2.4GHz "just incase", but that didn't help either.

You can see my config here:

cat /etc/NetworkManager/system-connections/access_point.nmconnection 
[connection]
id=access_point
uuid=4eba9c88-d36f-40bb-a740-a9eeb903ca75
type=wifi
interface-name=wlan0
mdns=2
timestamp=1728918559

[wifi]
band=a
channel=36
mode=ap
ssid=TEST_TEST

[wifi-security]
key-mgmt=wpa-psk
psk=password

[ipv4]
method=shared

[ipv6]
addr-gen-mode=default
method=auto

[proxy]

 

One thing I noticed is that wpa_supplicant is showing UNKNOWN as the key management type which I thought was weird.

sudo wpa_cli status
Selected interface 'wlan0'
bssid=44:fa:6d:94:c1:36
freq=5180
ssid=TEST_TEST
id=0
mode=AP
pairwise_cipher=CCMP+TKIP
group_cipher=TKIP
key_mgmt=UNKNOWN
wpa_state=COMPLETED
ip_address=10.42.0.1
p2p_device_address=46:fa:6d:94:c1:36
address=44:fa:6d:94:c1:36
uuid=82ce0d53-c98a-5bf8-b8a7-89759b194923

 

Haven't had time to try anything else yet

Link to comment
Share on other sites

FWIW, here's the ansible script I use to set up the Orange Pi Zero 2W we use as our home wireless access point running in 5 Ghz (AC) mode.  It is currently on Armbian 24.11 Debian Bookworm using kernel 6.6.54.  This should work on an Orange Pi Zero 3 since it uses the same CPU and wifi chip.   Note I am using systemd-networkd that netplan uses by default in Armbian's minimal/IOT images, not nmcli. 

 

---
- name: Install networking packages
  apt:
    name:
      - hostapd
      - dnsmasq
    state: present

# setup access point
- name: configure dnsmasq
  file:
    src: dnsmasq.conf
    dest: /etc/dnsmasq.conf
    mode: 0644
  tags:
    - dnsmasq

- name: create dnsmasq.service.d directory if non-existent
  file:
    path: /etc/systemd/system/dnsmasq.service.d
    recurse: true
    state: directory
  tags:
    - dnsmasq

- name: copy fix for systemd-resolved conflict
  when: 
    - ansible_facts.services['systemd-networkd.service'] is defined
    - ansible_facts.services['systemd-networkd.service']['status'] == 'enabled'
  copy:
    src: systemd-resolved-fix.conf
    dest: /etc/systemd/system/dnsmasq.service.d/systemd-resolved-fix.conf
    mode: 0644
  tags:
    - dnsmasq

- name: activate dnsmasq service
  command: systemctl enable dnsmasq.service
  tags:
    - dnsmasq

- name: Set up IPv4 forwarding
  ansible.builtin.copy:
    src: routed-ap.conf
    dest: /etc/sysctl.d/10-routed-ap.conf
    mode: 0644

- name: copy hostapd.conf
  file:
    src: hostapd.conf
    dest: /etc/hostapd/hostapd.conf
    mode: 0644
  tags:
    - hostapd

- name: copy hostapd.service
  file:
    src: hostapd.service
    dest: /etc/systemd/system/hostapd.service
    mode: 0644
  tags:
    - hostapd

# hostapd is masked by default after installation
- name: unmask hostapd.service
  command: systemctl unmask hostapd.service
  tags:
    - hostapd

- name: activate hostapd service
  command: systemctl enable hostapd.service
  tags:
    - hostapd

 

Here's the /etc/dnsmasq.conf file:

 

# disables dnsmasq reading any other files like /etc/resolv.conf
# for nameservers
no-resolv
#IGNORE_RESOLVCONF=yes
#DNSMASQ_EXCEPT="lo"
interface=wlan0

log-queries
log-facility=/var/log/dnsmasq.log
addn-hosts=/etc/hosts
no-dhcp-interface=lo
domain-needed
bogus-priv
dhcp-range=10.10.1.50,10.10.1.199,12h
dhcp-option=3,10.10.1.1
server=1.1.1.1

 

The /etc/systemd/system/dnsmasq.service.d/systemd-resolved-fix.conf file mentioned in the script stops systemd-resolved when dnsmasq is started so it doesn't conflict with dnsmasq:

 

[Unit]
After=systemd-resolved.service

[Service]
ExecStartPre=/usr/bin/systemctl stop systemd-resolved.service
ExecStartPost=/usr/bin/systemctl start systemd-resolved.service

 

The /etc/sysctl.d/10-routed-ap.conf file enables iPv4 and IPv6 address forwarding.  This is required since hostapd is running in routed mode, not bridged:

 

# https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md
# Enable IPv4 routing
net.ipv4.ip_forward=1
# Enable IPv6 routing
#net.ipv6.conf.default.forwarding=1

 

The /etc/hostapd/hostapd.conf file, configured for the wifi chips' capabilities:

 

ssid=<YOUR SSID GOES HERE>
interface=wlan0
hw_mode=g
channel=40
driver=nl80211

logger_syslog=0
logger_syslog_level=0
wpa=2
preamble=1
# Wifi Multi-Media support, also required for full speed on 802.11n/ac/ax
wmm_enabled=1

wpa_passphrase=<YOUR PASSWORD GOES HERE>
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0

## IEEE 802.11n
ieee80211n=1
ht_capab=[LDPC][HT40-][HT40+][SHORT-GI-20][SHORT-GI-40][RX-STBC1]
country_code=US
ieee80211d=1
## IEEE 802.11n

## IEEE 802.11a
hw_mode=a
## IEEE 802.11a
  
## IEEE 802.11ac
ieee80211ac=1
vht_capab=[MAX-MPDU-7991][RXLDPC][SHORT-GI-80][SU-BEAMFORMEE][MU-BEAMFORMEE][VHT-TXOP-PS][MAX-A-MPDU-LEN-EXP3]
vht_oper_chwidth=1
vht_oper_centr_freq_seg0_idx=42
## IEEE 802.11ac

# controlling enabled
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0

 

The /etc/systemd/system/hostapd.service file:

 

[Unit]
Description=Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
Documentation=man:hostapd(8)
After=network.target
Before=dnsmasq.service
ConditionFileNotEmpty=/etc/hostapd/hostapd.conf
#Wants=dhcpcd.service
#Before=network.target dhcpcd.service wpa_supplicant.service

[Service]
Type=forking
PIDFile=/run/hostapd.pid
Restart=on-failure
RestartSec=2
Environment=DAEMON_CONF=/etc/hostapd/hostapd.conf
EnvironmentFile=-/etc/default/hostapd
ExecReload=/bin/kill -s HUP $MAINPID
ExecStartPre=/usr/bin/ip link set wlan0 down
ExecStartPre=/usr/bin/ip address flush dev wlan0
ExecStartPre=/usr/bin/ip link set wlan0 up
ExecStartPre=/usr/bin/ip addr add 10.10.1.1/24 dev wlan0
ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid $DAEMON_OPTS $DAEMON_CONF

[Install]
WantedBy=multi-user.target

 

Hope this helps.

Edited by jimg
Link to comment
Share on other sites

I downloaded the latest image which has the same versions as you.

This seemed to get a little bit further. I set it up manually using the exact files above just changing ssid and password as I havent used ansible before and couldn't get it to work.

 

I am able to select the AP and type in the password and it seems to connect. But I get a no Wi-Fi symbol, this is no drama as I only want to be able to talk to the OPi using this hotspot to access a server it hosts. But, when I look at the connection, it doesn't seem to have a router/gateway IP. On my OPi Zero LTS where the hotspot works, I can SSH to the gateway IP (10.42.0.1 by default).

 

Another weird thing the IP that my Mac got after connecting started with 169, I would have expected this to be in the range specified in /etc/dnsmasq.conf (dhcp-range=10.10.1.50,10.10.1.199,12h).

I'm not sure if its just how this specific hotspot is configured but I guess yours works better than this. I dunno why, but I find hostapd and dnsmasq a lot more complicated and harder to understand.

 

But I wonder, because this hotspot seemed to accept a password and my Mac showed it as WPA2/WPA3, is it just an option that needs to be set for the nmcli hotspot. Because without a password it works perfectly like I expect and I can SSH to the gateway IP etc etc.

 

I also tried my own nmcli commands on the new image "just incase" but no luck.

Link to comment
Share on other sites

if this is based on hostapd try 

journalctl -u hostapd

to check the connect logs, normally successful connection attempts is quite 'intuitive' e.g. that there is normally a WPA / authentication related message

 

other things that possibly matters include 

  • ip address, that should be provided by dhcp (e.g. dnsmasq)
  • dns server, i think some os (e.g. android at least) tries to connect to some internet web sites (google?) and complains that there is no internet if is not accessible.
    if there is after all no internet, you may need to run a dns to resolve the ap itself if you are accessing it via domain names.
    For accessing the host itself, i'm not too sure if dnsmasq can work as dns and resolve its own domain. Otherwise, accessing the host would likely need to be based on ip address.
    alternatively, I'd think  install and configure avahi (MDNS) which may help to resolve the ap itself as host.local (e.g. orangepizero3.local)
  • interfaces and routing, we normally assume that it is configured and working? but nevertheless it may help to check e.g.
    ip link
    ip -4 add
    ip route

     

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines