Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Community Member

Can IOS do an nslookup?

I have a switch configured to resolve hostnames, it works fine, if I ping xxx.xxx.local or whatever it looks up the IP and displays output.

Can this be done in reverse? So If I find an IP address in the arp table and want to resolve its hostname, is there a command like Windows nslookup that will allow for this?

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: Can IOS do an nslookup?

There is nothing built-in, but attached is a Tcl script I wrote to do A and PTR DNS lookups using the IOS tclsh (in IOS 12.3(2)T or later, 12.2(18)SXF5 or higher, 12.2(40)SE or higher, etc.). Tclsh doesn't support UDP sockets right now, so my script uses TCP. It works similarly to the UNIX host command. If you do not specify a DNS server, it tries to obtain one by looking at the device's config. The usage is:

host.tcl address [dns_server]

For example:

Router#tclsh flash:host.tcl 10.1.1.1

1.1.1.10.in-addr.arpa domain name pointer host.company.com

Router#tclsh flash:host.tcl host.company.com

host.company.com has address 10.1.1.1

The script is pretty simplistic, but it should accomplish what you want.

7 REPLIES
Cisco Employee

Re: Can IOS do an nslookup?

There is nothing built-in, but attached is a Tcl script I wrote to do A and PTR DNS lookups using the IOS tclsh (in IOS 12.3(2)T or later, 12.2(18)SXF5 or higher, 12.2(40)SE or higher, etc.). Tclsh doesn't support UDP sockets right now, so my script uses TCP. It works similarly to the UNIX host command. If you do not specify a DNS server, it tries to obtain one by looking at the device's config. The usage is:

host.tcl address [dns_server]

For example:

Router#tclsh flash:host.tcl 10.1.1.1

1.1.1.10.in-addr.arpa domain name pointer host.company.com

Router#tclsh flash:host.tcl host.company.com

host.company.com has address 10.1.1.1

The script is pretty simplistic, but it should accomplish what you want.

Community Member

Re: Can IOS do an nslookup?

Thats pretty cool. Thanks!

Community Member

Re: Can IOS do an nslookup?

Thanks Joseph,

Added the alias to makes things easier and lazier...

#alias exec host tclsh flash:host.tcl

Cisco Employee

Re: Can IOS do an nslookup?

Community Member

Can IOS do an nslookup?

Joe,

The above link you posted is not working. Is the updated script still available?

Thanks.

Cisco Employee

Can IOS do an nslookup?

Community Member

On my 2940 switch I can issue

On my 2940 switch I can issue the traceroute command on an ip address and it will do a reverse DNS lookup. Be sure to remember the CTRL+Shift+6 handy as traceroute can go for a while sometimes.
 

22851
Views
5
Helpful
7
Replies
CreatePlease to create content