ip dns

Configures the Domain Name System (DNS) domain name and the primary and secondary 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 } ]
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.

Modes

Global configuration mode

Usage Guidelines

Your first run of ip dns name-server specifies the default IP gateway address. Your second run of ip dns name-server specifies the secondary IP gateway address.

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.

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/default-vrf)# source-interface ethernet 0/1