SNMP Testing with net-snmp

NetCraftsmen®

With most network management systems and network security systems, SNMP is a critical component. One great tool for checking SNMP functionality is net-snmp. This tool works with Windows and Linux. From a security perspective, this net-snmp can be used as another troubleshooting tool to ensure that Cisco MARS and Cisco NCM are working correctly.

One basic tool, included with the toolset, is snmpwalk. This can be used to determine the OIDs used for a network device. Here’s a partial execution of the command against a Cisco 2523 router.

 snmpwalk -c cisco -v 1 10.1.1.200 | more
SNMPv2-MIB::sysDescr.0 = STRING: Cisco Internetwork Operating System Software
IOS ™ 2500 Software (C2500-IK8OS-L), Version 12.2(32), RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Fri 02-Dec-05 16:15 by
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.9.1.27
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1229180359) 142 days, 6:23:23.59
SNMPv2-MIB::sysContact.0 = STRING:
SNMPv2-MIB::sysName.0 = STRING: termserv-R5
SNMPv2-MIB::sysLocation.0 = STRING:
SNMPv2-MIB::sysServices.0 = INTEGER: 78
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
IF-MIB::ifNumber.0 = INTEGER: 4
IF-MIB::ifIndex.1 = INTEGER: 1

You can see that all the MIB OID values by adding the “-O n” option. By just typing “snmpwalk” you can get the full list of command line options. The use of “-O n” is shown below

snmpwalk -O n -c cisco -v 1 10.1.1.200
.1.3.6.1.2.1.1.1.0 = STRING: Cisco Internetwork Operating System Software
IOS ™ 2500 Software (C2500-IK8OS-L), Version 12.2(32), RELEASE SOFTWARE(fc1)
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Fri 02-Dec-05 16:15 by
.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.9.1.27
.1.3.6.1.2.1.1.3.0 = Timeticks: (1229164596) 142 days, 6:20:45.96
.1.3.6.1.2.1.1.4.0 = STRING:
.1.3.6.1.2.1.1.5.0 = STRING: termserv-R5
.1.3.6.1.2.1.1.6.0 = STRING:
.1.3.6.1.2.1.1.7.0 = INTEGER: 78
.1.3.6.1.2.1.1.8.0 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.2.1.0 =
INTEGER: 4
.1.3.6.1.2.1.2.2.1.1.1 = INTEGER: 1

You can then use this information to be more specific with your SNMP requests by using snmpget. Using the example above, we can just get the version information for the 2523 router by executing the command below

snmpget -c cisco -v 1 10.1.1.200 .1.3.6.1.2.1.1.1.0
SNMPv2-MIB::sysDescr.0 = STRING: Cisco Internetwork Operating System Software
IOS ™ 2500 Software (C2500-IK8OS-L), Version 12.2(32), RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Fri 02-Dec-05 16:15 by

2 responses to “SNMP Testing with net-snmp

  1. Don’t forget that you can also use any unique symbolic name as an argument to snmpwalk or snmpget as well.

    So, sysName.0 or ifName.1 should work nicely.

Leave a Reply