Changing the hostname of an ESX or ESXi host
search cancel

Changing the hostname of an ESX or ESXi host

book

Article ID: 307780

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides steps to change the hostname of a VMware ESX or ESXi host.

If hostname and DNS configuration reverts to original values after rebooting the VCSA machine see VMware vCenter Server Appliance hostname and DNS configuration revert after a reboot (2122383).


Environment

VMware vSphere ESXi 7.0.0
VMware vSphere ESXi 5.5
VMware vSphere ESXi 6.5
VMware ESXi 4.1.x Installable
VMware vSphere ESXi 6.0
VMware ESXi 4.0.x Embedded
VMware ESXi 3.5.x Embedded
VMware ESXi 4.1.x Embedded
VMware ESXi 4.0.x Installable
VMware vSphere ESXi 5.1
VMware ESXi 3.5.x Installable
VMware vSphere ESXi 5.0

Resolution

Notes:
To rename a VMware ESX host:
  1. If the ESX host is part of a cluster, drag it out of the cluster to remove it from the cluster.
  2. If the ESX host is managed by VirtualCenter/vCenter, disconnect and remove the ESX host from the vCenter.
  3. Make the modifications in your DNS environment to reflect the correct name and IP association for the new name.
  4. Log in as root to the console of ESX host.
  5. Using a text editor, change the name and domain name, if applicable, of the host in these files:
     
    • /etc/hosts
    • /etc/sysconfig/network
       
  6. Run this command:

    esxcfg-advcfg -s ESXi_FQDN /Misc/hostname
    where ESXi_FQDN is the new FQDN hostname for the ESX host.
  7. Reboot the ESX host.
  8. Join the ESX host to VirtualCenter/vCenter Server and clusters.
To rename a VMware ESXi host using the Flash/Flex client:
  1. If the ESXi host is part of a cluster, first enter the Maintenance mode to remove it from the cluster.
  2. If the ESXi host is managed by VirtualCenter/vCenter Server, disconnect and remove the ESXi host from the vCenter Server.
  3. Connect to the host directly with a vSphere Client.
  4. Click ESXi host.
  5. Click the Configuration tab.
  6. Click DNS and Routing.
  7. Click Properties.
  8. In the DNS Configuration tab, edit the Name field. Change anything else that is necessary in your environment.
  9. Click OK.
  10. Join the ESX host to VirtualCenter/vCenter Server and clusters.
To rename a VMware ESXi host using the HTML client:
  1. If the ESXi host is part of a cluster, first enter the Maintenance mode to remove it from the cluster.
  2. If the ESXi host is managed by VirtualCenter/vCenter Server, disconnect and remove the ESXi host from the vCenter Server.
  3. Connect to the host directly with a vSphere Client and select the ESXi host
  4. Select Configure - TCP/IP configuration
  5. Select the Default TCP/IP Stack, and then click the Edit button
  6. Set hostname and Domain Click OK.
  7. Join the ESX host to VirtualCenter/vCenter Server and clusters
To rename a VMware ESXi host using the command line:
  1. If the ESXi host is part of a cluster, first enter the Maintenance mode to remove it from the cluster.
  2. If the ESXi host is managed by VirtualCenter/vCenter Server, disconnect and remove the ESXi host from the vCenter Server.
  3. Connect to the ESXi Shell  please see Using ESXi Shell in ESXi 5.x, 6.x and 7.x
  4. Run the below command, the switch host would be used IP and the switch for fully qualified domain name (FQDN).:
       esxcli system hostname set --host=hostname
       esxcli system hostname set --fqdn=fqdn

   5. 
Join the ESX host to VirtualCenter/vCenter Server and clusters


Additional Information

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

Unable to rename the iSCSI initiator on the ESXi host (2146492)
Disabling vNetwork Distributed Switches
Cambiar el nombre de un host ESX o ESXi
Como mudar o nome de um host ESX ou ESXi
Recover Cluster workflow in VMware vSphere Storage Appliance adds hosts to vCenter Server by IP address rather than FQDN
ESX または ESXi ホストの名前の変更
更改 ESX 或 ESXi 主机的名称