Changing hostname of vCenter server fails with error "Unable to set hostname"
book
Article ID: 395583
calendar_today
Updated On:
Products
VMware vCenter ServerVMware vSphere ESXi
Issue/Introduction
Changing the hostname of the vCenter server using /opt/vmware/share/vami/vami_config_net fails with the error "Unable to set hostname to <new_hostname> reverting to previous hostname:"
The hostname is being changed from one case to another, or the short name to full FQDN
Environment
VMware vCenter Server 6.5.x
VMware vCenter Server 6.7.x
vCenter 7.x
vCenter 8.x
Cause
This issue occurs when the existing hostname of the vCenter is hard coded in the /etc/hosts file.
Example:
$ cat /etc/hosts
# Begin /etc/hosts 192.168.1.15 vc.example.com # End /etc/hosts
Resolution
Edit /etc/hosts and remove the vCenter entry
Clear DNS cache on the vCenter Appliance: $ systemctl restart dnsmasq $ systemctl restart systemd-resolved
Validate if your DNS servers are able to resolve the vCenter's fully qualified domain name: $ nslookup <vCenter_FQDN> $ nslookup <vCenter_IP>
Note: Do not update or remove anything between the #VAMI_EDIT_BEGIN and #VAMI_EDIT_END sections.
Additional Information
Having an entry for the vCenter FQDN in /etc/hosts is not a requirement if external DNS is able to resolve the vCenter FQDN.