Sync to an ISC DHCP Server

All IP devices need addresses, and ISC DHCP is the classic way to provide them. ISC DHCP is open source software that implements the Dynamic Host Configuration Protocol for connection to an IP network. It offers a complete solution for implementing DHCP servers, relay agents, and clients for small local networks to large enterprises.


Create an API key in the NS1 portal if you have not already done so.

Create a zone to contain your forward A records ( and a zone to contain your reverse PTR records ( in the NS1 portal if you have not already done so.

Copy the script to a suitable location on your DHCP server, such as /usr/local/bin.

Add it to root's crontab so it executes frequently, ideally every minute:

* * * * * /usr/local/bin/ --api-key=<key> --forward-zone=<zone> --reverse-zone=<zone> assumes that the DHCP server keeps track of active leases in the file/var/lib/dhcpd/dhcpd.leases. If this is not the case, then you can tell where to find the DHCP leases file with the optional --leases-file=<file> parameter. uses the Getopt::Long and LWP::UserAgent 
CPAN modules, which are installed by default on most Linux systems. However, if your Perl distribution complains that it could not find one or both modules, you can install them via:sudo perl -MCPAN -e 'install <module>'.


If you need to troubleshoot the synchronization process between your DHCP server and NS1, you can manually run with the --verbose parameter, like so: --verbose --api-key=<key> --forward-zone=<zone> --reverse-zone=<zone>

In order to avoid clobbering other records within the forward and reverse zones, stores the ethernet (MAC) address of the DHCP client in the Notes field for each corresponding DNS record. When a lease expires, the DHCP client's ethernet address is removed from /var/lib/dhcpd/dhcpd.leases. Any records found in the forward and reverse zones that contain an ethernet address that is not found in the current /var/lib/dhcpd/dhcpd.leases are removed, as the lease is assumed to have expired. Records not containing an ethernet address in the Notes field are left intact.

Additional Resources

ns1-dhcpd-ddns-sync Documentation:
NS1’s Github:

Please report any bugs to [email protected].

Request a Demo

Contact Us

Get Pricing