UCD-SNMP Tutorial -- snmpset

Note: Much of this tutorial requires ucd-snmp-4.2.2!, so make sure you get it before running the commands found in this tutorial.

Note: A new tutorial for net-snmp 5.0 and above is available as well. The commands is the ucd-snmp specific tutorial will not work as expected if you are using net-snmp and not ucd-snmp.


The snmpset command is used to actually modify information on the remote host. For each variable you want to set, you need to specify the OID to update, the data type and the value you want to set it to.

The valid datatypes can be found at the end of the snmpset help output:


So, lets check, set, and check again the value of a variable using snmpget and snmpset:


As you can see, we successfully changed the value of the ucdDemoPublicString.0 object.

Note that if you don't have write permission to the object, the errors will differ greatly between SNMPv1 and SNMPv2c:


SNMPv1 did not have nearly as descriptive error codes, which SNMPv2c fixed. It's a good reason to use SNMPv2c in preference to SNMPv1. Even better, is to use SNMPv3 which has a much better security system and also uses the better error reporting. We'll talk extensively about SNMPv3 later.


Last modified: Mon Mar 25 08:39:39 PST 2002