Raspberry Pi® Logo
Valid Generic HTML
SPDX-License-Identifier
CC-BY-SA-4.0

Raspberry Pi 4B
Wi-Fi

Jim Carter, 2023-08-17

I have multiple issues with my Wi-Fi access point:

Here is a list of the NICs I'm working with:

Nbr Brand Firmware MAC Address
0 Terow AC-1200Mbps Mediatek 00:13:ef:5f:0c:3c
1 Alfa AWUS036ACM Mediatek 00:c0:ca:b0:60:4b
2 Cudy WU1400AC Realtek b4:4b:d6:27:de:88
3 Alfa-rt AC1200 Realtek 00:c0:ca:a8:4c:7e
4 Intel 3168NGW Intel 60:f6:77:76:21:63
6 TP-Link TL-QN722N Atheros 90:f6:52:08:c8:4b
7 Za-pai Ralink 00:e1:80:67:84:34

1-letter codes for AP hosts, NICs and places:

In prior unsuccessfui attempts to make a range extender, I got into packet storms that caused uninvolved Wi-Fi packets to be collided with or otherwise forced off the aether. The code word packetvore denotes an episode of very high loss of Wi-Fi packets.

First Successful Deployment

Summary:

Discussion: All combinations of host and NIC are capable of running for long periods with high quality Wi-Fi. All but one combination suffered packetvore attacks or major glitches. It is definitely not true that one or the other NIC fails consistently (both seem similar), and the same for the two hosts. Patterns of packet loss vary from day to day, or even hour to hour. I would be very inclined to attribute the problems to malign outside influences, except that neighbors' beacons are all under -75dBm, way below local levels, and it's plausible that the neighbors' stations have similar power, far from enough to disrupt local communication.

Conclusion: The H/A/J combination has been trouble-free for a week, cross fingers. By abandoning the range extender configuration and using wired Ethernet for all APs, I think I'm now on the right track.

Second Improved Deployment

The Packetvore is Back!

I received and installed the new Alfa AWUS036ACM NICs, replacing the Terow AC-1200 and the Za-Pai. No problems during or after installation, except…

Before and after installing the new Alfa NICs, I had a small number of packetvore attacks, i.e. high packet loss rates, in some cases belived to be less than 100%, but sometimes I'm pretty sure it's 100%, which lasted several minutes at least. When the station was induced to connect to a different AP, it communicated normally, and the AP returned to normal function (but I don't know how long that took).

I'm trying to gather information about what's happening. The first job is to set up a test station connecting to each AP, and I'll use the AP hosts themselves: Beaver → Holly → Piki → Beaver, sending from their onboard NICs, all rad9. /etc/sysconfig/network/ifcfg-rad9 contains: (replacing value keywords with their numeric values)

STARTMODE='auto'
BOOTPROTO='static'
IPADDR='my fixed IPv4 adr/nbr of bits'
IPADDR_0='my fixed IPv6 adr/nbr of bits'
WIRELESS_ESSID='CouchNet'
WIRELESS_WPA_PSK='WouldntYouLikeToKnow'
WIRELESS_AP='MAC adr of AP NIC on the target' 

Since a route with more bits is preferred, a host (maximum length) route /etc/sysconfig/network/routes-rad9 contains:

# Dest			Via     NMask   Ifc     Options
Target Wi-Fi IPv4 adr/32	-       -       -
Target Wi-Fi IPv6 adr/128	-       -       - 

No special routes on the target. The station

Range Extender (Failed)

A Wi-Fi range extender includes an access point, which other stations connect to, plus a client (station) that can forward traffic between the connecting stations and some other AP, usually the main Wi-Fi router. I wanted to junk the commercial range extender, TP-Link AC750 Wi-Fi Range Extender model RE220, and replace it with my own Raspberry Pi 3B. But packet loops (code name: packetvore) are easy to create and hard to diagnose and mitigate, and I eventually abandoned the range extender project, switching to standalone APs on the LAN via wired Ethernet.

  • So this is a long collection of notes about work on the range extender which happened before the two successful deployments described previously. It has not been edited very much for comprehensibility, except for a few section headings; it is preserved because methods and data may be useful in the future for something. People whose interest is in the working deployments can stop reading here.

    Range Extender Basic Design

    This design produces a working range extender, except for the minor detail of packetvore attacks at random intervals.

    Non-Beacon Mode

    The first problem I encountered was, on NICs #2, 3 and 6, hostapd starts up, puts the NIC in the bridge, claims to have turned on AP mode, but WiFi Analyzer for Android doesn't report any beacons for that NIC (it has a debug SSID so is distinguishable), and you can't associate with it. Message: hostapd.J[13688]: rad0: AP-ENABLED. This is the normal message for successfully starting up hostapd. Google searches for my symptom reveal nothing.

    Summary of iw list for various NICs as seen on Beaver:

    I had trouble to get several NICs to act as APs on Piki, so I tried them on Beaver. Outcomes:

    I added to generic.incl: beacon_int=100; start_disabled=0
    Empirically, start_disabled=1 makes the Terow not send beacons; 0 lets it send them. The Cudy still doesn't send them in either case.

    Learning to use hostapd_cli: Only useful-looking commands are shown.

    hostapd_cli on Cudy: It is not putting out any beacons.

    Tidbit on a forum:
    Raspberry Pi 4 hostapd hotspot not visible, OP CybeX, 2019-11-21. Options to produce debug output:
    /usr/sbin/hostapd /etc/hostapd/hostapd.conf -dd | tee /tmp/hostapd.log
    It looks like his issue wasn't missing beacons, it was a screwed up DHCP server. For reference, my symptom is, my AP doesn't appear in the list of selectable SSIDs in Android 12 or NetworkManager, and my AP doesn't show up in WiFi Analyzer (Android). The OP actually reports symptoms matching mine but described with less detail, and I don't see a DHCP issue in his initial report, though he says he solved his problem by disabling dhcpcd.

    From another forum post: maybe rfkill didn't un-kill it. rfkill list reports that all phy's plus Bluetooth are not soft/hard blocked. For the identifier it wants the number in the list (not the phy name nor the interface name). But rfkill unblock 9 didn't start the beacons.

    Running hostapd with the -dd option (debug output), see command line above. What I found:

    Repeating the above with Terow (with beacons) and comparing:

    Digging through /usr/share/doc/packages/hostapd/hostapd.conf, annotated config file with default or recommended values for every parameter, and extracting everything mentioning beacons. Keywords beginning with # are defaults that normally would not be set explicitly. Many items described here as adding some element to the beacon frame, also add it to the Probe Response frame.

    With start_disabled=1 the NIC will start with no beacons (our symptom), so there must be a command to start the beacons. The only commands for hostapd_cli that mention beacon in the help are update_beacon (update the content of the beacon frame), and req_beacon (send a Beacon report request to a station). I wonder if you're supposed to just change the value to start_disabled=0? The command line would be:
    hostapd_cli [-i $interface] set start_disabled 0

    Steps in testing the above:

    Searching in the source code of hostapd-2.10 .

    But I got a hint somewhere: iw may be my friend, specifically iw dev $IFC ap start (or stop). No, it gives a usage message. Looks like missing options.

    After considerable struggle I junked the Cudy and Alfa-1200 because the drivers are out of kernel, and I found the Za-Pai Ralink NIC, which has an in-kernel driver and which emits beacons as it should; tested on Beaver.

    Packetvore Attacks!

    Now bringing up the Za-Pai up on Piki.

    What could be causing Piki's onboard NIC to trash 97% of its own packets? What I've learned so far:

    This morning I switched Selen (cellphone) to Beaver and went through a lot of links. Most but not all delivered the pages (one timed out), but definitely slowly compared to Holly. Let's do tests where Selen (Wi-Fi to Beaver) plays the videos that yesterday were being downloaded to Xena by curl. What packets does Beaver see?

    Subsequent testing:

    Progress and Testing in Semi Production

    The Side Sewer

    Deploying Piki

    Three days later:

    Collecting info and planning how to gather more info about what's wrong.

    Raspberry Pi® Logo
    Photo and Image Credit