nsupdate for dynamic dns in Linux
mrblackmamba343
Inactive Imported Users Posts: 136
in Off-Topic
Is there a way I can have nsupdate perform automatic update as soon as the client receives an IP address from a windows DHCP server? I can use a manual way of running nsupdate to delete the old dns A record in the zone file on the client machine but is there a way that process can be automated? or the only solution is to switch to a linux DHCP server?
Comments
-
Met44 Member Posts: 194mrblackmamba343 wrote: »Is there a way I can have nsupdate perform automatic update as soon as the client receives an IP address from a windows DHCP server?
Using nsupdate by itself, no, but yes with a script that does the following:
1) Checks when the address of an interface(s) has changed
2) If the address has changed, calls nsupdate with appropriate arguments
Make the script start backgrounded at boot, and that will work.
Step 1 can be done in a number of ways. An easy way would be to loop infinitely, checking an interface's IP using ifconfig every ~5 seconds. If it has changed since the previous loop, call nsupdate.
That should be enough to get started... if you get stuck, post back with what you have so far.
After you get that working, you may want to build in some protection for edge cases, like if the dhcp server cannot be reached and the machine self-assigns a 169.254 address.