FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
468 views 4 comments
by anonymous
Are there any commands I can use with SSH to obtain all the clients that are currently connected to the AP?
by anonymous

Hello,

cat /tmp/dhcp.leases

there be dragons for this suggested solution!

I faced a similar issue here. The problem with this solution is that the dhcp leases file reflect the leases not the connected devices. If a device connects, it get its DHCP lease, so its IP address and this is stored in the lease file. Depending on the time to live of a DHCP lease, this information persists. If the device disconnects the lease remains and you get false information from the lease file.

The only real information comes from an arp scan. I have modified my rc.local to install arp-scan on all my devices:

# Waiting for internet connection
RC=1
while [[ $RC -ne 0 ]] ; do
    ping -c1 8.8.8.8 &> /dev/null
    RC=$?
    sleep 10                            
done

#install arp scan package
opkg update
opkg install arp-scan > /dev/kmsg

exit 0

Works on RUTOS webui release.

Best regards

Dennis

1 Answer

+1 vote
by anonymous

Hello,

Depending on the wireless lan interface name, which you can find with ifconfig command, try one of the commands below:

  • iwinfo wlan0 assoclist
  • iw dev wlan0 station dump
  • ubus call hostapd.wlan0 get_clients

Best regards,

Best answer
by anonymous
Those commands are all great. They showed me who is connected by their MAC Address but it doesn't display their PC name or their IP. I'm sure I could find their PC name using the MAC and a little PS but the IP is what I need to capture. I tried using the command

logread |grep 'for client'

Which does show me what I want but its a lot of parsing, which I would like to avoid as I am not great at it. I am also not confident its going to be up to date information at the time I run the command.

Any other suggestions?
by anonymous

You can use commands:

  • arp 

or 

  • cat /tmp/dhcp.leases

However, if your wireless LAN interface is not separated from LAN they will also list wired LAN clients. 

Best regards,

by anonymous

cat /tmp/dhcp.leases

That command is spot on!

Thank you so much!!