In this example there is a router with a hostname of “router-2″ that has a serial interface configured with the Internet Protocol (IP) address of 172.16.4.2. Without an entry in the host table of the router or a Domain Name System (DNS) server I cannot use the hostname of the router in order to ping or telnet to the device.

router-1#ping router-2
Translating “router-2″
% Unrecognized host or address, or protocol not running.

router-1#telnet router-2
Translating “router-2″
% Unknown command or computer name, or unable to find computer address

To create a host table entry that provides name resolution for “router-2″ that points to IP address 172.16.4.2 I use the following commands.

router-1#config t
Enter configuration commands, one per line. End with CNTL/Z.
router-1(config)#ip host router-2 23 172.16.4.2
router-1(config)#^Z

The above command “ip host” is provided the name of the device (router-2), default telnet port (23) and the IP address of the router. I may then check this entry using the “show hosts” command.

router-1#show hosts
Default domain is not set
Name/address lookup uses static mappings

Host Flags Age Type Address(es)
router-2 (perm, OK) 0 IP 172.16.4.2

Additionally, I may test the entry by pinging and telnetting to the router using the hostname provided in the host table.

router-1#ping router-2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echoes to 172.16.4.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms
router-1#telnet router-2
Trying router-2 (172.16.4.2)… Open
User Access Verification

Password:

Enjoy!