Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to SNMP. Is there an equivalent in SNMP to "show ip route" on a Cisco 10K router?

share|improve this question
up vote 11 down vote accepted

RFC1213-MIB has an ipRouteTable tree containing the IP routing table:

[draytm01@mgt03 ~]$ snmpwalk -v 1 192.168.212.45 .1.3.6.1.2.1.4.21
RFC1213-MIB::ipRouteDest.0.0.0.0 = IpAddress: 0.0.0.0
RFC1213-MIB::ipRouteDest.192.168.212.0 = IpAddress: 192.168.212.0
RFC1213-MIB::ipRouteIfIndex.0.0.0.0 = INTEGER: 4
RFC1213-MIB::ipRouteIfIndex.192.168.212.0 = INTEGER: 4
RFC1213-MIB::ipRouteMetric1.0.0.0.0 = INTEGER: 1
RFC1213-MIB::ipRouteMetric1.192.168.212.0 = INTEGER: 0
RFC1213-MIB::ipRouteNextHop.0.0.0.0 = IpAddress: 192.168.212.1
RFC1213-MIB::ipRouteNextHop.192.168.212.0 = IpAddress: 0.0.0.0
RFC1213-MIB::ipRouteType.0.0.0.0 = INTEGER: indirect(4)
RFC1213-MIB::ipRouteType.192.168.212.0 = INTEGER: direct(3)
RFC1213-MIB::ipRouteProto.0.0.0.0 = INTEGER: local(2)
RFC1213-MIB::ipRouteProto.192.168.212.0 = INTEGER: local(2)
RFC1213-MIB::ipRouteMask.0.0.0.0 = IpAddress: 0.0.0.0
RFC1213-MIB::ipRouteMask.192.168.212.0 = IpAddress: 255.255.255.0
RFC1213-MIB::ipRouteInfo.0.0.0.0 = OID: SNMPv2-SMI::zeroDotZero
RFC1213-MIB::ipRouteInfo.192.168.212.0 = OID: SNMPv2-SMI::zeroDotZero

This is actually from a Linux box but I'd hope Cisco implemented RFC1213-MIB; I can't remember and I don't have any routers to hand.

share|improve this answer
    
Thank you. Just what I needed. I also discovered this great Cisco SNMP Object Navigator: tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en – chardin Jul 17 '09 at 14:48

While not Cisco specific, you can use: .1.3.6.1.2.1.4.21 which corresponds to .iso.org.dod.internet.mgmt.mib-2.ip.ipRouteTable from the RFC1213.mib (check mibdepot.com for a copy).

If you want to search for a cisco specific MIB you might try: http://www.mibdepot.com/cgi-bin/vendor_index.cgi?r=cisco

A good resource for SNMP education is www.wtcs.org/snmp4tpc/

share|improve this answer

The answer above about RFC1213 MIB is often sufficient, but on some routers, you may need to or prefer to use inetCidrRouteTable, which is a little more detailed, and uses CIDR notation instead of transmitting the entire mask for every entry, and supports ipv4 and ipv6. see IP-FORWARD-MIB.txt installed with net-snmp for more information. I've seen at least one implementation that skipped RFC1213 MIB entirely ("No Such Object available on this agent at this OID") in favor of this other MIB.

snmptable [options] -c community hostname inetCidrRouteTable

This table would be quite large on many routers, so don't expect that to work quickly, or necessarily at all.

There is also ipCidrRouteTable, an older (v4 only) version of same thing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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