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.
Figure 24: DNS Hierarchy Example

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 1035—Domain Names – Implementation and Specification (November 1987)
- RFC 2308—Negative 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 gatewayIpAddress host1:boston(config)#ip domain-lookup host1:boston(config)#ip domain-name urlofinterest.com host1:boston(config)#ip name-server 10.2.0.3 host1:boston(config)#ip name-server 10.2.5.5
ip 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.
- Examplehost1(config)#ip domain-lookup
- Use the no version to disable domain lookup.
- See ip 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.
- Examplehost1(config)#ip domain-name bigcompany.com
- Use 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.
- See ip domain-name.
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.
- Examplehost1(config)#ip name-server 192.168.25.100 1:2:3:4:5:6:7:8:9:0:a:b:c:d:e:f
- Use the no version to delete the name server.
- See ip 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.
ip domain-lookup
- Use to configure a virtual router to use the name servers you configured for another virtual router.
- Examplehost1:boston(config)#ip domain-lookup transit-virtual-router default
- Use the no version to stop a virtual router from using the same name servers you configured for another virtual router.
- See ip domain-lookup.
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 client—Name of the virtual router context in parentheses, followed by the name of the virtual router providing the name resolver
- Using following Domain Name Servers—Name servers you assigned
- Using following Local Domain Names—Default domain names you specified
- Example—The virtual router boston uses the name resolver on the default virtual router.
host1#show ip domain-lookup Bind to client: (boston)default Using following Domain Name Servers: 10.2.0.3 11.1.1.1 10.1.1.1 1:2:3:4:5:6:7:8:9:0:a:b:c:d:e:f Using following Local Domain Names : urlofinterest.com concord
- See show ip domain-lookup.
Hide Navigation Pane
Show Navigation Pane
SHA1