snmp-server community

Configures the SNMP community string and access privileges.
Syntax
snmp-server community community-string { ro | rw } view mib-view
no snmp-server communitycommunity-string { ro | rw } view mib-view
Command Default

The SNMP community string is not configured.

Parameters
community-string
Configures the SNMP community string that you must enter to gain SNMP access. The string is an ASCII string and can have up to 32 characters.
ro
Configures the community string to have read-only ("get") access.
rw
Configures the community string to have read-write ("set") access.
viewmib-view
Associates a view to the members of the community string. Enter up to 32 alphanumeric characters.
Modes

Global configuration mode

Usage Guidelines

The viewmib-view parameter allows you to associate a view to the members of this community string. If no view is specified, access to the full MIB is granted. The view that you want must exist before you can associate it to a community string.

You can set just one access type, either read-only (ro) or read/write (rw) for a single SNMP community instead of setting both access types. The read/write access supersedes read-only configuration and if read/write is configured for a specified community after read only, the running configuration file only saves the rw configuration line.

If you issue the no snmp-server community public ro command and then enter the write memory command to save the configuration, the read-only "public" community string is removed and will have no SNMP access. If for some reason the device is brought down and then brought up, the no snmp-server community public ro command is restored in the system and the read-only "public" community string has no SNMP access.

The no form of the command removes an SNMP community string.

Examples

The following example configures an SNMP community string with read-only access.

device# configure terminal
device(config)# snmp-server community private ro

The following example associates a view to the members of a community string.

device# configure terminal
device(config)# snmp-server community private rw view view1
History
Release version Command history
09.0.10e The command was modified to remove the ACL options.