When attempting to add a new host to a datacenter using a newly configured vCenter 5.1 Server appliance I received the following error:
To ensure there was not an error with the host I decided to try to connect directly to the “esxi02” server using the vSphere Client. Connecting directly to the ESXi Server, pinging and DNS resolution worked fine.
Next I tried adding the ESXi host in vCenter using the IP address which worked fine. This was confusing because I thought I had ruled out DNS related problems with the other tests I performed.
I tried to add the host in vCenter again using the FQDN and it worked. Interesting… The previous tests I did confirmed name resolution from my Windows 7 machine to the ESXi host. What I missed is that I did not test name resolution from the vCenter Server appliance to the ESXi host. My first mistake and what led me to have this problem in the first place was that I set my vCenter hostname to “vcenter” instead of a FQDN such as “vcenter.domain.suffix”.
As a best practice you should give ESXi hosts and vCenter Servers a fully-qualified name for the hostname. So the actual hostname of my ESXi hosts for example were “esxi02.domain.suffix”, not just “esxi02” but “vCenter” was only a flat name.
So why did it work fine when I connected directly from Windows using the vSphere Client to the ESXI Server? Domain joined Windows computers are able to resolve flat names such as “esxi02” by automatically adding the domain suffix to the request. So “esxi02” automatically becomes “esxi02.domain.suffix” which is resolved by the DNS server. (DNS will not resolve a flat hostname) This is why using the flat name worked when connecting directly from Windows to the ESXi Server.
In my experience, a Linux based vCenter Server appliance will not automatically be able to resolve a flat name such as “esxi02”, unless the FQDN of vCenter matches the FQDN of the ESXi host. Adding “vCenter.domain.suffix” resolved the problem and allowed me to add hosts to vCenter using only the flat name.
In summary, to avoid name resolution issues when adding hosts in vCenter:
- Check if Lockdown Mode is enabled.
- Ensure the hostnames for the vCenter Server and ESXi hosts exist in DNS.
- Configure your ESXi Servers and vCenter Servers using FQDNs based on your Active DIrectory domain.
- Use the FQDN when adding and connecting to hosts.