As many of you face problems with clients “random” disconnects from wifi I decided to share my solution for this problem.
In my case some android devices were disconnecting few minutes after the display was off.
Probably you tried the disassoc_low_ack
option already as recommended on some forums but for me it was no sense becasue my log did not show anything like “disconnected due to excessive missing ACKs
”.
In my case it was “deauthenticated due to local deauth request
”.
To investigate your reason for disconnects just keep running:
tail -f -n +0 /tmp/log/messages | grep 'hostapd\|ath:\|ath10\|wlan'
so you can immediately see all events related to wifi (in case of ath9 or other udate the command accordingly).
What I could see is that every 10 minutes (600 seconds) is done WPA Group Cipher rekeying (info hostapd[]: wlan0: STA xx:xx:xx:xx:xx:xx WPA: pairwise key handshake completed (RSN)
).
And just after this android device disconnected and in log appeared hostapd message like deauthenticated due to local deauth request
.
I think this is related to some device power save / standby mode as they simply did not receive/process this rekeying.
Because my setting is WPA2 PSK/CCMP then I set interval for rekeying from 600s (10 minutes) to 86400s (24 hrs) which is mentioned as default for CCMP in hostapd documentation (http://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf)
Time interval for rekeying GTK (broadcast/multicast encryption keys) in seconds (dot11RSNAConfigGroupRekeyTime)
This defaults to 86400 seconds (once per day) when using CCMP/GCMP as the group cipher and 600 seconds (once per 10 minutes) when using TKIP as the group cipher.
wpa_group_rekey=86400
So in /etc/config/wireless
update all required interfaces:
config wifi-iface ... option wpa_group_rekey '86400' ...
and after wifi reload check /tmp/run/hostapd-phy0.conf
(or phy1) if interfaces are updated correctly with wpa_group_rekey=86400
I don’t know how much I hit directly the problem or how much this is just workaround or temp fix but it works great.
Just to mention I was playing with more options like skip_inactivity_poll
and max_inactivity
etc. which seems to be amazing for specific environment tuning needs.
Leave comments if this is working for you or if you found any other fix for disconnect problem…