Raspberry Pi Max WIFI Clients Bug

Hi @Techncat - I’m going to continue the conversation here so we can have a separate post about this issue.

There are various sources on the connected clients issue and I believe this is a limitation of the driver itself from Broadcom. This is something the Raspberry Pi foundation don’t seem to have access to for a fix. You’ve probably already seen these as you mentioned using a USB adapter, but there are more official discussions at

Raspberry Pi Foundation’s Linux repo

Supposedly the leading theory is that security patches take up more ram on the chip itself and that they can’t store more mac addresses. That seems a bit ridiculous if true. If you read through there, there is one suggestion about copying an old file from a previous version to the latest build. It may be worth taking a look at that.

If you get an adapter I can help you with it. I will say that 12 devices is probably around where the Raspberry Pi traditionally maxes out and 9 is not that bad when doing video streaming on each.

Hi @jamesk - I would really apperciate any help you can provide. I bought a TPLink TL-WN725N USB adapter yesterday that has a RTL8188EUS driver which also supports AP mode.

I am hoping that by adding a dongle to the RPi instead of using its internal WiFi we can increase the number of WiFi clients. This should also allow us to upgrade our servers with the lower cost SSDs now available in the M.2 format plus a $8 SATA to USB 3.0 adapter.and provide a very significant speed advantage for the multiple students using tablets…

Unfortunately, the RPi 4B’s USB 3.0 bus also causes interference with its onboard 2.4GHz WiFi band making it unusable in our case.I have been forced to use 5Ghz band to make it work instead, this is incompatible with the older tablets and smartphones already in use in Uganda

Thanks for your help in this matter!

Hi @Techncat - I’ll start by saying that the best solution is to use the Raspberry Pi with a dedicated WIFI router. I believe others who use RACHEL-Pi have started using cheap WIFI routers to solve these issues as well. The RACHEL-Plus was developed to solve a lot of these problems and I’m not sure that we’ll be able to fix everything for the Pi.

Can you plug the USB Wifi dongle in and get me the output of an “ifconfig” command as well as an “lsmod” command. This will tell me if the interface is even seen at boot. It may have to be enabled if not.

“isconfig” for the TP-Link dongle:
wlan1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether e4:5f:01:39:37:d7 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 67 bytes 9716 (9.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

pi@rachel:~ $ lsmod
Module Size Used by
fuse 126976 3
xt_MASQUERADE 16384 1
iptable_nat 16384 1
nf_nat 49152 2 xt_MASQUERADE,iptable_nat
xt_state 16384 0
xt_conntrack 16384 1
nf_conntrack 139264 4 xt_state,xt_MASQUERADE,xt_conntrack,nf_nat
nf_defrag_ipv6 20480 1 nf_conntrack
nf_defrag_ipv4 16384 1 nf_conntrack
iptable_filter 16384 1
8021q 32768 0
garp 16384 1 8021q
stp 16384 1 garp
llc 16384 2 garp,stp
v3d 73728 1
gpu_sched 45056 1 v3d
8188eu 1187840 0
brcmfmac 327680 0
joydev 20480 0
brcmutil 20480 1 brcmfmac
sg 28672 0
vc4 270336 2
sha256_generic 16384 0
cec 49152 1 vc4
cfg80211 761856 2 brcmfmac,8188eu
drm_kms_helper 241664 4 vc4
rfkill 32768 3 cfg80211
raspberrypi_hwmon 16384 0
bcm2835_codec 40960 0
bcm2835_isp 32768 0
bcm2835_v4l2 40960 0
drm 520192 7 v3d,vc4,gpu_sched,drm_kms_helper
videobuf2_vmalloc 16384 1 bcm2835_v4l2
v4l2_mem2mem 36864 1 bcm2835_codec
bcm2835_mmal_vchiq 28672 3 bcm2835_isp,bcm2835_codec,bcm2835_v4l2
videobuf2_dma_contig 20480 2 bcm2835_isp,bcm2835_codec
videobuf2_memops 16384 2 videobuf2_dma_contig,videobuf2_vmalloc
videobuf2_v4l2 32768 4 bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem
videobuf2_common 61440 5 bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
drm_panel_orientation_quirks 16384 1 drm
videodev 249856 6 bcm2835_isp,bcm2835_codec,videobuf2_common,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
mc 45056 6 bcm2835_isp,bcm2835_codec,videobuf2_common,videodev,v4l2_mem2mem,videobuf2_v4l2
vc_sm_cma 32768 2 bcm2835_isp,bcm2835_mmal_vchiq
snd_soc_core 225280 1 vc4
snd_compress 20480 1 snd_soc_core
snd_pcm_dmaengine 16384 1 snd_soc_core
snd_pcm 110592 3 snd_compress,snd_pcm_dmaengine,snd_soc_core
rpivid_mem 16384 0
snd_timer 32768 1 snd_pcm
snd 77824 4 snd_compress,snd_timer,snd_soc_core,snd_pcm
syscopyarea 16384 1 drm_kms_helper
sysfillrect 16384 1 drm_kms_helper
sysimgblt 16384 1 drm_kms_helper
fb_sys_fops 16384 1 drm_kms_helper
backlight 20480 1 drm
uio_pdrv_genirq 16384 0
uio 20480 1 uio_pdrv_genirq
nvmem_rmem 16384 0
ip_tables 28672 2 iptable_filter,iptable_nat
x_tables 32768 5 xt_state,ip_tables,iptable_filter,xt_MASQUERADE,xt_conntrack
ipv6 495616 53

internal WiFi:
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.10.10.10 netmask 255.255.255.0 broadcast 10.10.10.255
inet6 fe80::42fe:691a:c4a4:4fa prefixlen 64 scopeid 0x20
ether 98:48:27:e1:7e:38 txqueuelen 1000 (Ethernet)
RX packets 1103 bytes 350927 (342.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 836 bytes 315560 (308.1 KiB)
TX errors 0 dropped 21 overruns 0 carrier 0 collisions 0

Alright so these are steps I think will get you going.

  • Disable the onboard wifi

    Add “dtoverlay=disable-wifi” to /boot/config.txt

  • Disable the onboard bluetooth ( optional )

    Add “dtoverlay=disable-bt” to /boot/config.txt

Reboot. If the USB adapter became wlan0, everything should work. If not, we may need to make more changes.

I appreciate your assistance and I will be attempting this tomorrow. Today, I am demonstrating the new SSD version of the RPi server to other members of our group for future deployment at schools.

Thanks!

1 Like

My pleasure. Good luck with the demonstration!

It’s working! I followed your steps above and disabled the onboard WiFi. I then plugged in the external dongle, but after reboot hostapd.service was unable to authenticate the dongle because of a missing driver.

I then made the following changes using the following instructions that I found online, which first located the missing driver and then installed it automatically:

pi@rachel:~$ sudo wget http://downloads.fars-robotics.net/wifi-drivers install-wifi -O /usr/bin/install-wifi
pi@rachel:~ $ sudo chmod +x /usr/bin/install-wifi
pi@rachel:~ $ sudo install-wifi

After a reboot I verified that the Pi’s SSID was being broadcast and I was then able to stream the Kolibri videos on nine devices simultaneously without any dropouts.

Many thanks - I am very grateful for your guidance!

1 Like

Great news! Thanks for documenting the steps in case anyone else wants to try this.

Hi @Techncat - We’ve moved our forums so your last comment is missing but I did see it.

First I thought I’d mention that it’s possible to reduce interference on 2.4ghz by using the USB 2.0 port instead of the 3.0 if it doesn’t hinder your 5GHZ performance.

There are a few files you will need to edit to have dual hotspots running with the Pi.

  • /etc/dnsmasq.conf will need an added range. The current file looks like this

    interface=wlan0
      dhcp-range=10.10.10.100,10.10.10.199,255.255.255.0,24h
    

    You will need to make that something like

    interface=wlan0
      dhcp-range=10.10.10.100,10.10.10.199,255.255.255.0,24h
    
    interface=wlan1
      dhcp-range=11.11.11.100,11.11.11.199,255.255.255.0,24h
    

    While you’re there you can add new “rachel.pi” addresses for 11.11.11.11 if you want. It looks like this right now

    address=/www.rachel/10.10.10.10
    address=/rachel.pi/10.10.10.10
    

    Then save all of those changes.

  • You will need to duplicate the hostapd.conf file in /etc/hostapd/hostapd.conf and make one the 2G file, and another the 5G file. This is to ensure it uses separate interfaces instead of trying to do dualband on the one. These are the contents of the current /etc/hostapd/hostapd.conf

    interface=wlan0
    driver=nl80211
    ssid=RACHEL-Pi
    hw_mode=g
    channel=1
    auth_algs=1
    wmm_enabled=0
    

    For the 5G file, you would switch interface=wlan0 to interface=wlan1, and the 5G file will need to be in a 5GHZ configuration. There are a lot of examples on this, and it also depends if you want encryption. This post has an example in it that might help.You will need to change the channel and hw)mode for sure. Let me know if you run into any errors with this. You can check errors with “sudo systemctl status hostapd”.

  • Finally, you will have to enable both hostapd configuration files. The best way to do that is by following the answer on this post. so that you can interact with them as separate services.

Please let me know how it goes!

Many thanks for your response. Before attempting your instructions, and probably messing things up :frowning: , I have the following questions:

  • When I modify /etc/dnsmasq.conf, should I add two additional lines after the existing rachel.pi addresses as follows?
    address=/www.rachel/11.11.11.11
    address=/rachel.pi/11.11.11.11

  • I can see how to create two separate hostapd.conf files. In my case:
    “hostapd.wlan0.conf” file with “hw_mode=a” and “channel=36” for the Pi
    and
    “hostapd.wlan1.conf” file with “hw_mode=g” and “channel=1” for the dongle…
    but I got really lost with the sequence of following steps for enabllng the two hostapd files in the second post, i.e.,

  • revert to default settings everywhere and disable and stop hostapd.service

  • rename your configurations to accommodate an unmodified hostapd instanced service which expects with %i.conf only the interface name followed by .conf:

    mv -i /etd/hostapd/hostapd.wlan0.conf /etd/hostapd/wlan0.conf
    mv -i /etd/hostapd/hostapd.wlan1.conf /etd/hostapd/wlan1.conf

  • use the instanced version of the hostapd service, distinguished by the @ character and which is configured differently from the normal instance as already written in OP. Once per interface:

    systemctl enable --now hostapd@wlan0
    systemctl enable --now hostapd@wlan1

How do I use the two instances of “mv -i /etd/hostapad/ …”?
I’m not sure how all this has to come together.
I will be very grateful for clarification!
Thanks again

Hi @Techncat - I’ll try to answer your points. I can’t test here as I don’t have a 5ghz capable wifi dongle that works with the Pi, but I’ll try to explain.

  • The address= lines in dnsmasq.conf will map the IP address to the name. I’m actually not 100% sure if it allows duplicates for multiple IP addresses, but I think what you’ve got there should work. You can change “www.rachel” or “rachel.pi” to another address for people to get to RACHEL on the 5G if it doesn’t duplicates.

  • For the %i.conf part, that just means to name your files based on the interface and not with “hostapd.” first. So for the pi, just make two files with these names

    /etc/hostapd/wlan0.conf
    /etc/hostapd/wlan1.conf
    

    wlan0 should become your 2.4G interface when you have both plugged in, and wlan1 will be your 5G interface. “/etd” was a typo by the comment author. It should be “/etc/”.

  • Stop and disable the normal hostapd service with

    sudo systemctl stop hostapd
    sudo systemctl disable hostapd
    
  • Now you need to enable the “instanced” version of hostapd. This means that it will start a version of hostapd per interface. So one for wlan0 and one for wlan1.

    systemctl enable --now hostapd@wlan0
    systemctl enable --now hostapd@wlan1
    

    Now if everything worked, you should have two hostapd services running, hostapd@wlan0, and hostapd@wlan1. You can use the “systemctl” command to start/stop/restart/disable/status command with them. The first command you will want to run is status to make sure everything went okay

    sudo systemctl status hostapd@wlan0
    sudo systemctl status hostapd@wlan1
    

If everything is working, you may then need to set these services to run at boot/by default. This gets a little more complicated if you want to check if the interface is there. Let me know if everything worked up until this point :slight_smile:

Hi @jamesk ,
Well, both services show as running and see both WiFi’s on my tablet, but I can only connect to ip address 10.10.10.199, the other ip 11.11.11.199 doesn’t connect. Perhaps I wasn’t clear, I only have one 2.4GHz TP-Link dongle, I want to use the Pi’s 5GHz internal WiFi as my second AP.

When I swap the 5g and 2g around between the two files, I can connect to one or the other , but not both - It gives me a “Failed to obtain IP address” on my tablet.

Also, I don’t see the correct SSID on the one that works, but the old SSID being used instead, it’s one I used before I started playing around - seems like an old copy of hostapd is still being referenced somehow. BTW, I disabled the original hostapd.conf.
Also, /usr/lib/systemd/system/hostapd.service still has the following lines:
Environment=DAEMON_CONF=/etc/hostapd/hostapd.conf
EnvironmentFile=-/etc/default/hostapd
ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF}

I suspect I must have gorked things up wile playing around earlier. I saved a copy of my previous image before I started and I will start from scratch tomorrow :face_with_hand_over_mouth:

@Techncat - Ah okay I thought it was the other way around. The Pi as 5GHz should still be wlan0 so you’ll just need to swap that in the files. $DAEMON_OPTS shouldn’t have anything in it with a default RACHEL-Pi install.

Failed to obtain IP address is likely the dnsmasq settings. Try running these command to reload any changes

sudo systemctl daemon-reload
sudo systemctl restart dnsmasq

Once connected your device should have an IP address in the range of the interface you’re connected to. You’d want to connect to http://10.10.10.10 or http://11.11.11.11, not .199. You probably wouldn’t see anything on any .199.

My guess is that the pi with 5GZ is going to be a little bit of work to get going with the hostapd.conf settings. It can be really picky.

Thanks for the tips. I will try from scratch tomorrow.
Not sure why you say that the Pi 4 is “picky” on 5GHz. I had been using the Pi on 5Ghz for a while now for demos and testing with the old hostapd.conf and the SSD connected to the USB 3.0 port. It worked consistently without dropouts while streaming Kolibri to 9 tablets.

BTW, using the USB 3.0 ports with the SSD gives us a 5x speed advantage when running benchmark tests compared to the Samsung SD card.

1 Like

You’re welcome. Happy to help.

It’s the hostapd.conf settings that can be picky. That sounds right about the SSD. The SD card is a major bottleneck that hopefully we can finally do away with. There are rumours we might get Sata with the next Pi :slight_smile:

Hopefully it all works out tomorrow.

Hi @jamesk,
I started with an original copy of RACHEL Pi today -I set wlan0.conf to 5G and wlan1.conf to 2.4G. I can see both signals on a WiFi analyzer app and connect immediately to wlan0 and stream videos. Unfortunately, every attempt to connect to wlan1 times out and fails with “failed to obtain IP”.
I can change wlan0 to 2G, and the dongle works fine.
systemctl status for either wlan has no errors
also did the systemctl daemon-reload and systemctl restart dnmasq before starting out.

Could my dnsmasq.conf settings be wrong?
1:
address=/www.rachel/10.10.10.10
address=/rachel.pi/10.10.10.10

address=/www.rachel/11.11.11.11
address=/rachel.pi/11.11.11.11
2:
interface=wlan0
dhcp-range=10.10.10.100,10.10.10.199,255.255.255.0,24h

interface=wlan1
dhcp-range=11.11.11.100,11.11.11.199,255.255.255.0,24h