From time to time you may have a requirement to rename a VMware ESX host, although this is quite straight forward to do in ESXi via the Direct Console User Interface (DCUI) there are a few more steps involved in making this change in ESX via the service console (SC).
The following post will take you through the steps to make this host name change in ESX.
The first thing to do before going any further is to remove the ESX host (whose name you want to change) from any cluster within vCenter Server that it may be a member of. Also, remove the ESX host from vCenter Server.
Next log into the service console using the ‘root’ account.
We now want to edit the hosts file, so type:
If your ESX host’s host file doesn’t contain a server name such as the example below then you will want to manually add it.
I am adding the IP address (fixed: 192.168.1.25) and host name (esxhost1). It is worth noting that at this point you can also add the domain name in which the ESX host will be participating to the end of this host name.
To save the changes we want to put the VI editor into ‘Command Mode’ by pressing the ‘Esc’ key and then typing :wq (write the changes & quit). At which point you should be returned to the command prompt in the service console.
We now want to make a change to the network config file.
To do this type the following
Change the ‘HOSTNAME’ to be the new name of your ESX host. Once again, save this change by pressing the ‘Esc’ key and then typing :wq
Next we want to execute the following command:
esxcfg-advcfg -s <your new ESX hostname> /Misc/HostName
We want to register the new ESX host name in DNS so remove the old ESX host name and enter the new DNS name and associated IP address.
Now the final step is to reboot your ESX host for the changes to be applied. Before doing this ensure you have migrated any running VMs to another ESX host or at least power off any running VMs first.
After the ESX host has rebooted you should now add it back into vCenter Server using its new name.
Ta daaa… It’s as easy as that. 🙂