Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4873

Troubleshooting • Re: Pi Zero unable to connect to a Pi 5 access point

$
0
0
It works. It's not pretty, but I have an open access point running.

But first, I decided to try with a Raspberry Pi 4 I had. Same results. Then I tested hostapd. Same results. It meant something's wrong on the Pi Zero at a low level, the hardware, or the driver, or, well, something else. Ok let's find a workaround. In hostapd.conf, there is a directive named auth_algs, and I set it to 0 so that no auth is necessary. Should work, right?

Code:

carousel:~# hostapd /etc/hostapd/hostapd.confLine 4: no authentication algorithms allowed1 errors found in configuration file '/etc/hostapd/hostapd.conf'Failed to set up interface with /etc/hostapd/hostapd.confFailed to initialize interface
I was flabbergasted. I couldn't create a working open access point. It was forbidden. I was sad. Then I got angry.
Then, wait, this is open source. I can have a look and see what can be done. As a normal user:

Code:

apt-get source hostapd
Going in the wpa-2.10/src directory it created, I launched "make", but nothing seemed to be generated. That's because .o files live in another directory. Also, after much fumbling, it appears that you need to define CONFIG_WEP so that the related #ifdef directives get compiled (the comments indicate it could be removed in the future). In the wpa-2.10/hostapd subdirectory. "make" wants a .config:

Code:

cp defconfig .config
Uncommenting CONFIG_WEP=1, typing "make", getting errors about missing dev libraries:

Code:

sudo apt-get install libssl-dev libnl-genl-3-dev
I have an executable.

Code:

sudo ./hostapd /etc/hostapd/hostapd.conf
And I have a script to test it on the Pi Zero, testapd.sh. The "sleep 1" lines seem necessary for the dust to settle, because sometimes the Pi Zero can't find the hotspot if there's no delay between these instructions. The "sleep 60" at the end allows me to ping the Zero from the Pi 5, thus proving the machines are communicating properly.

Code:

#!/bin/bashifconfig wlan0 10.42.0.2 netmask 255.255.255.0sleep 1nmcli d wifi rescansleep 1nmcli d wifi con "Carousel"echonmcli d wifi listechoroute echoping -c 1 10.42.0.1echosleep 60ifconfig wlan0 192.168.1.172nmcli d wifi con XXX_XXXX password xxxxxxxxxxx
You run it as root in the background, so that when the ssh connection stops because it switches to another AP, it keeps logging everything, stdout and stderr, in testhostapd.log.

Code:

./testhostapd.sh &> testhostapd.log &
Aaaaand…

Code:

Device 'wlan0' successfully activated with '4e0366dd-5ebc-4086-9f3b-5644ccf8e579'.IN-USE  BSSID              SSID                      MODE   CHAN  RATE        SIGNAL  BARS  SECURITY            xx:xx:xx:xx:xx:xx  XXXXXXX-XXXX              Infra  1     195 Mbit/s  89      ▂▄▆█  WPA2                xx:xx:xx:xx:xx:xx  XXX_XXXX                  Infra  1     130 Mbit/s  75      ▂▄▆_  WPA1 WPA2           xx:xx:xx:xx:xx:xx  XXXXXXXX_XXXXXX           Infra  1     195 Mbit/s  64      ▂▄▆_  WPA2 802.1X         xx:xx:xx:xx:xx:xx  XXXXXXX                   Infra  1     195 Mbit/s  59      ▂▄▆_  WPA1 WPA2   *       2C:CF:67:05:80:A9  Carousel                  Infra  6     65 Mbit/s   39      ▂▄__  --                  xx:xx:xx:xx:xx:xx  XXX_XXXX                  Infra  6     260 Mbit/s  25      ▂___  WPA1 WPA2   Kernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface10.42.0.0       0.0.0.0         255.255.255.0   U     600    0        0 wlan0PING 10.42.0.1 (10.42.0.1) 56(84) bytes of data.64 bytes from 10.42.0.1: icmp_seq=1 ttl=64 time=24.9 ms--- 10.42.0.1 ping statistics ---1 packets transmitted, 1 received, 0% packet loss, time 0msrtt min/avg/max/mdev = 24.940/24.940/24.940/0.000 msDevice 'wlan0' successfully activated with '8ae8775c-2bb3-440a-9453-9488063c078a'.
See the SECURITY column. That's why I can connect without a password. It suits me for my application but, kids, don't try this at home.

Conclusion: all hail Open Source Software.

Statistics: Posted by jzu — Sun Nov 10, 2024 3:46 pm



Viewing all articles
Browse latest Browse all 4873

Trending Articles