Does anyone have any ideas on mapping out a Cisco-based network via SNMP? I have SNMP access to all of the switches (obviously), and a list of all of the hostnames. From this, I need to be able to build out a network map (or at least find which switch is the parent of another switch). SNMP is pretty much the only option, as CLI logins are enigmatized.

I can get CDP neighbors via SNMP, but I'm not quite sure how to figure out which interface they're coming from, or which interface is the uplink.

My initial sample is 360 devices, after that I have to tackle the remainder of 1,900. It's a mix of IOS and CatOS, everything from 2948's running 8.3(2)GLX to 3750's running 12.2.

Any advice would be greatly appreciated.

  • If I understand you correctly you're looking to build a layer 2 topology diagram? Take a look at Ciscoworks. There should be a demo you can run to get what you're after. I'm surprised the CDP information via SNMP doesn't tell you what interface its from, perhaps there is a matching table or another OID that has the info? – SpacemanSpiff Feb 8 '11 at 16:40
  • Check out SolarWinds Lansurveyor... some googling around and this looks like what you want. – SpacemanSpiff Feb 8 '11 at 16:46

The Cisco CDP mib OIDs here includes cdpInterfaceIfIndex which should map to the local physical interface. (ifmib)

Establishing "Uplink" can be tricky, but you can sometimes infer from relative traffic ratios and sometimes from spanning tree what devices are 'upstream' of others.

Also consider this an opportunity to standardize the naming convention to make it more obvious where in your hierarchy a device sits. ("Access", "Distribution", "Core" to use cisco speak -- your hierarchy may slightly differ)


You should check out Netdisco. It does exactly what you are asking for.


There is no easy way to distinguish "uplink" from "downlink to a switch uplink" by using CDP, that's purely 'local knowledge'. If you have teh full CDP information, there should be data for what's on the other end (equipment model number, equipment hostname and one IP, usually the management IP, of the device).

By correlating the LAN router port's MAC address with the MAC forwarding database, you should eb able to determine what port (or ports) are facing the local default gateway. I believe the MAC fdb is exposed via SNMP.

In the past, I have used python programs telnetting to devices, scraping the output of "sh cdp neighbor" to do roughly this and found it quite doable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.