An SNMPv1 or SNMPv2c community comprises a set of NMSs and SNMP agents, and is identified by
a community name. An NMS and an SNMP agent must use the same community name to authenticate
to each other.
Typically, public is used as the read-only community name and private is used as the read and write
community name. To improve security, assign your SNMP communities a name other than public and
private.
Examples
# Create the read-only community readaccess in plain text so an SNMPv1 or SNMPv2c NMS can use
the community name readaccess to read the MIB objects in the default view ViewDefault.
<Sysname> system-view
[Sysname] snmp-agent sys-info version v1 v2c
[Sysname] snmp-agent community read simple readaccess
# Create the read and write community writeaccess in plain text so only the SNMPv2c NMS at 1.1.1.1 can
use the community name writeaccess to read or set the MIB objects in the default view ViewDefault.
<Sysname> system-view
[Sysname] acl number 2001
[Sysname-acl-basic-2001] rule permit source 1.1.1.1 0.0.0.0
[Sysname-acl-basic-2001] rule deny source any
[Sysname-acl-basic-2001] quit
[Sysname] snmp-agent sys-info version v2c
[Sysname] snmp-agent community write simple writeaccess acl 2001
# Create the read and write community wr-sys-acc in plain text so an SNMPv1 or SNMPv2c NMS can
use the community name wr-sys-acc to read or set the MIB objects in the system subtree (OID
1.3.6.1.2.1.1).
<Sysname> system-view
[Sysname] snmp-agent sys-info version v1 v2c
[Sysname] undo snmp-agent mib-view ViewDefault
[Sysname] snmp-agent mib-view included test system
[Sysname] snmp-agent community write simple wr-sys-acc mib-view test
Related commands
display snmp-agent community
•
snmp-agent mib-view
•
snmp-agent community-map
Use snmp-agent community-map to map an SNMP community to an SNMP context.
Use undo snmp-agent community-map to delete the mapping between an SNMP community and an
SNMP context.
Syntax
snmp-agent community-map community-name context context-name
undo snmp-agent community-map community-name context context-name
Default
No mapping between an SNMP community and an SNMP context exists on the device.
134