There have been a few instances where our customers have asked us how to query the IP route table via SNMP from a remote Windows machine. The following article explains you how to query the list of routes from a remote Windows machine using SNMP and compares the output with "Route Print".

Note: Please be aware that SNMP service (SNMP agent) is required on the Windows machine that you want to query and is not installed by default. You need to manually install the SNMP service.

Refer the following articles for information on how to install SNMP and configure the security settings

http://technet.microsoft.com/en-us/library/cc759570(WS.10).aspx

http://technet.microsoft.com/en-us/library/cc783571(WS.10).aspx

The SNMP OID we need to use is .1.3.6.1.2.1.4.21 which translates to ip.ipRouteTable

The translation hierarchy

1.3.6.1.2.1.4.21 - ipRouteTable
1.3.6.1.2.1.4 - ip
1.3.6.1.2.1 - SNMP MIB-2
1.3.6.1.2 - IETF Management
1.3.6.1 - OID assignments from 1.3.6.1 - Internet
1.3.6 - US Department of Defense
1.3 - ISO Identified Organization
1 - ISO assigned OIDs

Command syntax to be used

snmputil walk hostname communityname .1.3.6.1.2.1.4.21

Sample Output

Route Print

clip_image002[3]

Output using SNMP

clip_image004[3]

The following portion of the output can be compared with "Network Destination" in "Route Print"
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteDest.0.0.0.0
Value = IpAddress 0.0.0.0
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.86.140.0
Value = IpAddress 10.86.140.0
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.86.140.143
Value = IpAddress 10.86.140.143
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.86.143.255
Value = IpAddress 10.86.143.255
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteDest.127.0.0.0
Value = IpAddress 127.0.0.0
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteDest.127.0.0.1
Value = IpAddress 127.0.0.1
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteDest.127.255.255.255
Value = IpAddress 127.255.255.255
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteDest.224.0.0.0
Value = IpAddress 224.0.0.0
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteDest.255.255.255.255
Value = IpAddress 255.255.255.255

The following portion of the output can be compared with "Index" under the "Interface List" in "Route Print"
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex.0.0.0.0
Value = Integer32 14
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex.10.86.140.0
Value = Integer32 14
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex.10.86.140.143
Value = Integer32 14
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex.10.86.143.255
Value = Integer32 14
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex.127.0.0.0
Value = Integer32 1
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex.127.0.0.1
Value = Integer32 1
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex.127.255.255.255
Value = Integer32 1
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex.224.0.0.0
Value = Integer32 1
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex.255.255.255.255
Value = Integer32 1

The following portion of the output can be compared with "Metric" in "Route Print"
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMetric1.0.0.0.0
Value = Integer32 30
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMetric1.10.86.140.0
Value = Integer32 286
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMetric1.10.86.140.143
Value = Integer32 286
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMetric1.10.86.143.255
Value = Integer32 286
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMetric1.127.0.0.0
Value = Integer32 306
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMetric1.127.0.0.1
Value = Integer32 306
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMetric1.127.255.255.255
Value = Integer32 306
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMetric1.224.0.0.0
Value = Integer32 306
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMetric1.255.255.255.255
Value = Integer32 306

The following portion of the output can be compared with "Gateway" in "Route Print"
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteNextHop.0.0.0.0
Value = IpAddress 10.86.140.1
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteNextHop.10.86.140.0
Value = IpAddress 10.86.140.143
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteNextHop.10.86.140.143
Value = IpAddress 10.86.140.143
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteNextHop.10.86.143.255
Value = IpAddress 10.86.140.143
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteNextHop.127.0.0.0
Value = IpAddress 127.0.0.1
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteNextHop.127.0.0.1
Value = IpAddress 127.0.0.1
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteNextHop.127.255.255.255
Value = IpAddress 127.0.0.1
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteNextHop.224.0.0.0
Value = IpAddress 127.0.0.1
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteNextHop.255.255.255.255
Value = IpAddress 127.0.0.1

The following portion of the output can be compared with "NetMask" in "Route Print"
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMask.0.0.0.0
Value = IpAddress 0.0.0.0
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMask.10.86.140.0
Value = IpAddress 255.255.252.0
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMask.10.86.140.143
Value = IpAddress 255.255.255.255
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMask.10.86.143.255
Value = IpAddress 255.255.255.255
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMask.127.0.0.0
Value = IpAddress 255.0.0.0
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMask.127.0.0.1
Value = IpAddress 255.255.255.255
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMask.127.255.255.255
Value = IpAddress 255.255.255.255
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMask.224.0.0.0
Value = IpAddress 240.0.0.0
Variable = ip.ipRouteTable.ipRouteEntry.ipRouteMask.255.255.255.255
Value = IpAddress 255.255.255.255

Note: ifIndex and ipRouteMetric1 will vary based on the Interface index ID and the metric on your Windows machine

References

Refer to the following links to learn more about SNMP

What is SNMP?

How SNMP works

Refer to the following links to learn more about ip.ipRouteTable

http://www.alvestrand.no/objectid/1.3.6.1.2.1.4.21.html

http://www.oidview.com/mibs/0/RFC1213-MIB.html

- Prathabacimman Mohan