SNMP PDU Format总结 .

 

最近因为项目的关系学习了许多SNMP协议方面的知识,想把它们做一个总结。其中这一部分,主要是涉及SNMP协议中通讯的最小协议单元数据PDU报文的格式。在SNMP协议中主要的操作有GET,GETNEXT,SET,TRAP等,每种操作都有对应的request和response格式,这些请求和回复的消息都称之为PDU。

1. 先来看一个SNMP v1 & v2c版本下的报文格式:由于v1 & v2c的安全机制是仅通过一个community string来验证工作的,所以报文格式也相对简单

  • SNMP Version – It is an Integer that identifies the version of SNMP. For SNMPv1, it is 0.
  • Community String – An Octet String that may contain a string used to add security to SNMP devices.
  • SNMP PDU – The SNMP PDU (Protocol Data Unit) is used for communication between the SNMP enities.
2. 对于SNMP v3的话,由于安全机制增加了验证密钥,支持各种加密算法,而且可以根据user来配置不同的机制,所以报文格式一下子就变得复杂许多了:
SNMP PDU Format总结 ._第1张图片
  • Version – It is an Integer that identifies the version of SNMP. For SNMPv3, it is 3.
  • ID – This field contains the SNMP message identifier which is a unique ID associated with the message. The msgID field is different from the reqID field available in the PDU.
  • Max Size – This field represents the maximum size of message which the requesting SNMP entity can accept.
  • Flags – This field contains the message security level. 0 – message is authenticated, 1 – message uses privacy, 2 – a report PDU is expected for the message
  • Security Model – This field indicates the security model used to generate the message. When USM is used, it has a value of 3
  • Engine ID – This field has the SNMPEngineID of the authoritative SNMP entity involved in the transaction. When a request PDU is generated from an SNMP engine, the remote peer (agent for Get request and manager for Trap request) is the authoritative SNMP entity.
  • Engine Boots – This field has the snmpEngineBoots value of the authoritative SNMP entity involved in the transaction
  • Engine Time – This field has the snmpEngineTime value of the authoritative SNMP entity involved in the transaction
  • User Name – This field contains the principal who originated the request.
  • Security Parameters – This field contains the security parameters that are security model dependent. It contains the authentication parameters and the privacy parameters for USM.
  • Context Engine ID – Within an administrative domain, the contextEngineID uniquely identifies an SNMP entity that may realize an instance of a context with a particular contextName.
  • Context Name – A contextName is used to name a context. Each contextName must be unique within an SNMP entity.
  • PDU – The SNMP PDU (Protocol Data Unit) is used for communication between the SNMP entities.
3. 那么SNMP PDU内部又是什么样子呢?

  • PDU Type- Specifies the type of PDU
  • Request ID- Associates SNMP requests with responses.
  • Error Status- Indicates one of a number of errors and error types. It is set only in Response PDU, for rest it is set as 0.
  • Error Index- Associates an error with a particular object instance. It is set only in Response PDU, for rest it is set as 0.
  • Variable Bindings- Each variable binding associates a particular object instance with its current value. For Get and GetNext requests, the value is ignored.
4. 除此之外,SNMP Trap是一种特殊的消息,它是由SNMP agent 发给一个或者多个SNMP manager station的一种通知,用于报告终端设备的状态。它的报文又是什么样子呢?
  • PDU Type- Specifies the type of PDU
  • Enterprise – Identifies the management enterprise under whose registration authority the trap was defined.
  • Agent address – IP address of the agent
  • Generic trap type – Used to identiy thegeneric trap. There are six types of generic traps.
  • Specific trap type – Used to identify aspecifictrap.
  • Time Stamp – Value of the sysUpTime mib object

你可能感兴趣的:(String,object,Security,Integer,Authentication,Parameters)