Clearing DNS cache on vCenter Server Appliance
Clearing DNS cache on vCenter Server Appliance 6.5/6.7 - Just Virtualise It (kanecharles.com)
I came across a situation recently where I was building some nested ESXi hosts and had configured the incorrect IP address for their DNS record, only to realize this after attempting to add the host into Center:
By attempting to add the host, vCenter will query your DNS servers for the IP address associated with the FQDN you have supplied (assuming you did this method, not via IP address). If you have set the wrong IP on your DNS server for the above FQDN record, you have 2 options:
- Wait a short while for vCenter to clear the cache entry for this FQDN, thus allowing you to add the host with the correct IP from the DNS record
- Clear the DNS cache on your vCenter Server Appliance (vCSA)
vCSA 6.5 upwards runs on Photon OS with dnsmasq acting as a local caching nameserver (thank you to Brandon for the comment to clarify).
Enough rambling, so how do we do it?
If you’re anything like me, you will be too impatient to wait the 5-10 minutes (from my observations) to get the updated DNS record. Thus the following method can be used to clear the DNS cache on your vCSA:
- SSH to your vCenter Server appliance
- Enter the bash shell, ie shell
- Flush the DNS cache by means of restarting the dnsmasq service
systemctl restart dnsmasq
vCenter will now perform a fresh query to your DNS server to obtain the correct IP, thus allowing you to add the host.
Comments