Community Name

 

SNMP mandates that the SNMP agents should accept request messages only if the community string in the message matches its community name. Therefore, the management application should always communicate with the agents along with the associated community name. The default SNMP community names are "public" for read-only (GET) operations and "private" for read-write (SET) operations. The management applications should have provision to include the community names in its request messages.

 

Community strings are used to authenticate SNMP PDUs. Since SNMP packets are usually sent using UDP packets, there is no connection established as in the case of TCP/IP packets. Therefore, when a UDP packet arrives at the agent, the agent validates the packet. It accepts and sends a response if the community string of the PDU is equal to that set on the agent, else drops the packet. The agent does not change the community name after communicating.

 

Applications typically communicate with the SNMP agents by specifying the community name of the agent. To set the community string, the following methods can be used.

 

API Name Class/Component Name API Methodsapi.jpg Remarks

High-Level

SnmpTarget
SnmpRequestServer
SnmpPoller
SnmpTable

setCommunity(String)

setWriteCommunity(String)

The default community string is "public" and the default writeCommunity string is null. When writeCommunity is null, community itself is used for SET operations. Therefore, applications should explicitly set the writeCommunity, before they can use it for SET operations.

Low-Level

SnmpSession
SnmpPDU

setCommunity(String)

setWriteCommunity(String)

These methods set the read and write community for outgoing requests.

RMI

SnmpTarget
SnmpRequestServer

setCommunity(String) setWriteCommunity(String)

These methods set the community name.

CORBA

SnmpTarget
SnmpRequestServer

setCommunity(String) setWriteCommunity(String)

- same as above -

EJB

SnmpTargetEJB

setCommunity(String) setWriteCommunity(String)

- same as above -



Copyright © 2012, ZOHO Corp. All Rights Reserved.