The resolv.conf file is used to configure centrally managed DNS servers. You can configure entries in the /etc/resolv.conf file using esxcli commands, which allows the modification to remain when rebooting the ESXi host. The property can be set explicitly if DHCP is not enabled.

Procedure

  1. Open an SSH connection to the host.
  2. Log in as the root user.
  3. Run the following command.
    Option Description
    Add DNS server To add a new DNS server to the end of the list of DNS servers to use for this ESXi host.
    esxcli network ip dns server add

    Command Options

    -N|--netstack=<str>

    The network stack instance. If it is not specified, then use the default netstack instance.

    -s|--server=<str>
    The IPV4 or the IPV6 address of the DNS server that you want to add to the DNS server list.
    Note: This command is required.
    For example: esxcli network ip dns server add -N vmotion -s xx.xx.xx.xx
    Add DNS search To add a search domain to the list of domains to be searched when trying to resolve a host name on the ESXi host.
    esxcli network ip dns search add

    Command Options

    -d|--domain=<str>
    The string name of a domain that you want to add to the list of search domains.
    Note: This command is required.
       -N|--netstack=<str>

    The network stack instance. If it is not specified, then use the default netstack instance.

    Remove DNS server To remove a DNS server from the list of DNS servers to use for this ESXi host.
    esxcli network ip dns server removeIP address

    Command Options

    -a|--all
    -N|--netstack=<str>

    The network stack instance. If it is not specified, then use the default netstack instance.

    -s|--server=<str>
    Remove DNS search To remove a search domain to the list of domains to be searched when trying to resolve an host name on the ESXi host.
    esxcli network ip dns search remove

    Command Options

    -d|--domain=<str>
    The string name of a domain that you want to remove from the list of search domains.
    Note: This command is required.
    -N|--netstack=<str>

    The network stack instance. If it is not specified, then use the default netstack instance.

    List DNS search To print a list the DNS server currently configured on the system in the order in which they will be used.
    esxcli network ip dns server list

    Command Options

    -N|--netstack=<str>

    The network stack instance. If it is not specified, then use the default netstack instance.

    For example: esxcli network ip dns server list -N vmotion
    List DNS search domain

    To list the search domains currently configured on the ESXi host in the order in which they will be used while searching.

    esxcli network ip dns search list -N

    Command Options

    ---N|--netstack=<str>

    The network stack instance. If it is not specified, then use the default netstack instance.

    For example: esxcli network ip dns search list -N vmotion