3

Admittedly, I'm torn between posting this in SuperUser or ServerFault, so opinions of where this should go are welcome.

I have a hotspot set up on my Raspberry Pi 4, running Raspian. I used hostapd to set it up, following the guide from the Pi Foundation's website as I hadn't done anything like that before.

The network technically works, and if I get another device to connect fast enough, it accepts the Passphrase and connects, however every few minutes the connected devices all disconnect, and if I try to reconnect with the saved passphrase on them, I get a "Incorrect Passphrase" error. If I delete the saved network record on any given device, it connects with the same passphrase, and then disconnects a short while later again.

I thought it could be signal strength, but running NetSpot on a Notebook even further away from the Pi shows great signal strength.

Then I noticed something in Netspot. The network was suddenly listed a second time, and the first listing showed as no longer being in range. The only difference I could find: the second network had a different BSSID. The longer I left Netspot scanning, the more copies of the network turn up with new BSSIDs, and the previous networks show as out of range.

I tried setting the BSSID explicitly in my hostapd config, which makes it take longer the change BSSID the first time, but after that first change, it goes back to the 2-3 minute frequency.

I am honestly out of my depth here at this point, I typically just work on Ethernet networks (I have a well wired home so beyond my router's network for my phone, why wouldn't I go wired?).

Any pointers to find the cause would be amazing. I'm generally pretty comfortable with the Bash terminal.

(Why a wifi hotspot I hear you ask, since there is a working router here anyway? The Pi is running my HomeAssistant instance, and I want to pop smart home devices I don't trust to be connected to the internet on the Pi's hotspot and have HomeAssistant control them, such as my aircon, that does not use TLS for it's commands and sends the login username and password in plaintext back and forward on every command, and my TV, which allows app remote control that is better than the physical remote, but is unlikely ever to get a security update because, well, smart TVs)

hostapd.conf:

driver=nl80211
ssid=AtextSSID
bssid=TheMACAddressOfMyPi'sWifiInterface
hw_mode=g
channel=11
ieee80211n=1
wmm_enabled=0
macaddr_acl=1
accept_mac_file=/etc/hostapd/hostapd.accept
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=AnAcceptablePassphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

My hostapd.accept file just has the MAC addresses of all the devices I intend to connect to it, each on it's own line, with no spaces or commas. Turning off the MAC ACL option and removing the accept file line does not change the network behaviour.

(There is at least one person in my apartment building who will playfully mess with you if you stuff up the security of your wifi network, so MAC address filtering seemed sensible since it will be rather rare that new devices will be added to the network, and they will never just be once off connections)

Edit 1: Screenshot of Netspot's network list, after running the networks for 7 minutes

Screenshot of Netspot's network list, after running the networks for 7 minutes. The greyed out networks are no longer detected.

Signal to Noise ratio graph

So I was slightly wrong, the first "network" BSSID stays up for 60 seconds after the second one appears, and then shuts down, like clockwork.

This is synced with the time, interestingly. Here I started hostapd at 12:17, the second BSSID appears at 12:29, and the first disappears at 12:30. For a sanity check, I waited through 12:35, and put a clock up with seconds just to check. At exactly 12:34, BSSID 3 appears, and at exactly 12:35 BSSID 2 disappears.

I'm sitting watching hostapd's logs and the system log now, will post anything that seems related

Edit 2: Well this timing seems less exact in the logs: Pastebin

Seems to be change being actioned by NetworkManager. Any idea how I track down what is telling it to do that?

5
  • the BSSID is the MAC address of the access point - the fact that it's "changing" means you're probably the victim of the person in my apartment building who will playfully mess with you - probably setting up an access point using your SSID - hence the different BSSID, since the MAC address is unlikely to spontaneously change on your pi Mar 18, 2020 at 22:50
  • doesn't sound playful, sounds malicious - to see how easy it is - null-byte.wonderhowto.com/how-to/… and instructables.com/id/… make for interesting reading Mar 18, 2020 at 22:57
  • Do you have a wired (eth0) uplink to your internet router? If so, do have it bridged? Are you sure that the other hotspots with different BSSID from the RasPi? Or may it be possible that there is another device on the air that is "fighting" against your RasPi?
    – Ingo
    Mar 19, 2020 at 13:56
  • @JaromandaX, I don't think it is them, since me shutting down hostapd makes the networks disappear instantly. There is also only one at a time, as soon as a new one appears, the previous one disappears. I'll get a screenshot of netspot to further outline this. Also, their Modus Operandi is usually to change name of your network, or poison your local DNS to redirect everything to a file they leave with instructions how to fix whatever security hole they found. Hence describing it as "playful". Mar 22, 2020 at 1:21
  • @Ingo, There is a eth0 connection on the pi that leads to my primary router (and on to my modem). The connection is not bridged, since I only intend for the pi to be able to talk to the devices on this hotspot, but nothing else. I'm pretty sure it's just the Pi, see my first comment for reasoning Mar 22, 2020 at 1:23

1 Answer 1

2

It is hard to get an idea what's wrong, with the information we get only step by step reading between the lines. You are using a HomeAssistent we still not know what it is. You have a wired uplink to your internet router but no bridge on the RasPi. There is also an access point running. It seems you are using NetworkManager. This all is far away from a default network setup that is known to work out of the box. As far as I see you are mixing up four network setups:

  1. default Raspbian settings with dhcpcd
  2. hostapd and dnsmasq for the access point
  3. NetworkManager
  4. networking of the HomeAssistent

This cannot work. NetworkManager isn't supported by Raspbian and known on this site to make a lot of trouble. It seems that it is fighting against the access point setup. Maybe it is used by the HomeAssistent? First try to make your RasPi running without the HomeAssistent and without NetworkManager. Then you should decide what network environment to use. Using NetworkManager is the worst decision. If you cannot get the HomeAssistent to work with the selected network environment because it occupy networking without alternative you may consider to use another RasPi for it, or use a more flexible HomeAssistent.

3
  • I honestly did not know NetworkManager was not a default part of Raspian, sorry! The only other Pi I have here is running with Wifi completely disabled so I've never had any reason to look through what's there. I'll see if I can remove NetworkManager, but the only software I've installed on the Pi is HomeAssistant (that I recall, it was a while ago), which runs in Docker, so I assume the NetworkManager software is part of that whole package. Once I confirm that, I'll see if anyone on their forums has been able to do the same thing Mar 27, 2020 at 1:00
  • 1
    If you're interested, HomeAssistant is a Open Source Home Automation Platform, designed to tie all the varied different platforms together to centralise control of it all in one place. It can also re-publish everything connected to it for use by Alexa, HomeKit, Google Home and a few others. You can check it out at home-assistant.io, there's lots of inclusions. That's why I really want to get this "hotspot" working from this Pi specifically, since the goal is to connect some devices to it, without giving them a way to the internet or vice versa Mar 27, 2020 at 1:05
  • So, now knowing where to look for an answer, I found community.home-assistant.io/t/rpi-4-installation/123514/117, which mentions in passing a "Mac Address Change Fix" for NetworkManager. Apparently a while back NetworkManager started cycling through random Mac Addresses as a privacy measure, like iOS8+, but it doesn't play well for all devices. Fortunately, it's just two lines of config to disable. Thanks for everyone's help! Mar 27, 2020 at 2:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.