a-man
a-man

Reputation: 41

How to list the assigned/leased IP adresses by DHCP server in Rapberry PI?

I am using a raspberry pi -3 and installed dnsmasq and dhcpd server for auto IP assignment. how to know the devices connected and their IPs.

Upvotes: 0

Views: 9367

Answers (2)

a-man
a-man

Reputation: 41

In Pi we have the path of lease file is /var/lib/misc/dnsmasq.leases

In Ubuntu it is /var/lib/NetworkManager/*.lease in some cases (specially with dhcpd) it is
/var/lib/dhcp/dhcpd.leases

For pi we can display the IP address of named device by cat /var/lib/misc/dnsmasq.leases | grep "ClienDevName"|cut -d " " -f 3| awk '{print $1}'

in this command -d is for "delimiter" which is space by " " and -f 3 is to print the 3rd value after cutting with delimiter space i.e " ".

Upvotes: 2

Bilal Ali Jafri
Bilal Ali Jafri

Reputation: 986

DNSMASQ leases file is located at /var/lib/dnsmasq/dnsmasq.leases

DHCPD leases file is located at /var/lib/dhcp/dhcpd.leases

Upvotes: 1

Related Questions