← 返回命令列表

Linux command

snmpset 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Set an integer value

snmpset -v 2c -c [community] [host] [OID] i [value]

Set a string value

snmpset -v 2c -c [community] [host] [OID] s "[string_value]"

Set multiple values

snmpset -v 2c -c [community] [host] [OID1] i [value1] [OID2] s "[value2]"

Set using SNMPv3

snmpset -v 3 -u [username] -l authNoPriv -a MD5 -A [password] [host] [OID] i [value]

Set using SNMPv3

snmpset -v 3 -u [username] -l authPriv -a SHA -A [authpass] -x AES -X [privpass] [host] [OID] i [value]

说明

snmpset communicates with a network entity using SNMP SET requests to modify management information on the device. Each variable to set requires three arguments: the OID, the data type, and the value. The tool supports SNMPv1, SNMPv2c, and SNMPv3. Write access typically requires a different community string than read-only access, and many devices restrict which OIDs can be modified. SNMPv3 with authentication and encryption is recommended for security. Common use cases include changing device configurations, enabling/disabling interfaces, modifying system contact or location information, and triggering actions on network equipment.

参数

-v _version_
SNMP version: 1, 2c, or 3.
-c _community_
Community string for SNMPv1/v2c authentication.
-u _username_
SNMPv3 security name (username).
-l _level_
SNMPv3 security level: noAuthNoPriv, authNoPriv, or authPriv.
-a _protocol_
SNMPv3 authentication protocol: MD5 or SHA.
-A _passphrase_
SNMPv3 authentication passphrase.
-x _protocol_
SNMPv3 privacy protocol: DES or AES.
-X _passphrase_
SNMPv3 privacy passphrase.
-t _timeout_
Timeout in seconds before retransmitting.
-r _retries_
Number of retries before giving up.

FAQ

What is the snmpset command used for?

snmpset communicates with a network entity using SNMP SET requests to modify management information on the device. Each variable to set requires three arguments: the OID, the data type, and the value. The tool supports SNMPv1, SNMPv2c, and SNMPv3. Write access typically requires a different community string than read-only access, and many devices restrict which OIDs can be modified. SNMPv3 with authentication and encryption is recommended for security. Common use cases include changing device configurations, enabling/disabling interfaces, modifying system contact or location information, and triggering actions on network equipment.

How do I run a basic snmpset example?

Run `snmpset -v 2c -c [community] [host] [OID] i [value]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -v _version_ do in snmpset?

SNMP version: 1, 2c, or 3.