Add DNS to External Network in VMware Cloud Director OpenAPI
When trying to add or Edit DNS servers to an External Network that is imported from a NSX-T Segment in Cloud Director the Edit is greyed out. This makes it not possible via UI to edit.
The reason we want DNS on the External network might be a Use-Case where we want to utilize Static IP Pool from External Network as a Direct Imported Network for a Tenant Organization VDC vAPP and also receive the DNS servers for the VMs in the vAPP.
We do not want to add a DHCP server on this network but wish to utilize the Static Pool funtionallity.
Cloud Director OpenAPI
So inorder to accomplish this we need to utilize Cloud Director OpenAPI.
If you type https://clouddirector.test.local/docs or go to https://developer.vmware.com/apis/1245/vmware-cloud-director you will get the examples for API calls. You can also search for External in this case. to get examples of how the API calls should look. and also how the Request body and headers should look like.
Get Authorization Token for Login
First we get the Authorization Token from vCD
We run a POST command against VCD api sessions in Postman Client
POST https://vclouddirector.test.local/api/sessions Accept application/*;version=36.3 Content-Type application/json;version=36.3
Look in response Header for X-VMWARE-VCLOUD-ACCESS-TOKEN
This is our response token:
Change Authorization Type to Bearer Token and paste the Token
List all ExternalNetworks
We then run the API to get all ExternalNetworks
We search for our External Network and copy the id
We copy the id and add it to our next GET call after ExternalNetworks
Update ExternalNetwork with DNS
We then copy the response and paste it into a new PUT body
Editing and adding our DNS server IPs.
Verify in VCD UI vAPP DNS is working
We then jump back into Cloud Director UI and check the External Network for the update of the DNS. The DNS servers are visible for a Tenant in a vAPP that is connected to the External Network
Hope this can help you if you find yourself struggling with this issue.
Happy New Year!