LinuxCommandLibrary

snmpset

Modify SNMP object values on agents

TLDR

Set an integer value using SNMPv2c

$ snmpset -v 2c -c [community] [host] [OID] i [value]
copy
Set a string value
$ snmpset -v 2c -c [community] [host] [OID] s "[string_value]"
copy
Set multiple values in one request
$ snmpset -v 2c -c [community] [host] [OID1] i [value1] [OID2] s "[value2]"
copy
Set using SNMPv3 with authentication
$ snmpset -v 3 -u [username] -l authNoPriv -a MD5 -A [password] [host] [OID] i [value]
copy
Set using SNMPv3 with authentication and encryption
$ snmpset -v 3 -u [username] -l authPriv -a SHA -A [authpass] -x AES -X [privpass] [host] [OID] i [value]
copy

SYNOPSIS

snmpset [options] agent OID type value [OID type value...]

DESCRIPTION

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.

PARAMETERS

-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.

VALUE TYPES

i

Integer
u
Unsigned integer
s
String
x
Hexadecimal string
d
Decimal string
n
Null
o
Object identifier
t
Timeticks
a
IP address
b
Bits

CAVEATS

Modifying SNMP values can affect device operation and network stability. Ensure you have proper authorization and understand the impact before using snmpset. Write community strings should be kept confidential. Many OIDs are read-only and cannot be modified. Incorrect type specifications will cause the request to fail.

HISTORY

snmpset is part of the Net-SNMP project, an open-source suite of SNMP tools and libraries. Net-SNMP evolved from the CMU SNMP implementation and later UCD-SNMP. It provides comprehensive SNMP v1, v2c, and v3 support and is the standard SNMP toolkit on most Unix-like systems.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community