< Home

SNMPv1/SNMPv2c

SNMPv1/SNMPv2c Packet Format

As shown in Figure 1, an SNMPv1/SNMPv2c packet is composed of the version, community name, and SNMP Protocol Date Unit (PDU) fields.

Figure 1 SNMPv1/SNMPv2c packet format

The following describes the fields in an SNMPv1/SNMPv2c packet:

  • Version: specifies the SNMP version. The value for SNMPv1 is 0 and for SNMPv2c is 1.

  • Community name: used for authentication between agents and NMSs. A community name is a configurable character string. There are two types of community names:
    • Read community names are used for the GetRequest and GetNextRequest operations.
    • Write community names are used for the Set operation.
  • SNMPv1/SNMPv2c PDU: includes the PDU type, request ID, and binding variable list.
    • SNMPv1 PDUs include the GetRequest PDU, GetNextRequest PDU, SetRequest PDU, Response PDU, and Trap PDU.
    • SNMPv2c PDUs include SNMPv1 PDUs and introduce the GetBulkRequest PDU and InformRequest PDU.

    For simplification, the SNMP operations are described as the Get, GetNext, Set, Response, Trap, GetBulk, and Inform operations.

SNMPv1/SNMPv2c Operations

As shown in Table 1, SNMPv1/SNMPv2c defines seven types of operations for exchanging information between the NMS and agents.

Table 1 SNMPv1/SNMPv2c operations

Operation

Description

Get

Retrieves one or several variables from the MIB of an agent process.

GetNext

Retrieves the next variables in alphabetic order from the MIB of the agent process.

Set

Sets one or several variables in the MIB of the agent process.

Response

Returns one or several variables. The agent performs this operation in response to the GetRequest, GetNextRequest, SetRequest, and GetBulkRequest operations. Upon receiving a Get or Set request from the NMS, the agent queries or modifies the variables in the MIB, and returns variables to the NMS.

Trap

Notifies the NMS of a fault or event occurring on a managed device. This operation is performed by the agent.

GetBulk

Batch queries variables on managed devices. This operation is performed by the NMS.

Inform

Notifies the NMS of a fault or event occurring on a managed device. After a managed device sends an inform request, the NMS must send an InformResponse packet as a response to the managed device.

SNMPv1 does not support the GetBulk and Inform operations.

Working Mechanisms of SNMPv1/SNMPv2c

The working mechanisms of SNMPv1 and SNMPv2c are similar, as shown in Figure 2.
Figure 2 Basic operations
  • Get

    In this example, the NMS intends to use the read community name public to obtain the value of the sysContact object on a managed device. The procedure is as follows:
    1. The NMS sends a GetRequest packet to the agent. The fields in the packet are as follows:
      • Version: SNMP version that the NMS is using
      • Community name: public
      • PDU type: Get
      • MIB object: sysContact
    2. The agent authenticates the SNMP version and community name in the packet. If authentication is successful, the agent queries the sysContact value from the MIB, encapsulates the sysContact value into the PDU of a response packet, and sends the response packet to the NMS. If the agent fails to obtain the sysContact value, the agent returns an error message to the NMS.

  • GetNext

    In this example, the NMS intends to use the community name public to obtain the value of the sysName object (next to sysContact) on a managed device. The procedure is as follows:
    1. The NMS sends a GetNextRequest packet to the agent. The fields in the packet are as follows:
      • Version: SNMP version that the NMS is using
      • Community name: public
      • PDU type: GetNext
      • MIB object: sysContact
    2. The agent authenticates the SNMP version and community name in the packet. If authentication is successful, the agent queries the sysName value from the MIB, encapsulates the sysName value into the PDU of a response packet, and sends the response packet to the NMS. If the agent fails to obtain the sysName value, the agent returns an error message to the NMS.

  • Set

    In this example, the NMS intends to use the read community name private to set the sysName object on a managed device to HUAWEI. The procedure is as follows:
    1. The NMS sends a SetRequest packet to the agent. The fields in the packet are as follows:
      • Version: SNMP version that the NMS is using
      • Community name: private
      • PDU type: Set
      • MIB object: sysName
      • Expected MIB object value: HUAWEI
    2. The agent authenticates the SNMP version and community name in the packet. If authentication is successful, the agent sets the sysContact object to the expected value and sends a response packet to the NMS. If the setting fails, the agent returns an error message to the NMS.

  • Trap

    Trap is a spontaneous activity of a managed device. The Trap operation is not a basic operation that the NMS performs on the managed device. If a trap triggering condition is met, a managed device sends a trap to notify the NMS of the exception. For example, when a managed device completes a warm start, the agent sends a warmStart trap to the NMS.

    The agent sends a trap to the NMS only when a module on the managed device meets the trap triggering condition. This reduces management information exchange between the NMS and managed devices.

Figure 3 shows the operations that are added in SNMPv2c.
Figure 3 Operations added in SNMPv2c

  • GetBulk

    A GetBulk operation is equal to consecutive GetNext operations. You can set the number of GetNext operations to be included in one GetBulk operation.

  • Inform

    Inform is also a spontaneous activity of a managed device. In contrast to the trap operation, the inform operation requires an acknowledgement. After a managed device sends an inform request to the NMS, the NMS returns an InformResponse packet. If the managed device does not receive an acknowledgement, it performs the following operations:
    1. Saves the inform in the buffer.
    2. Repeatedly sends the inform request until the NMS returns an acknowledgement or the maximum number of retransmissions is reached.
    3. Records a log for the inform request.
    Therefore, the inform requests occupy more system resources than traps.
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >