Jump to content

Traceroute Hop Resolution Using SNMP

Recommended Posts

Our switches and routers aren't in DNS to make them addressable by hostname, so we use IP addresses.


This is fine, except when performing traceroutes within the network it's difficult to quickly understand which hops packets are being routed through.


We do have snmp access to these devices, so I was thinking if there was a tool that ran an snmpget for the device name against every hop, and printed it inline with the results it'd remove the need for the manual alternative.


Does this sound like the best way to achieve what I want? Anyone know of any tools that do this?


Edit: All Cisco kit if it matters. And needs to be a Linux CLI tool (running RHEL), so maybe this functionality could be scripted?



Edited by lew~

Share this post

Link to post
Share on other sites

Nope. I doubt any such tools exist since the much simpler solution is to add them to DNS. Why wouldn't you do this?


If you want the results pretty on one machine only you could put them in that machine's HOSTS file.

Share this post

Link to post
Share on other sites

I'm told they're not in DNS for security reasons. I'm not in a position to challenge/change that, so looks like that's not an option.


Keeping the hosts file up to date would be difficult I think.


I might try some dev forums and see if anyone would be willing to write a script that combines traceroute output with snmp queries.

Share this post

Link to post
Share on other sites

You faced similar problem that I wanted to solve. I searched a lot of web pages to find some script to do it and I realized I must to write it myself.


I want to get information about interface IPs from switches/ routers in a format similar to a host file so it can be easily added to a host file.

All devices are reachable through SNMP so I wrote a bash script for getting this information. I decided for bash because it is at almost every linux machine so it can be easily deployd. After adding the result to the host file a traceroute output shows hostname of the device and it name. Network prefix and interface description is added as a comment that it is not showed in traceroute but can be shown by searching the host file.


Output from this script is in this format:

A.B.C.D Device_hostname-Interface_name #/Prefix #Interface description router_R01-Gi1/0/2 #28 Beijing-router01-WAN-Tu611 #24 # Port to internet firewall2-eth5 #24

The script is available from http://network-linux.webnode.cz/news/bash-script-for-gathering-ip-addresses-of-interfaces-through-snmp.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now