Changing DNS and NTP with SDDC Manager APIs

File:Lochstreifen-2.png - Wikimedia Commons

Not so long ago while working at customers, one of the things you didn’t like to hear was that old “data center services” would need to be retired. In my experience, it was usually because they were running an ancient version of FreeBSD or <pick you distro> that wasn’t supported any longer. New services would be stood up, with new IP’s of course.. and then you had to manually change it on every. single. system… The VCF DNS and NTP API’s go a long way to help in these situations!

For this blog article, I’ll focus on just the DNS portion.. but you’ll notice when you look at the API’s that NTP is very similar.

Start by logging in to your SDDC Manager and click on the Developer Center in the left menu

Then you’ll want to select the API Explorer tab toward the top of the screen

Scroll down the list of API calls and toward the bottom of the list you will see APIs for managing DNS & NTP configuration, click on the > to expand

To look at the current DNS or NTP servers you can expand the respective GET statement and click the Execute button under Try it out

You will see a response with the DnsConfiguration spec link along with icons and buttons that will allow you to copy it to the clipboard, or download the response as a JSON file. If you click the DnsConfiguration link it will expand the list of dnsServers, then click on the DnsServer or DnsServers to expand them

After you’re done looking at the response, click the Copy JSON button and you should see a checkmark, then expand the PUT statement directly below the GET we just used and paste the contents of your clipboard into the “Value” textbox

You will need make changes to the IP addresses for the primary and secondary DNS servers here and then click “Execute”, if you don’t it will simply respond with an error that states “NO_DNS_CONFIGURATION_CHANGE”

Something else to note, I’ve found it SUPER helpful to only change the secondary DNS IP address to the “new” ones for the first attempt. What happens in SDDC Manager when you click execute is the creation of a new workflow to change DNS across all the components that are managed by VCF. It does nslookup validations for each of the components to both of the DNS servers. The workflow will fail if the DNS is not configured correctly and you’ll be able to see exactly why in the Operations Manager logfile on SDDC Manager: /var/log/vmware/vcf/operationsmanager/operationsmanager.log. The system won’t change anything at that point until it is correct, which means no outage due to DNS resolution problems!

After clicking execute, you will see the response of a Task, you can navigate to the bottom of the SDDC Manager UI and look at the task in the task pane, and expand it to see what tasks it’s doing

As you can see, it took under 3 minutes to change the DNS across my entire lab, which for reference was the management domain with an edge cluster, and a workload domain. So 2 vCenters, 2 NSX-T managers (in the lab), 7 hosts and SDDC Manager. I know that I couldn’t do it that fast by hand!

I hope this post helps emphasize how easy and powerful the SDDC Manager API is!

Leave a Reply

Your email address will not be published. Required fields are marked *