1 | initial version |
The easiest answer is to use a managed wifi infrastructure and it will likely just tell you how many clients are currently connected to an AP and the whole system (if you have more than one AP). Sometimes, even standalone APs will tell about all the clients connected. This is a definitive source.
The harder way is to use a wireless packet capture. If you have a single SSID configured, find the BSSID and filter for this; the endpoints tool, with 'limit to display filter' and selecting for 802.11, is useful here.
See https://ask.wireshark.org/question/1918/how-to-detect-packets-only-from-devices-connected-to-my-wifi/ and also probably many other questions.
And for the Endpoints tool, see Statistics --> Endpoints
If you happen to have more than one SSID hosted on an AP, then it depends on what you want. If you only care about who is connected to a particular SSID, then the above is fine. If, as you ask, you want to know how many actual clients are connected to a given AP, regardless of SSID, then it can be tricky. There are techniques, but you have to figure out how your platform assigns BSSIDs to the various SSIDs - it's a common misconception that they all just change the last byte. Some do this, but certainly not all. Others change different bytes in the MAC address so we would have to reverse engineer this pattern, then work up some display filters that are consistent with these platforms.