Configure a DNS Domain and Gateway Addresses

  1. Access global configuration mode.
    device# configure terminal
  2. Configure the domain name.
    device(config)# ip dns domain-name mycompany.com
  3. Configure the default DNS gateway address for primary DNS server.
    device(config)# ip dns name-server 10.157.22.199
                        

    The first DNS server IP address added to the domain name configuration will be considered the Primary DNS server. You can add up to five (5) additional DNS servers for the domain name. Any combination of IPv4 or IPv6 DNS name servers can be configured. For example, you could choose to add 2 IPv6 name servers alongside 4 IPv4 name servers. However, you cannot add more than six name servers for the domain.

    If you add more than six name servers for the domain, the following error message displays.

    too many 'ip dns name-server', 7 configured, at most 6 must be configured
  4. Return to privileged EXEC mode.
    device(config)# exit
                        
  5. (Optional) Verify the DNS configuration.
    device# traceroute mycompany.com
    
    Sending DNS Query to 10.157.22.199
    Tracing Route to IP node 10.157.22.80
    To ABORT Trace Route, Please use stop-traceroute command.
    Traced route to target IP node 10.157.22.80:
    IP Address    Round Trip Time1    Round Trip Time2
    10.95.6.30    93 msec             121 msec
                        
    The output shows that 10.157.22.199 is the IP address of the DNS server (default DNS gateway address), and 10.157.22.80 represents the IP address of the mycompany.com host.

The following example configures a DNS domain and default and additional secondary DNS name server addresses for the domain www.mycompany.com.

device# configure terminal
device(config)# ip dns domain-name www.mycompany.com
device(config)# ip dns name-server 10.157.22.199
device(config)# exit
device(config)# ip dns name-server 10.96.7.15
            

This example configures six (6) DNS name servers for the domain www.mycompany.com. Of these six (6) domain names, two (2) are IPv6 DNS resolvers.

device# configure terminal
device(config)# ip dns domain-name www.mycompany.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