DNS Client Commands

This chapter contains the following sections:

clear host

Use the clear host command in privileged EXEC mode to delete dynamic hostname-to-address mapping entries from the DNS client name-to-address cache.

Syntax

clear host {hostname | *}

Parameters

  • hostname—Name of the host for which hostname-to-address mappings are to be deleted from the DNS client name-to-address cache.

  • *—Specifies that all the dynamic hostname-to-address mappings are to be deleted from the DNS client name-to-address cache.

Default Configuration

No hostname-to-address mapping entries are deleted from the DNS client name-to-address cache.

Command Mode

Privileged EXEC mode

User Guidelines

To remove the dynamic entry that provides mapping information for a single hostname, use the hostname argument. To remove all the dynamic entries, use the * keyword.

To define a static hostname-to-address mappings in the DNS hostname cache, use the ip host command.

To delete a static hostname-to-address mappings in the DNS hostname cache, use the no ip host command.

Example

The following example deletes all dynamic entries from the DNS client name-to-address cache.

switchxxxxxx# clear host *

ip domain lookup

Use the ip domain lookup command in Global Configuration mode to enable the IP Domain Naming System (DNS)-based host name-to-address translation.

To disable the DNS, use the no form of this command.

Syntax

ip domain lookup

no ip domain lookup

Default Configuration

Enabled.

Command Mode

Global Configuration mode

Example

The following example enables DNS-based host name-to-address translation.

switchxxxxxx(config)# ip domain lookup

ip domain name

Use the ip domain name command in Global Configuration mode. to define a default domain name that the switch uses to complete unqualified hostnames (names without a dotted-decimal domain name).

To delete the static defined default domain name, use the no form of this command.

Syntax

ip domain name name

no ip domain name

Parameters

name—Default domain name used to complete unqualified host names. Do not include the initial period that separates an unqualified name from the domain name. Length: 1–158 characters. Maximum label length of each domain level is 63 characters.

Default Configuration

No default domain name is defined.

Command Mode

Global Configuration mode

User Guidelines

Any IP hostname that does not contain a domain name (that is, any name without a dot) will have the dot and the default domain name appended to it before being added to the host table.

Domain names and host names are restricted to the ASCII letters A through Z (case-insensitive), the digits 0 through 9, the underscore and the hyphen. A period (.) is used to separate labels.

The maximum size of each domain level is 63 characters. The maximum name size is 158 bytes.

Example

The following example defines the default domain name as ‘www.website.com’.

switchxxxxxx(config)# ip domain name website.com

ip domain polling-interval

Use the ip domain polling-interval command in Global Configuration mode to specify the polling interval.

Use the no form of this command to return to the default behavior.

Syntax

ip domain polling-interval seconds

no ip domain polling-interval

Parameters

seconds—Polling interval in seconds. The range is from (2*(R+1)*T) to 3600.

Default Configuration

The default value is 2 * (R+1) * T, where

  • R is a value configured by the ip domain retry command.

  • T is a value configured by the ip domain timeout command.

Command Mode

Global Configuration mode

User Guidelines

Some applications communicate with the given IP address continuously. DNS clients for such applications, which have not received resolution of the IP address or have not detected a DNS server using a fixed number of retransmissions, return an error to the application and continue to send DNS Request messages for the IP address using the polling interval.

Example

The following example shows how to configure the polling interval of 100 seconds:

switchxxxxxx(config)# ip domain polling-interval 100

ip domain retry

Use the ip domain retry command in Global Configuration mode to specify the number of times the device will send Domain Name System (DNS) queries when there is no replay.

To return to the default behavior, use the no form of this command.

Syntax

ip domain retry number

no ip domain retry

Parameters

number—Number of times to retry sending a DNS query to the DNS server. The range is from 0 to 16.

Default Configuration

The default value is 1.

Command Mode

Global Configuration mode

User Guidelines

The number argument specifies how many times the DNS query will be sent to a DNS server until the switch decides that the DNS server does not exist.

Example

The following example shows how to configure the switch to send out 10 DNS queries before giving up:

switchxxxxxx(config)# ip domain retry 10

ip domain timeout

Use the ip domain timeout command in Global Configuration mode to specify the amount of time to wait for a response to a DNS query.

To return to the default behavior, use the no form of this command.

Syntax

ip domain timeout seconds

no ip domain timeout

Parameters

seconds—Time, in seconds, to wait for a response to a DNS query. The range is from 1 to 60.

Default Configuration

The default value is 2 seconds.

Command Mode

Global Configuration mode

User Guidelines

Use the command to change the default time out value. Use the no form of this command to return to the default time out value.

Example

The following example shows how to configure the switch to wait 50 seconds for a response to a DNS query:

switchxxxxxx(config)# ip domain timeout 50

ip host

Use the ip host Global Configuration mode command to define the static host name-to-address mapping in the DNS host name cache.

Use the no form of this command to remove the static host name-to-address mapping.

Syntax

ip host hostname address1 [address2...address8]

no ip host name ip host name [address1...address8]

Parameters

  • hostname—Name of the host. (Length: 1–158 characters. Maximum label length of each domain level is 63 characters).

  • address1—Associated host IP address (IPv4 or IPv6, if IPv6 stack is supported).

  • address2...address8—Up to seven additional associated IP addresses, delimited by a single space (IPv4 or IPv6, if IPv6 stack is supported).

Default Configuration

No host is defined.

Command Mode

Global Configuration mode

User Guidelines

Host names are restricted to the ASCII letters A through Z (case-insensitive), the digits 0 through 9, the underscore and the hyphen. A period (.) is used to separate labels.

An IP application will receive the IP addresses in the following order:

  1. IPv6 addresses in the order specified by the command.

  2. IPv4 addresses in the order specified by the command.

Use the no format of the command with the address1...address8 argument to delete the specified addresses. The entry is deleted if all its addresses are deleted.

Example

The following example defines a static host name-to-address mapping in the host cache.

switchxxxxxx(config)# ip host accounting.website.com 176.10.23.1

ip name-server

Use the ip name-server command in Global Configuration mode to specify the address of one or more name servers to use for name and address resolution.

Use the no form of this command to remove the static specified addresses.

Syntax

ip name-server server1-address [server-address2...erver-address8]

no ip name-server [server-address1...server-address8]

Parameters

  • server-address1—IPv4 or IPv6 addresses of a single name server.

  • server-address2...server-address8—IPv4 or IPv6 addresses of additional name servers.

Default Configuration

No name server IP addresses are defined.

Command Mode

Global Configuration mode

User Guidelines

The preference of the servers is determined by the order in which they were entered.

Each ip name-server command replaces the configuration defined by the previous one (if one existed).

Example

The following example shows how to specify IPv4 hosts 172.16.1.111, 172.16.1.2, and IPv6 host 2001:0DB8::3 as the name servers:

switchxxxxxx(config)# ip name-server 172.16.1.111 172.16.1.2 2001:0DB8::3

show hosts

Use the show hosts command in privileged EXEC mode to display the default domain name, the style of name lookup service, a list of name server hosts, and the cached list of hostnames and addresses.

Syntax

show hosts [all | hostname]

Parameters

  • all—The specified host name cache information is to be displayed for all configured DNS views. This is the default.

  • hostname—The specified host name cache information displayed is to be limited to entries for a particular host name.

Command Mode

Privileged EXEC mode

Default Configuration

Default is all.

User Guidelines

This command displays the default domain name, a list of name server hosts, and the cached list of host names and addresses.

Example

The following is sample output with no parameters specified:

switchxxxxxx# show hosts
Name/address lookup is enabled
Domain Timeout: 3 seconds
Domain Retry: 4 times
Domain Polling Interval: 10 seconds
Default Domain Table
Source  Interface Preference Domain
static                       website.com
dhcpv6  vlan 100      1      qqtca.com
dhcpv6  vlan 100      2      company.com
dhcpv6  vlan 1100     1      pptca.com
Name Server Table
Source  Interface Preference  IP Address
static               1        192.0.2.204
static               2        192.0.2.205
static               3        192.0.2.105
DHCPv6      vlan 100 1        2002:0:22AC::11:231A:0BB4
DHCPv4      vlan 1   1        192.1.122.20
DHCPv4      vlan 1   2        154.1.122.20
Casche Table
Flags: (static/dynamic, OK/Ne/??)
OK - Okay, Ne - Negative Cache, ?? - No Response
Host Flag Address;Age...in preference order
example1.company.com (dynamic, OK) 2002:0:130F::0A0:1504:0BB4;1 112.0.2.10 176.16.8.8;123 124 173.0.2.30;39
example2.company.com (dynamic, ??)
example3.company.com (static, OK) 120.0.2.27
example4.company.com (dynamic, OK) 24 173.0.2.30;15
example5.company.com (dynamic, Ne); 12