LinuxCommandLibrary

snmpset

Set values of SNMP-manageable variables

TLDR

Set a value

$ snmpset -v [version] -c [community] [ip] [oid] [value_type] [value]
copy

Display help
$ snmpset [[-h|--help]]
copy

SYNOPSIS

snmpset [OPTIONS] AGENT COMMUNITY OID TYPE VALUE

PARAMETERS

OPTIONS
    Various options for configuring SNMP version, authentication, retries, timeouts, and other communication parameters.

AGENT
    The hostname or IP address of the SNMP agent to target.

COMMUNITY
    The SNMP community string for authentication (often "public" for read-only access or a more complex string for write access).

OID
    The Object Identifier (OID) of the variable to modify.

TYPE
    The data type of the value being set. Common types include 'i' (integer), 'u' (unsigned integer), 's' (string), 'o' (object identifier), 'x' (hex string), 'd' (decimal string), 'n' (null), 'b' (bits).

VALUE
    The value to assign to the SNMP variable. This must match the specified TYPE.

DESCRIPTION

The `snmpset` command is a powerful tool for remotely modifying information held within a Simple Network Management Protocol (SNMP) agent. It allows network administrators to change the values of SNMP variables, effectively configuring or controlling devices on the network. This command uses SNMP SET requests to write data to specific Object Identifiers (OIDs) on a target device. Requires knowledge of SNMP protocol, OIDs, and appropriate community strings/authentication details to successfully modify variables. Incorrect usage can lead to misconfiguration or security vulnerabilities if proper authentication and access control are not implemented. Understanding the data type and value expected by the target OID is critical to prevent errors or unexpected behavior.

CAVEATS

Incorrect OID, type, or value specification can cause errors or unexpected behavior. Requires appropriate permissions on the target SNMP agent. Careless use can disrupt network services or compromise security.

COMMON OPTIONS

-v VERSION: Specifies the SNMP version to use (e.g., 1, 2c, 3).
-c COMMUNITY: Specifies the community string.
-m MODULES: Load specific MIB modules.
-M DIR: Specifies a directory to search for MIB files.
-t TIMEOUT: Sets the timeout for SNMP requests.
-r RETRIES: Sets the number of retries for SNMP requests.

SNMPV3 OPTIONS

For SNMPv3, authentication and encryption options must be configured using options like -u (username), -l (security level), -a (authentication protocol), and -A (authentication passphrase).

EXAMPLES

Set a string variable:
snmpset -v 2c -c public 192.168.1.100 sysLocation.0 s "New Location"
Set an integer variable:
snmpset -v 2c -c private 192.168.1.100 ifAdminStatus.2 i 1

HISTORY

The `snmpset` command is part of the Net-SNMP suite, a widely used open-source SNMP implementation. It has been developed and maintained over many years and is a standard tool for network management. It has evolved to support different SNMP versions and security protocols.

SEE ALSO

snmpwalk(1), snmpget(1), snmpgetnext(1), snmptrap(1), snmpbulkget(1), snmpbulkwalk(1)

Copied to clipboard