If you want to know what leases are active, and who are using them. There seems to be no utility for doing this. Instead, You have to manually look thru the '/var/lib/dhcpd/dhcpd.leases' file. But difficult to all pc monitor IP adress, status, mac address, and host name. which connect to dhcp ip.
Today I wrote the following script which will parse the dhcpd.leases file and create a single line of information for each IP address in the format like:
IP Addr Status MAC Host Name
172.16.10.100 active 00:15:58:db:40:c9 "Linux20"
172.16.10.101 free 00:1c:25:c3:4d:0d "Linux07"
172.16.10.102 free 00:16:e6:78:51:14 "Linux01"
172.16.10.103 active 00:e0:4c:73:05:24 "Linux98"
172.16.10.104 free 00:17:a4:13:bb:c1 "Linux71"
This tells you the status of each IP address. The current (or last) MAC address assigned, and a host name, if available.
Here is the script: [root@linux ~]# vim monitor_dhcp.sh
Comments
Post a Comment