Configure the DNS Client

About this task

Configure the Domain Name Service to establish the mapping between an IP name and an IPv4 or IPv6 address. DNS supports IPv4 and IPv6 addresses with no difference in

functionality or configuration using CLI.

You can configure connection for up to three different DNS servers—primary, secondary and tertiary. First the primary server is queried, and then the secondary, and finally the tertiary.

Procedure

  1. Enter Global Configuration mode:

    enable

    configure terminal

  2. Configure the DNS client:

    ip domain-name WORD<0–255>

  3. Optional: Add addresses for primary, secondary, or tertiary DNS servers:

    ip name-server <primary|secondary|tertiary> WORD<0–46>

  4. Optional: Delete addresses for primary, secondary, or tertiary DNS servers:

    no ip name-server <primary|primary-dynamic|secondary|secondary-dynamic|tertiary|tertiary-dynamic> WORD<0–46>

  5. View the DNS client system status:

    show ip dns

Example

Switch:1> enable

Switch:1# configure terminal

Add addresses for a tertiary DNS server:

Switch:1(config)# ip name-server tertiary 254.104.201.141

Delete address for a secondary dynamic DNS server:

Switch:1(config)#no ip name-server secondary-dynamic 192.0.2.12

Variable Definitions

The following table defines parameters for the ip domain-name command.

Variable

Value

WORD<0–255>

Configures the default domain name.

WORD<0–255> is a string 0–255 characters.

The following table defines parameters for the ip name-server command.

Variable

Value

primary|secondary|tertiary WORD<0–46>

Configures the primary, secondary, or tertiary DNS server address. Enter the IP address in a.b.c.d format for IPv4 or hexadecimal format (string length 0–46) for IPv6. You can specify the IP address for only one server at a time; you cannot specify all three servers in one command. Use the no operator before this parameter, no ip name-server <primary|secondary|tertiatry>