EdgeRouter - Tracking dhcp-server static leases

Overview


Readers will learn how to enhance the functionality of the dhcp server log file, through keeping track of DHCP log requests & responses.

The default version of dhcpd used by EdgeMAX only keeps track of dynamic leases. One way to get some more visibility into static leases is to configure the dhcp-server to log its request/responses. To do that we first add a global parameter to the dhcp-server to tell it to log to one of the user-defined facilities. In this example we'll use local2

configure
set service dhcp-server global-parameters 'log-facility local2;'
commit
save
exit

Then configure the syslog server to log local2 to a file. In this example the file is dhcpd

configure
set system syslog file dhcpd facility local2 level debug
set system syslog file dhcpd archive files 5
set system syslog file dhcpd archive size 5000
commit
save
exit

Now to see the dhcp-server activity look in /var/log/user/dhcpd or use the "show log file <name> command:

stig@ubnt-SJ:~$ show log file dhcpd
Nov 8 11:17:07 ubnt-SJ dhcpd: DHCPINFORM from 10.1.0.70 via eth1
Nov 8 11:17:07 ubnt-SJ dhcpd: DHCPACK to 10.1.0.70 (90:b1:1c:8a:df:ad) via eth1
Nov 8 11:17:07 ubnt-SJ dhcpd: DHCPINFORM from 10.1.7.163 via eth1.20
Nov 8 11:17:07 ubnt-SJ dhcpd: DHCPACK to 10.1.7.163 (00:27:22:2c:85:26) via eth1.20
Nov 8 11:17:07 ubnt-SJ dhcpd: DHCPINFORM from 10.1.7.163 via eth1
Nov 8 11:17:07 ubnt-SJ dhcpd: DHCPACK to 10.1.7.163 (00:27:22:2c:85:26) via eth1
Nov 8 11:17:08 ubnt-SJ dhcpd: DHCPDISCOVER from dc:9f:db:17:01:12 (AV-In-A-Box-01-Dome-1) via eth1.20
Nov 8 11:17:08 ubnt-SJ dhcpd: DHCPOFFER on 10.1.6.134 to dc:9f:db:17:01:12 (AV-In-A-Box-01-Dome-1) via eth1.20
Nov 8 11:17:08 ubnt-SJ dhcpd: DHCPDISCOVER from dc:9f:db:17:01:12 (AV-In-A-Box-01-Dome-1) via eth1
Nov 8 11:17:08 ubnt-SJ dhcpd: DHCPOFFER on 10.1.0.60 to dc:9f:db:17:01:12 (AV-In-A-Box-01-Dome-1) via eth1
Nov 8 11:17:11 ubnt-SJ dhcpd: DHCPINFORM from 10.1.6.191 via eth1.20

Note: This only works for hosts getting their static lease using DHCP. If the host has staticly configured their IP address to match the static lease, then obviously it won't talk to the dhcp-server.

Edited with htmlg.com

Powered by Zendesk