0

I tryed cat /tmp/dhcp.leases | wc -l but have a time delay.

Is there any way to get the number of devices in real time, including wired and wireless devices?

Alan42
  • 571
  • 4
  • 14
  • Define _"connected"_. What do you mean? – Ipor Sircer Sep 10 '18 at 16:07
  • The device is connected to the LAN port of the router with a network cable. Or connect to the router by Wi-Fi. – Alan42 Sep 11 '18 at 02:49
  • 1
    There is an easy command for lan: `ethtool `. Wireless can't be detected exactly, because you never know if it's only idle and will send a packet in a second, or it has completely gone. You can tune timeouts for this problem, but it will be never accurate, because wifi is not a continous connection. – Ipor Sircer Sep 11 '18 at 02:58

1 Answers1

1

My solution is opkg update opkg install arp-scan arp-scan --interface=br-lan --localnet | grep responded | awk '{print $12}' it will return the number of devices which connected to OpenWRT by LAN port. Almost real time.

Alan42
  • 571
  • 4
  • 14