Enabling Domain Name Services
Problem
You want to configure your router to use DNS to resolve hostnames.
Solution
To configure the router to use DNS to resolve hostnames, you need to specify a domain name and at least one nameserver:
Router1#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router1(config)#ip domain-lookupRouter1(config)#ip domain-nameRouter1(config)#oreilly.comip name-serverRouter1(config)#172.25.1.1ip name-serverRouter1(config)#10.1.20.5endRouter1#
Tip
Starting in IOS Version 12.2, Cisco changed the command syntax from ip domain-lookup to ip domain lookup. They also changed the command syntax from ip domain-name to ip domain name. The new IOS software still accepts previous versions of the commands.
Discussion
As we mentioned in Recipe
2.10, you can configure your router to use Domain Name Service
(DNS) to resolve hostnames. In fact, Cisco routers have DNS name
resolution enabled by default. However, since there is no default
nameserver, the router will attempt to use the local broadcast
address, 255.255.255.255, until you
explicitly configure a proper nameserver. This means that the
ip domain-lookup configuration
command in the example is necessary only if someone has explicitly
disabled DNS on the router.
After you configure the router with a valid nameserver, you can access any hostname that is known by your DNS server. For example, our DNS server exchanges information with the public Internet, so we can ping the Cisco web page ...