Hello, everyone!
Today I will continue to show you the SNMP configuration. I will show SNMP messages – SNMP Get, SNMP Set and SNMP Trap messages. This is the second article about SNMP protocol.
SNMP packets are UDP packets, and this protocol defines two ports: 161 and 162. Port number 161 is used for sending and receiving SNMP packets of the SNMP manager. Port number 162 is used to send traps messages from the SNMP agent do SNMP manager and it is used to listen to these messages by the SNMP manager.
SNMP get messages
This type of message contains the next request messages:
Get – SNMP manager with this request message obtain one or more parameters from SNMP agent,
GetNext – SNMP manager with this request message obtain one or more subsequent parameters from SNMP agent,
GetBulk – SNMP manager with this request message can set the number of GetNext operations to be included in one GetBulk operation. This message is not supported by SNMPv1.
In the figure 1, we can see these get messages.

Fig. 2. SNMP get messages
(https://support.huawei.com/enterprise/en/doc/EDOC1100086963)
The next picture shows us the format of SNMPv1 and SNMPv2c get messages. I do not show you the format of SNMPv3, because I won't explain SNMPv2c configuration. After IP and UDP header, every packet has a version, community name and PDU (Protocol Data Unit).

Fig. 3. Format of SNMPv1 and SNMPv2c get messages
(https://support.huawei.com/enterprise/en/doc/EDOC1100086963)
SNMP set message
SNMP set message is used by the SNMP manager to send set requests to an SNMP agent. After SNMP agent receives this message, it processes the request and sends a response message to the SNMP manager. SNMP managers can use these packets for configuration one or more parameters.
In the fig. 4, we can see these Get messages.

Fig. 4. SNMP set message
(https://support.huawei.com/enterprise/en/doc/EDOC1100086963)
The next picture shows us the format of SNMPv1 and SNMPv2c set messages. After IP and UDP header, every packet has a version, community name and PDU (Protocol Data Unit).

Fig. 5. Format of SNMPv1 and SNMPv2c set messages
(https://support.huawei.com/enterprise/en/doc/EDOC1100086963)
SNMP traps message
The SNMP agent does not send a request message to the SNMP manager. It only sends trap messages in case a problem occurs.
There are two types of SNMP traps:
Trap
Inform. This type of trap message is not supported by SNMPv1.
SNMP agent sends trap packet like alarm message, then, it sends information about alarm or event through an InformRequest message. And the end, SNMP manager has to need to replay with InformResponse message.
We can see these communications in the next figure. And the last figure (fig. 6), we can see the format of SNMPv2c trap or info message.

Fig. 6. SNMP traps message
(https://support.huawei.com/enterprise/en/doc/EDOC1100086963)

Fig. 7. Format of SNMPv2c trap or inform messages
(https://support.huawei.com/enterprise/en/doc/EDOC1100086963)
I will continue this article.
Thank you!
Reference:
Training material for HCIP Acess, V2.5





