[SNMP4J] Re: Pulling Router tables via SNMP

PHIL BERGSTRESSER phil.bergstresser at adtran.com
Wed Oct 11 17:57:16 CEST 2006


Charlie,
    The first hurdle is to get SNMP access to the router, which requires
admin knowledge. Perhaps you have that. That's because you must know the
community name and what version of SNMP is usable. This stops most
people just starting.
    You can explore various utilities for accessing the router tables
once you have that information. Having specific MIBs makes this easier
because you get symbolic clarity. Just to show how you can access the
standard IP routing table defined in RFC2011, I used a command line
utility I have used for years that is from the NET-SNMP project (used to
be UCSD-SNMP originally). Of course, since this is sn SNMP4J list, it
would be appropriate to recommend something from here. Even if you don't
have a MIB loaded, but do have the community name, you can see raw OIDs
with the table values to know that you are getting access to the data
you want. Here is an example of a walk of the IPRouting table index in
the standard RFC2011 MIB which every router with SNMP support should
support. I used the numeric OID, but in fact had the MIB loaded so it
came out interpreted. (This is in fact not from a router). The walk is
sent to host "demo.test" with community name "public" and starting OID
"ipRouteDest=.1.3.6.1.2.1.4.21.1.1". Is this the type of some
information you are looking for, and a help to see how to approach it?
    I would recommend looking at the standard RFC MIBs before delving
into enterprise specific MIBs.

D:\SNMP\mibs>snmpwalk demo.test public .1.3.6.1.2.1.4.21.1.1
ip.ipRouteTable.ipRouteEntry.ipRouteDest.0.0.0.0 = IpAddress: 0.0.0.0
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.0.0.0 = IpAddress: 10.0.0.0
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.2.27.250 = IpAddress:
10.2.27.250
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.5.252.100 = IpAddress:
10.5.252.100
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.5.254.119 = IpAddress:
10.5.254.119
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.5.254.145 = IpAddress:
10.5.254.145
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.14.1.2 = IpAddress:
10.14.1.2
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.26.44.51 = IpAddress:
10.26.44.51
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.254.0.0 = IpAddress:
10.254.0.0
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.254.1.1 = IpAddress:
10.254.1.1
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.254.1.120 = IpAddress:
10.254.1.120
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.254.1.122 = IpAddress:
10.254.1.122
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.254.1.125 = IpAddress:
10.254.1.125
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.254.1.200 = IpAddress:
10.254.1.200
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.254.2.98 = IpAddress:
10.254.2.98
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.254.254.254 = IpAddress:
10.254.254.254
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.254.255.255 = IpAddress:
10.254.255.255
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.255.255.255 = IpAddress:
10.255.255.255
ip.ipRouteTable.ipRouteEntry.ipRouteDest.127.0.0.1 = IpAddress:
127.0.0.1
ip.ipRouteTable.ipRouteEntry.ipRouteDest.172.22.48.13 = IpAddress:
172.22.48.13
ip.ipRouteTable.ipRouteEntry.ipRouteDest.172.22.48.47 = IpAddress:
172.22.48.47
ip.ipRouteTable.ipRouteEntry.ipRouteDest.172.22.48.48 = IpAddress:
172.22.48.48
ip.ipRouteTable.ipRouteEntry.ipRouteDest.172.22.116.192 = IpAddress:
172.22.116.192
ip.ipRouteTable.ipRouteEntry.ipRouteDest.172.30.21.10 = IpAddress:
172.30.21.10
ip.ipRouteTable.ipRouteEntry.ipRouteDest.224.0.0.0 = IpAddress:
224.0.0.0
ip.ipRouteTable.ipRouteEntry.ipRouteDest.255.255.255.255 = IpAddress:
255.255.255.255

    I would have gotten the same results in my case with a symbolic
reference since I did have the MIB:

D:\SNMP\mibs>snmpwalk demo.test public ipRouteDest
ip.ipRouteTable.ipRouteEntry.ipRouteDest.0.0.0.0 = IpAddress: 0.0.0.0
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.0.0.0 = IpAddress: 10.0.0.0
ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.2.27.250 = IpAddress:
10.2.27.250
. . .
. . .


    HTH,
Phil


> -----Original Message-----
> From: snmp4j-bounces at agentpp.org 
> [mailto:snmp4j-bounces at agentpp.org] On Behalf Of Charlie Hubbard
> Sent: Wednesday, October 11, 2006 7:21 AM
> To: Rory Marquis; snmp4j at agentpp.org
> Subject: [SNMP4J] Re: Pulling Router tables via SNMP
> 
> Rory,
> 
> Thanks for the info.  Both sites are very helpful.  What my 
> ultimate goal in doing this is try and map the network by 
> using snmp to figure out what networks a router is 
> connecting.  I've used some products that seem to use this 
> same approach so I figured it would be doable.
> Do you have any other insight in how I might accomplish this goal?
> 
> So SNMP4J doesn't parse MIBs and that's why I need mibble?
> 
> Thanks
> Charlie
> 
> On 10/10/06, Rory Marquis <roridge at hotmail.com> wrote:
> > Hi there
> >
> > Im not sure if what you are asking would be posssible in 
> the way that 
> > you might be thinking.  (Although I am sure that someone 
> will correct 
> > me if I am worg.
> >
> > The only way that a router that supports SNMP could tell you the 
> > routing tables would be if it had a MIB that would provide you with 
> > this information.
> >
> > You said that you have read the RFC, and I agree at first they are 
> > difficult to follow. The thing is there might be LOTS of 
> RFCs for the 
> > MIBs of your routers/switches there also might be private 
> MIBs for the 
> > routers that are manufacture specific (in fact i can 
> guraentee that there are).
> >
> > My advice to you is to do some more research. Start small just by 
> > using an OID from something like the HOST-RESOURCES-MIB or the 
> > SNMPv2-MIB or something like that and throw it at the 
> router to see if 
> > it A: implements SNMP (some don't, honest) and B: that you 
> can talk to 
> > it.  Then what I would do is download the MIB from the RFC 
> and parse 
> > it using something like Mibble http://www.mibble.org/. There is an 
> > excellent tool that the Mibble folks have created which will parse 
> > MIBs for you, and send SNMP messages... it's a good tool to 
> use if you are just playing around.
> >
> > Then I would go searching for more MIB information regarding your 
> > specific Routers. If they are Cisco you are in luck, take a look in 
> > the Mib Depot http://www.mibdepot.com/index.shtml
> >
> > HTH
> >
> > Cheers
> > Rory
> >
> >
> >
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
> 



More information about the SNMP4J mailing list