Configuring DNS
You can configure virtual routers to act as name resolvers for Domain Name Service (DNS). DNS is a client/server mechanism that maps IP addresses to hostnames.
The name resolver is the client side of DNS and receives address-to-hostname requests from its own clients when they want to contact hosts on other networks. By polling name servers, the name resolver learns name-to-address translations for the hosts its clients want to contact.
A name server may provide the translation from its cache or may poll servers lower in the DNS hierarchy to obtain a translation. Typically, name servers at the top of the hierarchy recognize top level domain names and know which servers to contact for information about more detailed domain names. See Figure 24.
![]()
DNS messages from a name resolver to a name server must include the domain name for the resolver's clients. Consequently, you must specify a default domain name for the clients. The default domain name is appended to unqualified hostnames (those without domain names).
The name resolver must be able to access at least one name server. Accordingly, you must configure a static route to a gateway that provides access to the name server and assign the name server to the name resolver. For more information, see Assigning Name Servers.
Each virtual router can have its own name resolver and domain name. However, if two virtual routers use the same name servers and belong to the same local domain, you do not need to configure name resolvers on both virtual routers. For more information, see Using One Name Resolver for Multiple Virtual Routers.
References
For more information about the DNS, consult the following resources:
- RFC 1035Domain Names Implementation and Specification (November 1987)
- RFC 2308Negative Caching of DNS Queries (DNS NCACHE) (March 1998)
Assigning Name Servers
To assign name servers to the system:
- Access the virtual router context.
- Define static routes to the gateways that provide access to the name servers.
- Enable the virtual router to query name servers.
- Specify a default domain name for the hosts.
- Specify the name servers.
Example
host1(config)#virtual-router bostonhost1:boston(config)#ip route 0.0.0.0 0.0.0.0 gatewayIpAddresshost1:boston(config)#ip domain-lookuphost1:boston(config)#ip domain-name urlofinterest.comhost1:boston(config)#ip name-server 10.2.0.3host1:boston(config)#ip name-server 10.2.5.5ip domain-lookup
- Use to enable the system to query the configured DNS name servers when it needs an IP-hostname-to-IP-address translation.
- Domain lookup is disabled by default.
- Example
host1(config)#ip domain-lookupUse the no version to disable domain lookup. ip domain-name
- Use to define a default domain name for the clients that a name resolver serves.
- You must define a default domain name for each name resolver. Multiple name resolvers can use the same default domain name.
- If you map an unqualified hostname (one without a domain name) to an IP address with the host ftp command, the domain name is appended to the hostname before the name is stored in the host table.
- Example
host1(config)#ip domain-name bigcompany.comUse the no version to delete the domain name; that is, the domain name will no longer be appended to hostnames in the static host table. ip name-server
- Use to specify a DNS name server that the system can query for hostname-to-IP-address resolution.
- This command supports both IPv4 and IPv6 addressing formats.
- Example
host1(config)#ip name-server 192.168.25.100 1:2:3:4:5:6:7:8:9:0:a:b:c:d:e:fUse the no version to delete the name server. Using One Name Resolver for Multiple Virtual Routers
You can use one name resolver for multiple virtual routers if those virtual routers use the same name servers and belong to the same local domain. To do so, complete the following steps:
- Configure a name resolver for the first virtual router.
- Access the context for the second virtual router.
- Specify that the second virtual router should use the name resolver you configured for the first virtual router.
- Repeat Steps 2 and 3 for other virtual routers that you want to point to this name resolver.
Example
To configure the virtual router boston to use the same name servers as the default router, enter the following commands.
host1(config)#virtual router bostonhost1:boston(config)#ip domain-lookup transit-virtual-router defaultip domain-lookup transit-virtual-router
- Use to configure a virtual router to use the name servers you configured for another virtual router.
- Example
host1:boston(config)#ip domain-lookup transit-virtual-router defaultUse the no version to stop a virtual router from using the same name servers you configured for another virtual router. Monitoring DNS
After you configure DNS, you can use the show ip domain-lookup command to view information about the name servers.
show ip domain-lookup
- Use to display the name servers that you have specified on the system with the
ip name-server command.- Field descriptions
- Bind to clientName of the virtual router context in parentheses, followed by the name of the virtual router providing the name resolver
- Using following Domain Name ServersName servers you assigned
- Using following Local Domain NamesDefault domain names you specified
host1#show ip domain-lookupBind to client: (boston)defaultUsing following Domain Name Servers:10.2.0.311.1.1.110.1.1.11:2:3:4:5:6:7:8:9:0:a:b:c:d:e:fUsing following Local Domain Names :urlofinterest.comconcord