Set Up a DNS Server
with ESXCLI
You can use ESXCLI
to set up a DNS server.
The following example
illustrates setting up a DNS server. Specify one of the options listed in
Connection Options for ESXCLI Host Management Commands
in place of
<conn_options>
.
- Print a list of DNS servers configured on the system in the order in which they will be used.esxcli <conn_options> network ip dns server listIf DNS is not set up for the target server, the command returns an empty string.
- Add a server by runningesxcli network ip dns server addand specifying the server IPv4 or IPv6 address.esxcli <conn_options> network ip dns server add --server=<str>
- Change the DNS settings.
- Specify the DNS server by using the--dnsoption and the DNS host.
Run the command multiple times to specify multiple DNS hosts.esxcli <conn_options> network ip dns server add --server=<server> - Configure the DNS host name for the server specified by--serveror--vihost.esxcli <conn_options> system hostname set --host=<new_host_name>
- Configure the DNS domain name for the server specified by--serveror--vihost.esxcli <conn_options> system hostname --domain=mydomain.biz
- To turn on DHCP, enable DHCP and set the VMkernel NIC.
- 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>
- 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>