Configuring the SNMP Community String
The SNMP community string defines the relationship between an SNMP server system and the client systems. This string acts like a password to control the clients' access to the server. To configure a community string, include the
communitystatement at the[edit snmp]hierarchy level:[edit snmp]communityname{authorizationauthorization;clients {default restrict;addressrestrict;}viewview-name;}If the community name contains spaces, enclose it in quotation marks (" ").
The default authorization level for a community is
read-only. To allowSetrequests within a community, you need to define that community asauthorization read-write. ForSetrequests, you also need to include the specific MIB objects that are accessible with read-write privileges using theviewstatement. The default view includes all supported MIB objects that are accessible with read-only privileges; no MIB objects are accessible with read-write privileges. For more information on theviewstatement, see view.The
clientsstatement lists the IP addresses of the clients (community members) that are allowed to use this community. If noclientsstatement is present, all clients are allowed. Foraddress, you must specify an IPv4 or IPv6 address, not a hostname. Include thedefault restrictoption to deny access to all SNMP clients for which access is not explicitly granted. We recommend that you always include thedefault restrictoption to limit SNMP client access to the local router.
NOTE: Community names must be unique. You cannot configure the same community name at the
[edit snmp community]and[edit snmp v3 snmp-communitycommunity-index] hierarchy levels.
Examples: Configuring the SNMP Community String
Grant read-only access to all clients. With the following configuration, the system responds to SNMP
Get,GetNext, andGetBulkrequests that contain the community stringpublic:[edit]snmp {community public {authorization read-only;}}Grant all clients read-write access to the ping MIB and
jnxPingMIB. With the following configuration, the system responds to SNMPGet,GetNext,GetBulk, andSetrequests that contain the community stringprivateand specify an OID contained in the ping MIB orjnxPingMIBhierarchy:[edit]snmp {view ping-mib-view {oid pingMIB include;oid jnxPingMIB include;community private {authorization read-write;view ping-mib-view;}}}The following configuration allows read-only access to clients with IP addresses in the range
1.2.3.4/24, and denies access to systems in the rangefe80::1:2:3:4/64:[edit]snmp {community field-service {authorization read-only;clients {default restrict; # Restrict access to all SNMP clients not explicitly# listed on the following lines.1.2.3.4/24; # Allow access by all clients in 1.2.3.4/24; exceptfe80::1:2:3:4/64 restrict; # fe80::1:2:3:4/64}}}