(c) Pat O'Brien [email protected] - http://github.com/drsprite Licensed under the GNU GPL 2.0 or later.
This PHP script will allow you to update your dynamic BIND zones directly from a URL POST/GET. This script grabs variables placed into the URL, and then passes them onto nsupdate which will then update your dynamic zone.
This PHP script also uses a cache file for each hostname to detect IP changes before calling nsupdate. This helps to reduce unnecessary IP changes to DNS.
I've forked this project and set it up for my own personal use, however I have generalized it for public use. Just need to change the yourdomain.com values to your domain. I'm also not a master at PHP & MySQL, so if you see any errors, please let me know!
There are two types of ways to install this script.
- Using a flatfile to keep track of IP history
- Using MySQL to keep track of IP history, as well as a way to get domain status.
To be clear, in either scenario (flatfile or MySQL), the data stored is informational only and is only used to help reduce the load on BIND by doing IP checks to prevent unnecessary nsupdate calls. By using MySQL, it allows you to get a quick status on your domain to see what is currently defined.
Option 1:
- Copy index_flatfile.php to the web accessible directory of your choosing that is on the same server that your dynamic DNS zones are on. Rename it to whatever you want.
- Create a subdirectory called cache, and give the directory write permissions.
Option 2:
- Copy index_mysql.php to the web accessible directory of your choosing that is on the same server that your dynamic DNS zones are on. Rename it to whatever you want.
- Copy config.php and styles.css to the same directory.
- Edit the values within config.php to match your MySQL server, username, password and database.
- Run the dyndns.sql script to create the table that will be used.
Once you have either option installed, simply point your browser to the directory you dropped it into with a few extra parameters.
Here's an example that will update the test subdomain to 127.0.0.1:
http://yourdomain.com/dyndns/index.php?hostname=test&ip=127.0.0.1
MySQL Version: to get a status on the dynamic domains that are currently configured for your domain:
http://yourdomain.com/dyndns/index.php?status
Note: the status just polls the MySQL database. If you have dynamic zones that have been set prior to using this script, they will not show.
If for some reason this isn't working, you can check the variables being passed to the PHP array by adding this to your URL
http://yourdomain.com/dyndns/index.php?debug
The fork can be found at https://github.com/drsprite/nsupdate-web
Original project by (c) Karl-Martin Skontorp [email protected] https://github.com/kms/nsupdate-web