himilou
Posts: 3
Joined: Thu Oct 14, 2021 1:40 am

Pi 3B+ as Wireless Access Point. After client disconnect no other clients can connect \ reconnect

Thu Oct 14, 2021 1:54 am

I have my Pi configured ( hopefully correctly ) to act as a wireless access point. On boot the Pi accepts connections as expected. I can connect from Android phone, kindle tablet, and windows. After any of these clients disconnects, usually due to the client entering a power save state or in some cases reconnecting to another WPA because the Pi has no internet access, Clients can no longer connect until the pi is rebooted.

The distance between the pi and the clients is very small at this time, less than 3 feet and there is not an unusual amount of wireless activity going on. ( house in suburban neighborhood )

I have tried changing various hostapd settings such as channel and radio type ( a/g/n ) and tried setting the radio channel to auto configure through scanning with the same results.
I have also set the radio power managent to off with a command in rc.local

Below are the current config files as well as systemctl status output from 3 different stages, after boot, after first client connects and when the pi is no longer accepting connections.

This is a new install of raspbian lite ( no GUI )

I am using 3 different clients, Windows, Android phone, and a Kindle. The Kindle knows of no other access points . Windows and the phone have other standard wi fi access points within range. The issue seems to start after Windows or the phone connect and then after realizing their is no internet connection disconnect from the PI and switch back to their other access points. The kindle does not try and switch and doe s not seem to trigger this behavior.

**Configuration files**

-------------------------------------
/etc/hostapd/hostapd.conf
-------------------------------------

Code: Select all

country_code=US
interface=wlan0
driver=nl80211
hw_mode=g
ignore_broadcast_ssid=0
channel=8
wmm_enabled=0
#acs_num_scans=5
macaddr_acl=0
auth_algs=3
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ssid=yournamehere
wpa_passphrase=abcd
--------------------------
/etc/network/interfaces
-------------------------

Code: Select all

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
-------------------------------------
/etc/dhcpcd.conf
-------------------------------------

Code: Select all

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

#config for wireless access point
interface wlan0
metric 400
static ip_address=10.0.0.1/24
static routers=10.0.0.1
static domain_name_servers 192.168.0.1 8.8.8.8
nohook wpa_supplicant

interface eth0
metric 100
static ip_address=192.168.0.150/24
static routers=192.168.0.1
static domain_name_servers 192.168.0.1 8.8.8.8


-------------------------------------
/etc/rc.local
-------------------------------------

Code: Select all

# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

#load the iptables config
iptables-restore < /etc/iptables.ipv4.nat

#force wifi to no power mamangement
/sbin/iw wlan0 set power_save off
exit 0

-------------------------------------------
/etc/dnsmasq.conf
-------------------------------------------

Code: Select all

interface=wlan0
domain-needed
dhcp-range=10.0.0.100,10.0.0.150,255.255.255.0,48h
server=192.168.0.1
server=8.8.8.8

#interface=eth0
#server=192.168.0.1
#server=8.8.8.8
#except-interface=eth0

state of services at boot

Code: Select all

pi@PiServer:~ $ sudo systemctl status dnsmasq
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2021-10-13 11:12:22 PDT; 35s ago
  Process: 541 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
  Process: 549 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
  Process: 563 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
 Main PID: 562 (dnsmasq)
    Tasks: 1 (limit: 2059)
   CGroup: /system.slice/dnsmasq.service
           └─562 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.d

Oct 13 11:12:21 PiServer dnsmasq[562]: started, version 2.80 cachesize 150
Oct 13 11:12:21 PiServer dnsmasq[562]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntra
Oct 13 11:12:21 PiServer dnsmasq-dhcp[562]: DHCP, IP range 10.0.0.100 -- 10.0.0.150, lease time 2d
Oct 13 11:12:21 PiServer dnsmasq[562]: using nameserver 8.8.8.8#53
Oct 13 11:12:21 PiServer dnsmasq[562]: using nameserver 192.168.0.1#53
Oct 13 11:12:21 PiServer dnsmasq[562]: read /etc/hosts - 5 addresses
Oct 13 11:12:22 PiServer dnsmasq[562]: no servers found in /run/dnsmasq/resolv.conf, will retry
Oct 13 11:12:22 PiServer dnsmasq[563]: Too few arguments.
Oct 13 11:12:22 PiServer systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
Oct 13 11:12:26 PiServer dnsmasq[562]: nameserver 192.168.0.1 refused to do a recursive query


pi@PiServer:~ $ sudo systemctl status hostapd
● hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
   Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2021-10-13 11:12:21 PDT; 1min 48s ago
  Process: 543 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} (code=exited, status=0/SU
 Main PID: 552 (hostapd)
    Tasks: 1 (limit: 2059)
   CGroup: /system.slice/hostapd.service
           └─552 /usr/sbin/hostapd -B -P /run/hostapd.pid -B /etc/hostapd/hostapd.conf

Oct 13 11:12:21 PiServer systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Oct 13 11:12:21 PiServer hostapd[543]: Configuration file: /etc/hostapd/hostapd.conf
Oct 13 11:12:21 PiServer hostapd[543]: wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Oct 13 11:12:21 PiServer systemd[1]: Started Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.

after first client connect

Code: Select all

pi@PiServer:~ $ sudo systemctl status dnsmasq
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2021-10-13 11:12:22 PDT; 3min 36s ago
  Process: 541 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
  Process: 549 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
  Process: 563 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
 Main PID: 562 (dnsmasq)
    Tasks: 1 (limit: 2059)
   CGroup: /system.slice/dnsmasq.service
           └─562 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.d

Oct 13 11:12:21 PiServer dnsmasq[562]: using nameserver 192.168.0.1#53
Oct 13 11:12:21 PiServer dnsmasq[562]: read /etc/hosts - 5 addresses
Oct 13 11:12:22 PiServer dnsmasq[562]: no servers found in /run/dnsmasq/resolv.conf, will retry
Oct 13 11:12:22 PiServer dnsmasq[563]: Too few arguments.
Oct 13 11:12:22 PiServer systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
Oct 13 11:12:26 PiServer dnsmasq[562]: nameserver 192.168.0.1 refused to do a recursive query
Oct 13 11:14:51 PiServer dnsmasq-dhcp[562]: DHCPDISCOVER(wlan0) 14:0a:c5:d3:1b:2f
Oct 13 11:14:51 PiServer dnsmasq-dhcp[562]: DHCPOFFER(wlan0) 10.0.0.124 14:0a:c5:d3:1b:2f
Oct 13 11:14:51 PiServer dnsmasq-dhcp[562]: DHCPREQUEST(wlan0) 10.0.0.124 14:0a:c5:d3:1b:2f
Oct 13 11:14:51 PiServer dnsmasq-dhcp[562]: DHCPACK(wlan0) 10.0.0.124 14:0a:c5:d3:1b:2f


pi@PiServer:~ $ sudo systemctl status hostapd
● hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
   Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2021-10-13 11:12:21 PDT; 4min 6s ago
  Process: 543 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} (code=exited, status=0/SU
 Main PID: 552 (hostapd)
    Tasks: 1 (limit: 2059)
   CGroup: /system.slice/hostapd.service
           └─552 /usr/sbin/hostapd -B -P /run/hostapd.pid -B /etc/hostapd/hostapd.conf

Oct 13 11:12:21 PiServer systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Oct 13 11:12:21 PiServer hostapd[543]: Configuration file: /etc/hostapd/hostapd.conf
Oct 13 11:12:21 PiServer hostapd[543]: wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Oct 13 11:12:21 PiServer systemd[1]: Started Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
Oct 13 11:14:51 PiServer hostapd[552]: wlan0: STA 14:0a:c5:d3:1b:2f IEEE 802.11: associated
Oct 13 11:14:51 PiServer hostapd[552]: wlan0: STA 14:0a:c5:d3:1b:2f RADIUS: starting accounting session C8A10819EC9E7FA8
Oct 13 11:14:51 PiServer hostapd[552]: wlan0: STA 14:0a:c5:d3:1b:2f WPA: pairwise key handshake completed (RSN)

after a client connects and then disconnects Can now no longer connect any clients

Code: Select all

pi@PiServer:~ $ ^C
pi@PiServer:~ $ sudo systemctl status hostapd
● hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
   Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2021-10-13 11:12:21 PDT; 7min ago
  Process: 543 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} (code=exited, status=0/SU
 Main PID: 552 (hostapd)
    Tasks: 1 (limit: 2059)
   CGroup: /system.slice/hostapd.service
           └─552 /usr/sbin/hostapd -B -P /run/hostapd.pid -B /etc/hostapd/hostapd.conf

Oct 13 11:14:51 PiServer hostapd[552]: wlan0: STA 14:0a:c5:d3:1b:2f RADIUS: starting accounting session C8A10819EC9E7FA8
Oct 13 11:14:51 PiServer hostapd[552]: wlan0: STA 14:0a:c5:d3:1b:2f WPA: pairwise key handshake completed (RSN)
Oct 13 11:18:07 PiServer hostapd[552]: wlan0: STA b4:ae:2b:c1:58:95 IEEE 802.11: associated
Oct 13 11:18:07 PiServer hostapd[552]: wlan0: STA b4:ae:2b:c1:58:95 RADIUS: starting accounting session 178CDFCC1189DEB8
Oct 13 11:18:07 PiServer hostapd[552]: wlan0: STA b4:ae:2b:c1:58:95 WPA: pairwise key handshake completed (RSN)
Oct 13 11:18:31 PiServer hostapd[552]: wlan0: STA b4:ae:2b:c1:58:95 IEEE 802.11: disassociated
Oct 13 11:18:31 PiServer hostapd[552]: wlan0: STA b4:ae:2b:c1:58:95 IEEE 802.11: disassociated
Oct 13 11:18:31 PiServer hostapd[552]: wlan0: STA b4:ae:2b:c1:58:95 IEEE 802.11: disassociated
Oct 13 11:19:38 PiServer hostapd[552]: wlan0: STA 14:0a:c5:d3:1b:2f IEEE 802.11: disassociated
Oct 13 11:19:42 PiServer hostapd[552]: wlan0: STA 14:0a:c5:d3:1b:2f IEEE 802.11: disassociated



pi@PiServer:~ $ ^C
pi@PiServer:~ $ sudo systemctl status dnsmasq
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2021-10-13 11:12:22 PDT; 8min ago
  Process: 541 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
  Process: 549 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
  Process: 563 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
 Main PID: 562 (dnsmasq)
    Tasks: 1 (limit: 2059)
   CGroup: /system.slice/dnsmasq.service
           └─562 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.d

Oct 13 11:12:22 PiServer dnsmasq[562]: no servers found in /run/dnsmasq/resolv.conf, will retry
Oct 13 11:12:22 PiServer dnsmasq[563]: Too few arguments.
Oct 13 11:12:22 PiServer systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
Oct 13 11:12:26 PiServer dnsmasq[562]: nameserver 192.168.0.1 refused to do a recursive query
Oct 13 11:14:51 PiServer dnsmasq-dhcp[562]: DHCPDISCOVER(wlan0) 14:0a:c5:d3:1b:2f
Oct 13 11:14:51 PiServer dnsmasq-dhcp[562]: DHCPOFFER(wlan0) 10.0.0.124 14:0a:c5:d3:1b:2f
Oct 13 11:14:51 PiServer dnsmasq-dhcp[562]: DHCPREQUEST(wlan0) 10.0.0.124 14:0a:c5:d3:1b:2f
Oct 13 11:14:51 PiServer dnsmasq-dhcp[562]: DHCPACK(wlan0) 10.0.0.124 14:0a:c5:d3:1b:2f
Oct 13 11:18:07 PiServer dnsmasq-dhcp[562]: DHCPREQUEST(wlan0) 10.0.0.145 b4:ae:2b:c1:58:95
Oct 13 11:18:07 PiServer dnsmasq-dhcp[562]: DHCPACK(wlan0) 10.0.0.145 b4:ae:2b:c1:58:95 surface


version info

Code: Select all


pi@PiServer:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Anyone have a workaround or solution to this?

Thanks!

epoch1970
Posts: 7026
Joined: Thu May 05, 2016 9:33 am
Location: France

Re: Pi 3B+ as Wireless Access Point. After client disconnect no other clients can connect \ reconnect

Thu Oct 14, 2021 4:35 pm

I don't see a problem in any of your logs.
This option isn't compatible with wifi N and later, AFAIK.

Code: Select all

wmm_enabled=0
Try removing this line. It defaults to enabled.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

himilou
Posts: 3
Joined: Thu Oct 14, 2021 1:40 am

Re: Pi 3B+ as Wireless Access Point. After client disconnect no other clients can connect \ reconnect

Thu Oct 14, 2021 6:26 pm

Thanks for the reply, I have tried a hostapd without that line and I still got the same issue. which is after rebooting the pi I can connect from a device or devices. as soon as a device disconnects ( I believe due to windows or phone deciding to switch to a different access point because the pi is not internet connected ) new devices cannot connect and disconnected devices cannot reconnect.

I have added
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2

to the hostapd file but I dont see any additional output.

I had tried it without the wmm setting in there and the behavior was the same but I have removed it as its not fixing this issue. Any ideas on how to proceed? I should add that Im not used to using system.d so I am not completely sure if the config files are correct or not and they are currently the result of looking over a lot of different how to configure examples

I ultimately would like to have level 3 routing between the pi and the eth0 network with the pi serviing dhcp requests to wlan0 clients only vs full blown bridge mode where all traffic is forwarded both ways ( without taking filtering into account ) but the clients have to stay connected first :)

I should add that as soon as the pi gets into this state the clients will try and reconnect multiple times and eventually give up, or in the case of the kindle disable the connection.

Thanks!

epoch1970
Posts: 7026
Joined: Thu May 05, 2016 9:33 am
Location: France

Re: Pi 3B+ as Wireless Access Point. After client disconnect no other clients can connect \ reconnect

Thu Oct 14, 2021 7:54 pm

himilou wrote:
Thu Oct 14, 2021 6:26 pm
I ultimately would like to have level 3 routing between the pi and the eth0 network with the pi serviing dhcp requests to wlan0 clients only
This is known to work on RaspiOS.
https://www.raspberrypi.com/documentati ... cess-point

If it does not work, try from a clean OS install.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

drgeoff
Posts: 12221
Joined: Wed Jan 25, 2012 6:39 pm

Re: Pi 3B+ as Wireless Access Point. After client disconnect no other clients can connect \ reconnect

Fri Oct 15, 2021 12:30 am

In dhcpcd.conf your

Code: Select all

static domain_name_servers 192.168.0.1 8.8.8.8
lines are missing the '='.
Quis custodiet ipsos custodes?

himilou
Posts: 3
Joined: Thu Oct 14, 2021 1:40 am

Re: Pi 3B+ as Wireless Access Point. After client disconnect no other clients can connect \ reconnect

Fri Oct 15, 2021 11:09 pm

So I reimaged my pi followed the instructions here
https://www.raspberrypi.com/documentati ... cess-point
and the same issue occurs?

Any idea on what to look at to try and troubleshoot this issue or is it a bug?

Return to “Networking and servers”