Configuring the DNS client

Procedure
  1. Configure one or more DNS name servers with the command ip dns server.
  2. To resolve DNS requests by appending a domain name to the requests, either configure a single domain name with the command ip dns domain-name, or configure a list of up to six domain names with the command ip dns domain-list.
  3. To use static name resolution for certain hosts, associate an IP address to a host with the command ip dns host.
  4. Review your DNS configuration settings with the command show ip dns.

Examples

This example creates the following configuration:

  • Defines the domain switch.com to append to all requests.
  • Defines a DNS server with IPv4 address of 1.1.1.1.
  • Defines a static DNS host named myhost1 with an IPv4 address of 3.3.3.3.
  • DNS client traffic is sent on the default VRF (named default).

switch(config)# ip dns domain-name switch.com
switch(config)# ip dns server-address 1.1.1.1
switch(config)# ip dns host myhost1 3.3.3.3
switch(config)# exit
switch# show ip dns

VRF Name : vrf_mgmt

Host Name                                                        Address
--------------------------------------------------------------------------------


VRF Name : vrf_default
Domain Name : switch.com
DNS Domain list : 
Name Server(s) : 1.1.1.1

Host Name                                                        Address
--------------------------------------------------------------------------------
myhost1       

This example creates the following configuration:

  • Defines three domains to append to DNS requests domain1.com, domain2.com, domain3.com with traffic forwarding on VRF mainvrf.
  • Defines a DNS server with an IPv6 address of c::13.
  • Defines a DNS host named myhost with an IPv4 address of 3.3.3.3.
switch(config)# ip dns domain-list domain1.com vrf mainvrf
switch(config)# ip dns domain-list domain2.com vrf mainvrf
switch(config)# ip dns domain-list domain3.com vrf mainvrf
switch(config)# ip dns server-address c::13
switch(config)# ip dns host myhost 3.3.3.3 vrf mainvrf
switch(config)# quit
switch# show ip dns mainvrf

VRF Name : mainvrf
Domain Name : 
DNS Domain list : domain1.com, domain2.com, domain3.com
Name Server(s) : c::13

Host Name                                                        Address
--------------------------------------------------------------------------------
myhost                                                           3.3.3.3