SNMP - snmp-server community and host commands
When employing SNMP - Simple Network Management Protocol, to enable the SNMP agent on the local device, you use the following command:
Router(config)#snmp-server community TSHOOT ro
where in this case
TSHOOT is the name given to the SNMP community, and
ro indicates that the SNMP communication will be read only. In other words, the SNMP manager will only be able to read information from the device, and won't be able to change the configuration. Alternatively the command could also end with the
rw keyword, indicating read/write access.
This command is all that’s necessary to allow an SNMP manager to retrieve information from the network device or agent, and also to set specific configuration parameters. The ability to retrieve and set depends of course on the
ro (read only) or
rw (read/write) setting in the command.
The following command serves a different purpose:
Router(config)#snmp-server host 192.168.12.2 version 2c TSHOOT
This command tells the SNMP agent where to send unsolicited messages, specifically traps and informs. Unsolicited messages are those messages sent by an SNMP agent to an SNMP manager without the manager first requesting that information. These messages are used to alert the manager about specific events or conditions that have occurred in the agent device.
In the above command, the SNMP version is specified as well as the destination of these unsolicited messages and the community string of
TSHOOT to ensure access is granted.
By default, if the SNMP version is not specified, version 1 is used on most platforms, however this may be different for some platforms.