It's nearly ready for public consumption, but I thought I'd post this now to see what the level of interest among the Raspberry Pi community is for it. This will help me figure out how much additional polishing and testing to do in order to enable others to reliably use it.
What is it? dnm is a Python script that builds and manages a JSON-based hostname database. From that database, the appropriate DHCP and DNS (named/bind) config files are generated and installed into the system. Most importantly, for a basic implementation you don't ever need to edit /etc/hosts, or ANY of the DHCP or DNS configuration files...dnm does it all for you. You can also have IP addresses/hostnames for internet-based systems, if needed.
With dnm you can get DNS and DHCP servers running on you home network Pi in just a few minutes.
- dnm enabls you to configure hosts easily with DHCP-assigned fixed addresses. Systems that aren't in the DHCP or DNS databases will be assigned dynamic addresses from an address pool, and their names/addresses will be added to the running DNS server (but not the databse).
- Maintains a database for each host with IP address, hostname, MAC address, etc.
- Database can be entered from command line (one command per line) or bulk file import
- Database entries can be added, deleted, modified, or listed
- Entire Database can be exported (with database config details)
- Enables custom per-host dhcpd.conf statements (e.g., for PXE, special DNS servers, etc)
- Builds system files from database: /etc/hosts, dhcpd.conf, and named/bind config files
- System file creation and installation are separate steps out of an abundance of caution
- Configure blocked DNS domain list (all names return 127.0.0.1)
- Includes complete documentation for installation and configuration of dhcpd, bind9, and this tool on Raspbian Stretch
- Create and configure the Database This establishes configuration information used in the various DHCP and DNS config files
- ndm config --create
- ndm config --domain yourdomain.com --subnet 192.168.1 --gateway 192.168.1.1 --timeserver 192.168.1.1
- ndm config --externaldns "22.214.171.124 126.96.36.199" --dhcpsubnet "192.168.1.128 192.168.1.256"
- Add hosts
- ndm config --import listofhosts.txt
- ndm add 192.168.1.2 --hostname mypi --macaddr nn:nn:nn:nn:nn:nn
- List and show hosts
- ndm list
- ndm show mypi
- ndm show my
- Generate DHCP and DNS config files: ndm build
- Install newly-built config files into the system and restart the services: ndm install
- Only /24 networks are supported (e.g., 192.168.1.*)
- No IPV6 support
- Opportunities for further data validation remain (e.g., IP addresses, etc)
Oh, and happy to answer your questions about it!