ip dns

Configures the Domain Name System (DNS) domain name and the primary and five additional name server IP addresses.

Syntax

ip dns { domain-name domain-name | name-server ip-addr }
ip dns name-server [ source-interface { ethernet eth-id | loopback loopback-id | management mgmt-addr | ve ve-id } ]
ip dns name-server { ip-addr use-vrf vrf name }
no ip dns { domain-name domain-name | name-server ip-addr }
no ip dns name-server [ source-interface { ethernet eth-id | loopback loopback-id | management mgmt-addr | ve ve-id } ]

Parameters

domain-name domain-name
Specifies the DNS domain name.
name-server ip-addr
Specifies the IPv4 or IPv6 address of the name server.
source-interface
Indicates the type of interface to use as the source interface or address.
ethernet eth-id
Specifies the Ethernet interface to use as the source interface, in slot/port format (0/1).
loopback loopback-id
Specifies the Loopback interface to use as the source interface.
management mgmt-addr
Specifies the management address (active MM or chassis IP) to use as the source address.
ve ve-id
Specifies the VE interface to use as the source interface.
use-vrf vrfname
Specifies the VRF to connect to the DNS server.

Modes

Global configuration mode

Usage Guidelines

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

Examples

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.1 
 
This 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

Example

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