Centos – Automatically update dns entry from CentOS vm

centosdomain-name-system

Hello guys (and girls).

I have a new CentOS machine joined to a windows domain. This machine is created via powershell script on a 2012R2 failover cluster. At the creation time, the machines gets an IP via DHCP. After that the machine it's joining the windows domain and then restarts.

After restart, the script changes the machine's network config to have a static IP, other than the one given by DHCP. The problem is that at the joining time a DNS entry is created with the DHCP given IP and after restart, I am no longer able to connect to the machine because the DNS entry is not updated to reflect the new static IP.

The question is if there's any way to update the DNS entry automcatically to reflect the new IP.

Thank you.

Gabriel

Best Answer

The process you are describing is Dynamic DNS. https://en.wikipedia.org/wiki/Dynamic_DNS

You can use the command nsupdate to update DNS records on the Windows DNS server. http://linux.die.net/man/8/nsupdate

But, Windows DNS will be secured from unauthorized DNS updates. Windows DNS server ensures DNS updates are secure by only allowing domain joined Windows operating systems to update DNS. You will need to reconfigure the security settings on your Windows DNS server to allow unsecure updates.