27

I have an Angstrom Linux device acting as an access point, running hostapd, dhcpd, which works fine. Can I get a list of devices connected to the Wi-Fi? I know I can get the DHCP leases, but I need to know which devices connect through wlan0. I've tried this (iwlist has options):

iwlist wlan0 ap
iwlist wlan0 accesspoints
iwlist wlan0 peers

but all return:

wlan0     Interface doesn't have a list of Peers/Access-Points

iwconfig, iwgetid, iwpriv and iwspy are also present in /sbin, but don't seem to have options to display the client list.

24

You should use iw dev wlan0 station dump as root

  • Thanks - I don't see this for my Arm 9 Angstrom yet, but I'll go look for it – Jeff Jun 10 '12 at 15:04
  • Perhaps you can compile from source, assuming you have enough space or a CF for temporary storage – Mike Pennington Jun 10 '12 at 22:01
  • 1
    iw also depends on nl80211 support in the WiFi interface's driver - which is not present for all drivers yet... wireless.wiki.kernel.org/en/developers/documentation/nl80211 – Pierz Nov 30 '16 at 17:51
  • In case you have more than one devices, for example when having 2.4 GHz and 5GHz enabled, you might get an empty results back. This is an indicator that no client has connected to the specify interface or frequency. – Akendo Jul 5 '18 at 8:31
11

You could Use "arp" as root:

$ sudo arp
  • 1
    Not sure why should this be downvoted, it does show what kind of clients (IP and MAC) are connected – shookees Dec 10 '14 at 11:18
  • 3
    It is downvoted because arp returns only hosts that are active on the network in the arp table on the host. If someone nasty associates with the AP and is passively sniffing they will never show up in the arp table. – Geoffrey Jul 18 '15 at 11:57
  • 2
    You don't need superuser privileges to dump the arp table. See also ip n on Linux. – Stéphane Chazelas Apr 17 '18 at 10:17
  • Didn't work for me. I call arp but it only contains entries for ethernet. If i use arp -i wlan0 nothing is shown. With iw dev wlan0 station dump it is working. – JackGrinningCat Dec 6 '18 at 13:24
4

You can also find list of connected devices to your AP by using this command:

cat /var/lib/misc/dnsmasq.leases

dnsmasq.leases file lists all the devices which connected to AP so far. Also you can get list of all devices which connected to your device over WiFi or Ethernet by using this command:

sudo arp
  • That would be on systems that use dnsmasq as a DHCP server. The OP uses "dhcpd", presumably the ISC implementation. Also stations could associate and not request and DHCP lease or not send any IP or ARP traffic. – Stéphane Chazelas Apr 17 '18 at 10:20
2

arp-scan

As said on this answer you can use arp-scan package. Just arp-scan -l.

arp-scan is a command-line tool for system discovery and fingerprinting. It constructs and sends ARP requests to the specified IP addresses, and displays any responses that are received.

With systemd/udev names I found very useful an alias to

sudo arp-scan -l -t 200 -I $(ls /sys/class/net | grep -o "wl[^\t]\+")

for the wireless interface and en instead of wl for wired interfaces.

  • -I --interface Use network interface . If this option is not specified, arp-scan will search the system interface list for the lowest numbered, configured up interface (excluding loopback).
  • -l --localnet Generate addresses from network interface configuration. Use the network interface IP address and network mask to generate the list of target host addresses.
  • -t --timeout Set initial per host timeout to ms, default=100. This timeout is for the first packet sent to each host.
0

There is also a free (commercial licence, unlimited duration trial with maximum of 5 devices displayed) GUI application, WifiGuard.

0

On ubunt, after starting the hotspot by clicking in WiFi top right of screen in gnome, select WiFi and "Wi-Fi Settings", config opens, select hamburger top right in menu, "Turn On Wi-Fi Hotspot..."

In terminal display connected clients iw dev wlan0 station dump

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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