
Hostname from the lease ( “host-name” attribute ) – a bit more CPU intensive solution, which searches leases for related hostname, but is also more compatible, if previous option is not available. Variable set from the lease ( $”lease-hostname” ) – quick solution, which uses hostname passed from client. Hostname for DNS record can be set from:.
DNS records hostname can use additional domain name or use short hostname – or both. Deletes all related static DNS records, when new DNS record is being created to prevent duplicates. Deletes static DNS records according to unassigned DHCP lease. Creates static DNS records according to assigned DHCP lease. Thanks to Wojtek and Gavin who pointed this out.
Fixed decision on usage of DNS domain and made according section less complex.
Although, bunch of such scripts is already available, I wanted to have the features I liked merged into one universal script. This article shows my take on DHCP server lease script, which creates and deletes static DNS records automatically, based on creation and deletion of DHCP leases.