Configures the Domain Name System (DNS) domain name and the primary and five additional name server IP addresses.
Global configuration mode
Your first run of ip dns name-server specifies the default IP gateway address. Subsequent runs of the ip dns name-server command specifies the secondary and other IP gateway addresses.
Name servers can only be entered or removed one at a time. The newly entered name server is appended to the existing name server.
When a source interface is not specified, the default source is the IP address of the interface from which the packet egresses.
If, at run time, the source interface is not up, or the IP address for the source interface was not configured, the command behaves as though the source interface was not configured.
Use the no form of the command with the domain-name parameter to disable IP-directed broadcasts for a specific domain.
Use the no form of the command with the name-server parameter to delete a name server definition. You can delete one name-server at a time.
Any combination of IPv4 or IPv6 DNS name servers can be configured. You could choose to add 2 IPv6 name servers alongside 4 IPv4 name servers. However, you cannot add more than six name servers for a domain.
If you add more than six name servers for a domain, an error message displays.
too many 'ip dns name-server', 7 configured, at most 6 must be configured
The following example configures the DNS domain name and the primary name server IP address.
device# configure terminal device(config)# ip dns domain-name mycompany.com device(config)# ip dns name-server 10.70.20.1This example identifies an Ethernet interface as the source interface.
device# configure terminal device(config)# ip dns name-server 1.1.1.1 device(config-name-server-1.1.1.1/mgmt-vrf)# source-interface ethernet 0/1
This example configures six (6) DNS name servers for the domain www.example.com. Of these six (6) domain names, two (2) are IPv6 DNS resolvers.
device# configure terminal device(config)# ip dns domain-name www.example.com device(config)# ip dns name-server 10.24.15.150 device(config)# ip dns name-server 10.24.18.125 device(config)# ip dns name-server 172.26.71.80 device(config)# ip dns name-server 200:f8::ed:3000 device(config)# ip dns name-server 2001:eb::780:ff87 device(config)# ip dns name-server 10.37.89.80