Overview

Name resolution must be configured for communication by specifying the host name instead of the IP address. This section describes the configuration of name resolution on Cisco IOS.

Name Resolution Configuration

The following configuration for name resolution on Cisco IOS is described.

  • Enable Name Resolution
  • DNS Server Configuration
  • Host Name/Domain Name Configuration
  • Host Table Configuration

Enable Name Resolution

To enable name resolution, enter the following command in global configuration mode

Enable Name Resolution

(config)#ip domain lookup

(config)#ip domain-lookup is similar. The format with “-” is the old command format. Old command formats are recognized.

Name resolution is enabled by default, so there is no need to enter the ip domain lookup command again to enable name resolution. However, by default, the IP address of the DNS server is not configured. When you try to communicate by specifying a hostname, broadcasting (255.255.255.255) to try to find a DNS server. When looking for a DNS server by broadcast, the following is displayed in the console.

R1#ping www.google.co.jp

Translating "www.google.co.jp"...domain server (255.255.255.255)
% Unrecognized host or address, or protocol not running.

R1#

Note that you will not be able to operate the console during this time. If you do not need name resolution on your router, it is better to disable name resolution with the no ip domain lookup command.

DNS Server Configuration

To configure the IP address of the DNS server, enter the following command in global configuration mode

DNS Server Configuration

(config)#ip name-server <ip-address>

<ip-address> : IP address of DNS server

Multiple ip name-server commands can be configured. In that case, DNS name queries are sent in the order in which they are configured. Therefore, the primary DNS server should be configured first.

Host Name/Domain Name Configuration

To configure the host and domain names, enter the following commands in global configuration mode

Host Name/Domain Name Configuration

(config)#hostname <hostname>
(config)#ip domain name <domain-name>

<hostname> : Host name
<domain-name> : Domain name

When only a host name is specified, is added as a suffix to perform name resolution. Multiple domain names can also be configured.To configure multiple domain names, enter the following command in global configuration mode

Domain list configuration

(config)#ip domain list <domain-name>

<domain-name> : Domain name

Host Table Configuration

You can also statically configure the correspondence between hostname and IP address. Enter the following command in global configuration mode

Static entry host table configuration

(config)#ip host <hostname> <ip-address> [<ip-address>]

<hostname> : Host name
<ip-address> : IP address

You can configure multiple IP addresses to be associated with a hostname. When multiple IP addresses are configured for a hostname, they are resolved in the order in which they are configured.

Name Resolution Verification

The following show commands are available to verify name resolution.

CommandContent
#show hostsDisplays name resolution activation, domain names, DNS server IP addresses, and host tables.
Table Name resolution verification commands
R1#show hosts
Default domain is n-study.com
Name/address lookup uses domain service
Name servers are 192.168.1.1

Codes: UN - unknown, EX - expired, OK - OK, ?? - revalidate
       temp - temporary, perm - permanent
       NA - Not Applicable None - Not defined

Host                      Port  Flags      Age Type   Address(es)
www.google.co.jp          None  (temp, OK)  0   IP    172.217.175.227
nest                      None  (perm, OK)  0   IP    192.168.1.1

Name Resolution Configuration Example

Configure the following name resolution configurations on R1.

ItemConfiguration Contents
Host nameR1
Domain namen-study.com
DNS Server IP address192.168.1.1
Static entry in host tablehost name:nest
IP address:192.168.1.1

R1 Name Resolution configuration

ip domain lookup
!
hostname R1
ip domain name n-study.com
ip name-server 192.168.1.1
ip host nest 192.168.1.1

When Ping is executed with the hostname “nest” on R1, the IP address of nest is resolved with a static entry in the host table and pinged to 192.168.1.1.

R1 Ping with hostname

R1#ping nest

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/64/76 ms

Internet access is available via Nest. “ping www.google.co.jp” will have response properly. The IP address of www.google.co.jp is resolved with DNS server.

R1 ping www.google.co.jp

R1#ping www.google.co.jp

Translating "www.google.co.jp"...domain server (192.168.1.1) [OK]

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.217.175.227, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/34/76 ms

The show hosts command also displays name resolution configurations and host table.

R1 show hosts

R1#show hosts
Default domain is n-study.com
Name/address lookup uses domain service
Name servers are 192.168.1.1

Codes: UN - unknown, EX - expired, OK - OK, ?? - revalidate
       temp - temporary, perm - permanent
       NA - Not Applicable None - Not defined

Host                      Port  Flags      Age Type   Address(es)
www.google.co.jp          None  (temp, OK)  0   IP    172.217.175.227
nest                      None  (perm, OK)  0   IP    192.168.1.1

Summary

Points

  • Routers and switches can also be configured for name resolution if necessary. Basic name resolution configurations include the following items
    • Host name/Domain name
    • DNS Server IP address
  • Host name/Domain name configuration command
    • (config)#hostname <hostname>
    • (config)#ip domain name <domain-name>
  • DNS Server IP address configuration command
    • (config)#ip name-server <ip-address>

Cisco Basic