Last week I was working on an HA cluster of VMware ESXi hosts.
Whatever I tried I couldn’t get the hosts to play nicely when HA was turned on. Further investigation showed that the hosts were resolving their own names to a previous IP address.
Checking the console on each host showed the correct information, but the error messages when turning HA on indicated that they were still resolving to their old incorrect addresses.
The usual problem with HA is that DNS records don’t match what is actually set up, but in this case DNS checked out fine.
It would appear that:
- ESXi uses a local ‘/etc/hosts’ file for resolving names in preference to DNS. You can view this file by pointing a browser at http://youresxservername/host/hosts
- The local hosts file doesn’t get updated when you change the settings using the console interface. It keeps whatever was in there the first time you set up the hostname and IP address for the host
Most of the time this doesn’t matter much as the host doesn’t often need to look itself up, but when VMware HA is turned on, name resolution becomes much more important.
There are two ways to edit the /etc/hosts file. Because ESXi doesn’t have a normal Console Operating System (COS) that full ESX enjoys, both methods are relatively awkwards.
- Use ‘unsupported’ mode to get a local root shell and edit using ‘vi /etc/hosts’
- Use the Remote CLI to change the file remotely.
- vifs.pl –sessionfile <yoursessionfile> –get /host/hosts C:\temp
- Edit the file with notepad
- vifs.pl –sessionfile <yoursessionfile> –put C:\temp\hosts /host/hosts
With that done HA started working again. Probably worth doing a reboot just to make sure it’s ‘taken’.