Skip to Content
Cisco IOS Cookbook, 2nd Edition
book

Cisco IOS Cookbook, 2nd Edition

by Kevin Dooley, Ian Brown
December 2006
Intermediate to advanced
1188 pages
72h 8m
English
O'Reilly Media, Inc.
Content preview from Cisco IOS Cookbook, 2nd Edition

Extracting Router Information via SNMP Tools

Problem

You wish to extract or change router information via SNMP.

Solution

To extract router information via SNMP, we will use the suite of SNMP tools provided with the NET-SNMP toolkit (see Appendix A for more details).

Use snmpget to extract a single MIB object from the router’s MIB tree. This example uses snmpget to extract the router’s system contact information:

freebsd% snmpget –v1 –c ORARO Router .1.3.6.1.2.1.1.4.0
system.sysContact.0 = Helpdesk  800-555-2992

Use snmpset to alter MIB objects within the router’s MIB tree. The next example demonstrates how to modify MIB variables, using snmpset to change the system contact information:

freebsd% snmpset –v1 –c ORARW Router .1.3.6.1.2.1.1.4.0 s "Ian Brown 555-1221"
system.sysContact.0 = Ian Brown 555-1221
freebsd% snmpget –v1 –c ORARO Router sysContact.0
system.sysContact.0 = Ian Brown 555-1221

The snmpwalk utility extracts a series of MIB objects from the router’s MIB tree. This example uses snmpwalk to extract all of the router’s interface descriptions:

freebsd% snmpwalk –v1 -c ORARO Router ifDescr 
interfaces.ifTable.ifEntry.ifDescr.1 = "Ethernet0"
interfaces.ifTable.ifEntry.ifDescr.2 = "Serial0"
interfaces.ifTable.ifEntry.ifDescr.3 = "Serial1"
interfaces.ifTable.ifEntry.ifDescr.4 = "Null0"
interfaces.ifTable.ifEntry.ifDescr.5 = "Loopback0"
interfaces.ifTable.ifEntry.ifDescr.6 = "Serial0.1"
freebsd%

Discussion

For this recipe, we chose to demonstrate basic SNMP functionality by using the suite ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

IP Routing on Cisco IOS, IOS XE, and IOS XR: An Essential Guide to Understanding and Implementing IP Routing Protocols

IP Routing on Cisco IOS, IOS XE, and IOS XR: An Essential Guide to Understanding and Implementing IP Routing Protocols

Brad Edgeworth, Aaron Foss, Ramiro Garza Rios
Cisco Software-Defined Access

Cisco Software-Defined Access

Srilatha Vemula, Jason Gooley, Roddie Hasan

Publisher Resources

ISBN: 0596527225Supplemental ContentErrata Page