6.5

Table Of Contents
Procedure
1 Print a list of DNS servers congured on the system in the order in which they will be used.
esxcli <conn_options> network ip dns server list
If DNS is not set up for the target server, the command returns an empty string.
2 Add a server by running esxcli network ip dns server add and specifying the server IPv4 or IPv6
address.
esxcli <conn_options> network ip dns server add --server=<str>
3 Change the DNS seings.
n
Specify the DNS server by using the --dns option and the DNS host.
esxcli <conn_options> network ip dns server add --server=<server>
Run the command multiple times to specify multiple DNS hosts.
n
Congure the DNS host name for the server specied by --server or --vihost.
esxcli <conn_options> system hostname set --host=<new_host_name>
n
Congure the DNS domain name for the server specied by --server or --vihost.
esxcli <conn_options> system hostname --domain=mydomain.biz
4 To turn on DHCP, enable DHCP and set the VMkernel NIC.
n
Turn on DHCP for IPv4.
esxcli <conn_options> network ip interface ipv4 set --type dhcp/none/static
esxcli <conn_options> network ip interface ipv4 set --peer-dns=<str>
n
Turn on DHCP for IPv6.
esxcli <conn_options> network ip interface ipv6 set --enable-dhcpv6=true/false
esxcli <conn_options> network ip interface ipv6 set --peer-dns=<str>
Modify DNS Setup for a Preconfigured Server with ESXCLI
You can use ESXCLI to modify the setup of a precongured DNS server.
Specify one of the options listed in “Connection Options for vCLI Host Management Commands,” on
page 19 in place of <conn_options>.
Procedure
1 Display DNS properties for the specied server.
a List the host and domain name.
esxcli <conn_options> system hostname get
b List available DNS servers.
esxcli <conn_options> network ip dns server list
c List the DHCP seings for individual VMkernel NICs.
esxcli <conn_options> network ip interface ipv4 get
esxcli <conn_options> network ip interface ipv6 get
vSphere Command-Line Interface Concepts and Examples
150 VMware, Inc.