It is possible to define static hostname-to-address mappings on a Cisco device for the purpose of name resolution. This is usually done in environments without a DNS server.
The mappings can be defined using the global configuration command ip host HOSTNAME IP_ADDRESS:
Floor1(config)#ip host HQ_SERVER 192.168.0.100
In the output above we’ve defined the IP address of 192.168.0.100 for the hostname HQ_SERVER. To display the hostname-to-address mappings, the show hosts command is used:
Floor1#show hosts Default Domain is not set Name/address lookup uses domain service Name servers are 255.255.255.255 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) HQ_SERVER None (perm, OK) 0 IP 192.168.0.100
We can ping the server using its hostname to verify that the hostnames are being resolved:
Floor1#ping HQ_SERVER Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.0.100, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms
You can see that HQ_SERVER responded to the ping request, which means that the name resolution was successful.