How-to: Avoid DNS lookup when mistyping a command

If domain lookup is enabled (default) the router treats each mistyped command as a hostname and tries to resolve its IP address by querying the DNS server.

This behavior is undesirable in most cases because it wastes network administrators time waiting for routers trying to resolve mistyped commands.

R2#xyz
Translating "xyz"...domain server (255.255.255.255)

Translating "xyz"...domain server (255.255.255.255)
 (255.255.255.255)
Translating "xyz"...domain server (255.255.255.255)
% Unknown command or computer name, or unable to find computer address

This waste of time can be avoided with one of the following solutions:

Solution1:Disabling domain lookup:

This solutions is suitable to LAB environments when your routers do not actually have any name servers configured on them; which means trying the lookup hostnames is totally a waste of time.

R2(config)#no ip domain lookup

Solution2: Allowing name lookup but stopping the router from initiating connection without typing the telnet keyword:

In this case you can still resolve hostnames into IPs while avoiding this default behavior or trying to initiate connections to each typed hostname. This solution is suitable to networks where domain lookup is needed. Assuming you are using the console to access the router:

R2(config)#ip domain lookup
R2(config-line)#line con 0
R2(config-line)#transport preferred none

This is a useful command to configure on your devices, as it  really saves a lot of time specially for those who do a lot of typos :)


No related posts.


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

3 Responses to “How-to: Avoid DNS lookup when mistyping a command”

  1. It was a really nice theme! Just wanna say thank you for the selective information you have fanned. Just continue publishing this kind of post. I will be your patriotic reader. Thanks again.

  2. Dave Guerra Says:

    I have been recently reading your posts and they are great!

    I just want to let you know there is typo in your Solution1, above it should be “no ip domain-lookup” you’re just missing a hyphen.

  3. 12.2
    The syntax of the command changed from ip domain-lookup to ip domain lookup.

Leave a Reply