snmpwalk 语法
1 背景
snmpwalk是SNMP的一个工具,它使用SNMP的GETNEXT请求查询指定OID(SNMP协议中的对象标识)入口的所有OID树信息,并显示给用户。通过snmpwalk也可以查看支持SNMP协议(可网管)的设备的一些其他信息,比如cisco交换机或路由器IP地址、内存使用率等。
https://cloud.tencent.com/developer/article/1366179
1.1 命令语法
D:\soft\SnmpWalk> SnmpWalk.exe
SnmpWalk v1.01 - Copyright (C) 2009 SnmpSoft Company
[ More useful network tools on http://www.snmpsoft.com ]
Description:
Lists existing SNMP variables on any network device that supports SNMP.
SNMP is widely used for administration and monitoring purposes.
Usage:
SnmpWalk.exe [-q] -r:host [-p:port] [-t:timeout] [-v:version] [-c:community]
[-ei:engine_id] [-sn:sec_name] [-ap:auth_proto] [-aw:auth_passwd]
[-pp:priv_proto] [-pw:priv_passwd] [-ce:cont_engine] [-cn:cont_name]
[-os:start_oid] [-op:stop_oid] [-csv]
-q Quiet mode (suppress header; print variable values only).
-r:host Name or network address (IPv4/IPv6) of remote host.
-p:port SNMP port number on remote host. Default: 161
-t:timeout SNMP timeout in seconds (1-600). Default: 5
-v:version SNMP version. Supported version: 1, 2c or 3. Default: 1
-c:community SNMP community string for SNMP v1/v2c. Default: public
-ei:engine_id Engine ID. Format: hexadecimal string. (SNMPv3).
-sn:sec_name SNMP security name for SNMPv3.
-ap:auth_proto Authentication protocol. Supported: MD5, SHA (SNMPv3).
-aw:auth_passwd Authentication password (SNMPv3).
-pp:priv_proto Privacy protocol. Supported: DES, IDEA, AES128, AES192,
AES256, 3DES (SNMPv3).
-pw:priv_passwd Privacy password (SNMPv3).
-cn:cont_name Context name. (SNMPv3)
-ce:cont_engine Context engine. Format: hexadecimal string. (SNMPv3)
-os:start_oid Object ID (OID) of first SNMP variable to walk. Default:.1
-op:stop_oid Object ID (OID) of last SNMP variable to walk.
Default: walk to the very last variable.
-csv Output in CSV (Comma Separated Values) format.
Examples:
SnmpWalk.exe -r:MainRouter -csv
SnmpWalk.exe -r:10.0.0.1 -t:10 -c:"admin_rw" -os:.1.3.6.1.2.1.1
SnmpWalk.exe -r:"::1" -v:3 -sn:SomeName -ap:MD5 -aw:SomeAuthPass -pp:DES
-pw:SomePrivPass -os:.1.3.6.1.2.1 -op:.1.3.6.1.2.65535 -q
D:\soft\SnmpWalk>
1.2 操作Example
获取 10.248.1.100 这台主机的OID
Community为 cisco@123
版本为: v2c
D:\soft\SnmpWalk> SnmpWalk.exe -r:10.248.1.100 -c:cisco@123 -v:2c
SnmpWalk v1.01 - Copyright (C) 2009 SnmpSoft Company
[ More useful network tools on http://www.snmpsoft.com ]
OID=.1.0.8802.1.1.2.1.1.1.0, Type=Integer, Value=30
OID=.1.0.8802.1.1.2.1.1.2.0, Type=Integer, Value=4
OID=.1.0.8802.1.1.2.1.1.3.0, Type=Integer, Value=2
OID=.1.0.8802.1.1.2.1.1.4.0, Type=Integer, Value=2
OID=.1.0.8802.1.1.2.1.1.5.0, Type=Integer, Value=5
OID=.1.0.8802.1.1.2.1.1.6.1.2.83886080, Type=Integer, Value=3
OID=.1.0.8802.1.1.2.1.1.6.1.2.436207616, Type=Integer, Value=3
OID=.1.0.8802.1.1.2.1.1.6.1.2.436208128, Type=Integer, Value=3
OID=.1.0.8802.1.1.2.1.1.6.1.2.436208640, Type=Integer, Value=3
OID=.1.0.8802.1.1.2.1.1.6.1.2.436209152, Type=Integer, Value=3
OID=.1.0.8802.1.1.2.1.1.6.1.3.436225536, Type=Integer, Value=2
OID=.1.0.8802.1.1.2.1.1.6.1.3.436226048, Type=Integer, Value=2
1.3 下面是执行失败的示例
D:\soft\SnmpWalk> SnmpWalk.exe -r:10.248.1.101 -c:cisco@123 -v:2c
SnmpWalk v1.01 - Copyright (C) 2009 SnmpSoft Company
[ More useful network tools on http://www.snmpsoft.com ]
%Failed to get value of SNMP variable. Timeout.
D:\soft\SnmpWalk>

浙公网安备 33010602011771号