Changing hostname of vCenter fails with "Unable to set hostname"
search cancel

Changing hostname of vCenter fails with "Unable to set hostname"

book

Article ID: 395583

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

  • Changing the hostname of the vCenter server using  /opt/vmware/share/vami/vami_config_net fails with "Unable to set hostname to <newhostname> reverting to previous hostname:"
  • Hostname change is being preformed from a lower case (vcenter.example.com) to uppercase (VCENTER.example.com) or short name to full FQDN.

Environment

  • 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 (network card version)
<vCenteripaddress>   <vCenterfqdn>
# End /etc/hosts (network card version)

Resolution

To resolve this issue:

  1. Utilizing a text editor such as vi edit the /etc/hosts file and remove the vCenter entry
  2. Clear DNS cache on the vCenter Appliance
    systemctl restart dnsmasq
    systemctl restart systemd-resolved
  3. Validate if your DNS servers are able to resolve the vCenter's fully qualified domain name
    nslookup <vcenterFQDN)
    nslookup <vcenterIP>

Note: vCenter entry in the /etc/hosts file should be removed which was manually updated. Do not update or remove anything else between # VAMI_EDIT_BEGIN and # VAMI_EDIT_END

Additionally having vCenter FQDN in the /etc/hosts file is not a requirement if the external DNS server is able to resolve the vCenter FQDN