VMWare ESXi editing the Hostfile

If you are as paranoid with redundancy as my team & I are, then entering the hostnames & IPs of all the server in a cluster into the VMware host file is a must. As your VMware HA is dependant on your servers being able to resolve the names of itself & other ESX server in the cluster, the DNS get to play a major role in HA. What if DNS fail? As many customers are using Microsoft DNS as their primary means of DNS, there is a chance it will fail a day or another. Would you like a way to ensure that your HA will work even if your DNS fail? then Adding these records to the host files of each of the ESXi server in the cluster will do the trick. What if you did not even have a DNS & still want to implement HA & other feature that depend on name resolution, then again adding the records to the host file is the solution.

The steps below show what to do after you login to the console of your VMware Server. If you are using ESX, then logging in to the service console is straight forward. If you are using ESXi, then please check out the other article in here on how to access the VMware ESXi Console: VMware ESXi – Console Access (Unsupported)

After logging into the VMware Console you will need to run the following command as shown in the image below to open the host file of you VMware:

vi /etc/hosts

VMWare ESXi vi hosts file

Enter the host names & ip addresses in the host file as shown in the image below:

VMWare ESXi editing host file

Save the file & exit from the service console. Repeat the above steps for the rest of the ESX/ESXi server in the same cluster.
I hope that help someone. If it helped you, please leave me a comment so I will know that I helped someone not just writing for myself. If you have something to add to this please comment it.

Comments

  1. thanks mate! This was very usefull

  2. Thank you!!
    Exactly the information I needed.

  3. I am glad I was able to help, as it took me some time to figure it out as well :). You might want to follow my RSS or twitter to keep updated with my new posts :).

  4. Thanks for that. This helped me resolve my ha issue

  5. You welcome William.

    Enjoy,
    Eiad

  6. Many Thanks, this will avoid problems if the DNS fails.

  7. Eiad Al-Aqqad says:

    Hi Driss,

    Though its not really recommended to do so, unless your DNS is crappy. Please note with new releases of ESXi the host will actually store the DNS records automatically so you really have no reason any more to do it manually. Thought I will share this with you as it might be of benefit.

    Regards,
    Eiad

  8. This is a dumb question, but I’d rather ask than have my assumptions bite me in the backside later: If my hosts are not domain members, how would i populate this? I view these fields as columns, so would i just populate a space in ‘column’ 2 and populate columns 1 and 3? Or should I populate column 1 and 2, entering just a host name in 2? I appreciate your feedback. Also, thank you for providing this page. I didn’t hear of anyone doing this when i was at VMWorld last year… Keep up the good work!!

  9. Hi Halve,

    I would populate all the columns where 1 & 2 will have just the host name, though its important to note in later versions of ESXi manually editing hostfiles is no longer a good idea specially when you have a working DNS, as the later versions of ESXi 4.1 actually create a hostfile on its own to accommodate for DNS failure the first time it inquiry the DNS.

    I hope this help,
    Eiad

  10. How do you use vi to edit files?

  11. Hi Lewis,

    Please check the following post on how to use the vi editor.
    http://www.cs.fsu.edu/general/vimanual.html

    Enjoy,
    Eiad

Speak Your Mind

*

Sponsors