The hosts file is used to map hostnames or domain names to IP addresses. You can configure entries in the /etc/hosts file using esxcli commands, which allows the modifcation to remain when rebooting the ESXi host.

Procedure

  1. Open an SSH connection to the host.
  2. Log in as the root user.
  3. Run the following command.
    Option Description
    add To add the hostname and IP address mapping, run the following command.
    esxcli network ip hosts add --ip 
    remove
    To remove a hostname mapping from the configuration, run the following command.
    esxcli network ip hosts remove --hostname
    For example: esxcli network ip hosts remove --hostname www.samplehostname.com --ip xx.xx.xx.xx
    list To list the IP addresses and their associated DNS entries, run the following command.
    esxcli network ip hosts list 

    Where IP address is the address of the VMkernel adapter, hostname is the DNS entry you want to associate with the IP address, alaises is any alaises you wish to associate , and comment is a line about this entry.