Mapping hostnames to IP addresses

You can define static hostname-to-address mappings on your IOS device in order to provide name resolution. This is usually done in environments without a DNS server. The mappings are defined by using the global configuration command ip host HOSTNAME IP_ADDRESS, like in this example:

ip host command

In the example above we’ve defined an IP address of for the hostname HQ_SERVER. To display the hostname-to-address mappings, run the show hosts command:

show hosts command

To verify that the hostnames are being resolved, we will ping the other device using the hostname:

ping hostname

You can see that the other device has responded, which means that the name resolution was successful.

The drawback of this method of name resolution is that you need to create static hostname-to-address mapping on each device in order to be able to resolve names. If possible, use DNS instead.
Geek University 2021