Configure DNS for host-name resolution
You use DNS to access either local or remote sources for host information. You must configure DNS to access one or both of these sources.
ONTAP must be able to look up host information to provide proper access to clients. You must configure name services to enable ONTAP to access local or external DNS services to obtain the host information.
ONTAP stores name service configuration information in a table that is the equivalent of the /etc/nsswitch.conf
file on UNIX systems.
Configure an SVM and data LIFs for host-name resolution using an external DNS server
You can use the vserver services name-service dns
command to enable DNS on an SVM, and configure it to use DNS for host-name resolution. Host names are resolved using external DNS servers.
A site-wide DNS server must be available for host name lookups.
You should configure more than one DNS server to avoid a single-point-of-failure. The vserver services name-service dns create
command issues a warning if you enter only one DNS server name.
See Configure dynamic DNS services for more information about configuring dynamic DNS on the SVM.
-
Enable DNS on the SVM:
vserver services name-service dns create -vserver <vserver_name> -domains <domain_name> -name-servers <ip_addresses> -state enabled
The following command enables external DNS server servers on the SVM vs1:
vserver services name-service dns create -vserver vs1.example.com -domains example.com -name-servers 192.0.2.201,192.0.2.202 -state enabled
The vserver services name-service dns create
command performs an automatic configuration validation and reports an error message if ONTAP cannot contact the name server. -
Validate the status of the name servers by using the
vserver services name-service dns check
command.vserver services name-service dns check -vserver vs1.example.com Name Server Vserver Name Server Status Status Details ------------- --------------- ------------ -------------------------- vs1.example.com 10.0.0.50 up Response time (msec): 2 vs1.example.com 10.0.0.51 up Response time (msec): 2
For information about service policies that relate to DNS, see LIFs and service policies in ONTAP 9.6 and later.
Configure the Name Service Switch Table for Host-Name Resolution
You must configure the name service switch table correctly to enable ONTAP to consult local or external name service to retrieve host information.
You must have decided which name service to use for host mapping in your environment.
-
Add the necessary entries to the name service switch table:
vserver services name-service ns-switch modify -vserver <vserver_name> -database <database_name> -source <source_names>
-
Verify that the name service switch table contains the expected entries in the desired order:
vserver services name-service ns-switch show -vserver <vserver_name>
The following example modifies an entry in the name service switch table for SVM vs1 to first use the local hosts file and then an external DNS server to resolve host names:
vserver services name-service ns-switch modify -vserver vs1 -database hosts -sources files,dns