[c-nsp] SNMP OID for IP route
Phil Mayers
p.mayers at imperial.ac.uk
Thu Sep 13 09:03:30 EDT 2007
On Thu, 2007-09-13 at 14:33 +0200, Vincent De Keyzer wrote:
> Hello,
>
>
>
> is there a way to specify the mask information when querying a router's IP
> routing table via SNMP ?
>
>
>
> My problem is that
>
>
>
> snmpwalk -c community -v 2c router ipRouteIfIndex.10.0.0.0
>
>
>
> only returns the most specific match, in case the router for instance knows
> both 10.0.0.0/24 and 10.0.0.0/8.
No. You need to use the ipCidrRouteTable which is not well supported on
Cisco kit as far as I can tell.
Some other MIBS (e.g. MPLS-VPN-MIB) contain similarly-structured tables.
You could also generate the (at most) 32 versions of the route and query
for them; e.g. on a Fedora or Redhat box, the "ipcalc" command can be
used in a pipeline:
for masklen in `seq 32`
do
ipcalc -n 192.168.68.194/$masklen
done | sort -u | awk -F = '
{ print "ipRouteIfIndex." $2 }' | xargs snmpget -v 2c $router
You will need snmpv2 to get per-oid "no such object"
More information about the cisco-nsp
mailing list