Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get list of connected devices to an hotspot using NetworkManager

Is there a way to retrieve IP and MAC address of devices connected to a Wi-Fi hotspot/access point using NetworkManager (nmcli or even better via C API)?

like image 754
Kill KRT Avatar asked Oct 17 '25 06:10

Kill KRT


1 Answers

I had a similar question, but for me it was enough to display that info on terminal. I didn't find anything in documentation, but the apt package (apt info network-manager) on Ubuntu has a dependency on dnsmasq-base. So opening htop I saw that NetworkManager (in my case) uses dnsmasq for dhcp server.

With htop(or similar, you can press t to sort by parent processes) you can look for /usr/sbin/dnsmasq running. there you will be able to see all the arguments it is given.
One of them is --dhcp-leasefile. You can use that as a starting pointer.

In my case it wasleasefile=/var/lib/NetworkManager/dnsmasq-wlo1.leases

There also was argument --dir=/etc/NetworkManager/dnsmasq-shared.d that may help you to configure dnsmasq if that's required

like image 106
aPolarBear Avatar answered Oct 19 '25 23:10

aPolarBear



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!