Mapping Hostnames to IP Addresses

Like all network equipment, routers work naturally with numeric IP addresses. However, using IP addresses isn't convenient for humansincluding network administrators. It is much more convenient to work with hostnames. Like any other network host, routers implement DNS and can use DNS to look up IP addresses. But the use of DNS presents a problem in a routing environment. If the router can't access the Internet, it can't look up addresses; one reason that the router might not be able to access the Internet could be a routing problem; and if the router is configured to use DNS but can't access the Internet, you will have trouble using the commands needed to diagnose and fix the problem.

There is a good halfway point, however. Like other network hosts, the router can maintain a host table, and you can place any IP addresses that appear in your configuration in the host table. You can then use DNS to look up any hostnames that aren't actually involved in the router's configuration. This will make it easier to understand the output from show commands or to use commands such as ping to check your network connectivity.

3.5.1. IP Host Tables

The ip host command builds and maintains the router's host table. This command takes a hostname, followed by one or more IP addresses. You can have up to eight IP addresses per hostname.

ip host pyramid 10.10.1.3
ip host sphinx 10.10.1.2 10.10.1.4 10.10.1.5

Deleting a host requires you to type the entire hostname and IP address over again!

no ip host pyramid 10.10.1.3
no ip host sphinx 10.10.1.2 10.10.14 10.10.1.5

 

3.5.2. Enabling DNS

The Domain Name System (DNS) reduces the need for host entriesalthough, as I said before, you should have explicit host entries for any IP addresses that appear in your configuration. DNS is enabled by default; to enable it explicitly, use the command ip domain-lookup. To configure DNS, you must specify one or more name servers and the domain name to be used to complete unqualified names (typically, your own domain name). A typical configuration looks like this:

! Specify the DNS servers
ip name-server 10.10.9.1
ip name-server 10.10.9.2
!
! Set the name for unqualified hostnames
ip domain-name your-domain.com

To disable DNS lookups, use the no form of the command:

no ip domain-lookup

To re-enable DNS lookups, leave off the no keyword:

! Enable DNS lookups
ip domain-lookup

Use the show hosts command to view the cached hostnames and the DNS configuration:

Router>show hosts
Default domain is your-domain.com
Name/address lookup uses domain service
Name servers are 10.10.9.1 10.10.9.1

Host Flags Age Type Address(es)
Foxtrot (temp, OK) 18 IP 10.10.1.3
sphinx (temp, OK) 18 IP 10.10.1.2


Getting Started

IOS Images and Configuration Files

Basic Router Configuration

Line Commands

Interface Commands

Networking Technologies

Access Lists

IP Routing Topics

Interior Routing Protocols

Border Gateway Protocol

Quality of Service

Dial-on-Demand Routing

Specialized Networking Topics

Switches and VLANs

Router Security

Troubleshooting and Logging

Quick Reference

Appendix A Network Basics

Index



Cisco IOS in a Nutshell
Cisco IOS in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596008694
EAN: 2147483647
Year: 2006
Pages: 1031
Authors: James Boney

Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net