Networking
如何使用 SNMP OID 輪詢 ARP 表?
當您需要輪詢設備的 ARP 表時,傳統的做法是使用
ipNetToMediaPhysAddress
oratPhysAddress
;但是,根據 Cisco 的文件,這兩個 OID 都已被棄用。這些 OID 工作得很好;但是,我正在建構一個新工具,因此如果可能的話,使用最新的 OID 是有意義的。
是否有未棄用的 SNMP OID 來查詢設備中的 ARP 表?到目前為止,Google還沒有為我找到這個答案……
Mircea 的答案在較新的 IOS 上執行良好……
[mpenning@something]$ snmpbulkwalk -v 2c -c public -Osq 192.0.2.1 ipNetToPhysicalPhysAddress ipNetToPhysicalPhysAddress.2.ipv4."192.0.2.1" a4:4c:11:90:56:80 ipNetToPhysicalPhysAddress.2.ipv4."192.0.2.2" a4:4c:11:96:68:0 ipNetToPhysicalPhysAddress.2.ipv4."192.0.2.101" 0:90:b:43:80:74 [mpenning@something]$ snmpbulkwalk -v 2c -c public -Oqv 192.0.2.1 sysDescr Cisco IOS Software, C3900 Software (C3900-UNIVERSALK9-M), Version 15.2(2)T1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Wed 29-Feb-12 23:44 by prod_rel_team [mpenning@something]$
較舊的 IOS 需要使用
ipNetToMediaPhysAddress
您應該按照RFC 4293
ipNetToPhysicalTable
的定義使用。所以變成ipNetToMediaPhysAddress
ipNetToPhysicalPhysAddress
ipNetToMediaTable OBJECT-TYPE SYNTAX SEQUENCE OF IpNetToMediaEntry MAX-ACCESS not-accessible STATUS deprecated DESCRIPTION "The IPv4 Address Translation table used for mapping from IPv4 addresses to physical addresses. This table has been deprecated, as a new IP version-neutral table has been added. It is loosely replaced by the ipNetToPhysicalTable." ::= { ip 22 }