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 :)

Check Also

Best AI tools list