How to change the hostname of an ESXi host via DCUI or CLI
search cancel

How to change the hostname of an ESXi host via DCUI or CLI

book

Article ID: 307780

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

  • The ESXi host was installed without a specified DNS entry and currently identifies as localhost or localhost.localdomain.

  • An administrator needs to rename an ESXi host to align with updated corporate naming conventions or CMDB requirements.

  • You are unable to add the ESXi host to vCenter Server because the hostname does not resolve to the management IP address (DNS mismatch).

  • The ESXi host's SSL certificate contains an incorrect "Subject Alternative Name" (SAN), requiring a hostname change and subsequent certificate regeneration.

Environment

  • ESXi 7.x
  • ESXi 8.x
  • ESX 9.x

Resolution

Notes:

  • If the management network of the ESXi host is on a vSphere Distributed Switch, migrate the network to a vSphere Standard Switch before proceeding. For more information, see Disabling vNetwork Distributed Switches
  • Make sure you update the DNS lookup records on your DNS servers, otherwise you will experience name resolution issues when trying to add the host back to vCenter via FQDN.

 

Renaming via vSphere Client (Host UI)

Note: vSAN Specifics: If this host is a member of a vSAN cluster, consult Changing the vSAN ESXi Host Name to ensure the object maintenance policy is correctly handled.

  1. Maintenance Mode: Place the host in Maintenance Mode. If it is in a cluster, drag it out of the cluster first.

  2. Inventory Cleanup: Right-click the host in vCenter, select Connection > Disconnect, then right-click again and select Remove from Inventory.

  3. Direct Access: Log in to the ESXi Host Client directly (https://<ESXi_IP>/ui).

  4. Network Config: Navigate to Networking > TCP/IP stacks.

  5. Modify: Select the Default TCP/IP stack, click Edit settings, and input the new Hostname and Domain.

  6. Rejoin: Log back into vCenter and use the Add Host wizard to re-add the host using its new FQDN.

Renaming via Command Line Interface (CLI)

  1. Preparation: Follow the same Maintenance Mode and vCenter Removal steps as above.

  2. SSH Session: Establish an SSH connection to the ESXi host.

  3. Execute Rename:

    • Set Hostname: esxcli system hostname set --host=new-hostname

    • Set FQDN: esxcli system hostname set --fqdn=new-hostname.domain.com

  4. Validation: Verify the change by running:

    • esxcli system hostname get

  5. Rejoin: Add the host back to vCenter Server.

 

Note: After renaming, vCenter will generate a new SSL certificate for the host. Ensure your backup and monitoring agents trust the new certificate.

Additional Information

  • The iSCSI Qualified Name used for iSCSI storage configuration is based on the hostname of the ESXi host. If you are facing a storage connectivity issue after changing the hostname of the ESXi host, make sure to review your iSCSI software initiator configuration follow Unable to rename the iSCSI initiator on the ESXi host