The clab-pdns.sh script will create DNS records for containerlab nodes. It can do this by either manually executing the script or setting up incron to watch the /etc/hosts file for updates
This assumes that the webserver and API are enabled on the PowerDNS server. The other option is to run PowerDNS-Admin and use that API. The API works the same between the 2 for this use case.
This should be setup on the containerlab server
Copy the config.cfg.defaults file to config.cfg and update with your information.
SERVER=dns1.mysite.internal:8081
DNS_SERVER=localhost
APIKEY=changeme
DOMAIN=lab.mysite.internal
ADD_IPV6=false
sudo clab-pdns.sh
It should be possible to create a wrapper script for containerlab that also runs this script to create DNS records.
This version requires that incron is installed on the containerlab server.
To install on Debian based systems use:
sudo apt install incron
Then you need to allow users to run incron
echo 'root' | sudo tee -a /etc/incron.allow
Then you need to setup the incron to watch the /etc/hosts file
sudo incrontab -e
Add the following to the file and save. Make sure to put in the full path to the file
/etc/hosts IN_MODIFY <path>/clab-pdns.sh