book
Article ID: 307780
calendar_today
Updated On:
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:
- If the ESX host is part of a cluster, drag it out of the cluster to remove it from the cluster.
- If the ESX host is managed by VirtualCenter/vCenter, disconnect and remove the ESX host from the vCenter.
- Make the modifications in your DNS environment to reflect the correct name and IP association for the new name.
- Log in as root to the console of ESX host.
- Using a text editor, change the name and domain name, if applicable, of the host in these files:
/etc/hosts
/etc/sysconfig/network
- Run this command:
esxcfg-advcfg -s ESXi_FQDN /Misc/hostname
where ESXi_FQDN is the new FQDN hostname for the ESX host. - Reboot the ESX host.
- Join the ESX host to VirtualCenter/vCenter Server and clusters.
To rename a VMware ESXi host using the Flash/Flex client:
- If the ESXi host is part of a cluster, first enter the Maintenance mode to remove it from the cluster.
- If the ESXi host is managed by VirtualCenter/vCenter Server, disconnect and remove the ESXi host from the vCenter Server.
- Connect to the host directly with a vSphere Client.
- Click ESXi host.
- Click the Configuration tab.
- Click DNS and Routing.
- Click Properties.
- In the DNS Configuration tab, edit the Name field. Change anything else that is necessary in your environment.
- Click OK.
- Join the ESX host to VirtualCenter/vCenter Server and clusters.
To rename a VMware ESXi host using the HTML client:
- If the ESXi host is part of a cluster, first enter the Maintenance mode to remove it from the cluster.
- If the ESXi host is managed by VirtualCenter/vCenter Server, disconnect and remove the ESXi host from the vCenter Server.
- Connect to the host directly with a vSphere Client and select the ESXi host
- Select Configure - TCP/IP configuration
- Select the Default TCP/IP Stack, and then click the Edit button
- Set hostname and Domain Click OK.
- Join the ESX host to VirtualCenter/vCenter Server and clusters
To rename a VMware ESXi host using the command line:
- If the ESXi host is part of a cluster, first enter the Maintenance mode to remove it from the cluster.
- If the ESXi host is managed by VirtualCenter/vCenter Server, disconnect and remove the ESXi host from the vCenter Server.
- Connect to the ESXi Shell please see Using ESXi Shell in ESXi 5.x, 6.x and 7.x
- 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