1 / 19

SNMP 訊息格式

SNMP 訊息格式. IP 標頭. UDP 標頭. SNMP 訊息. SNMP 標頭. PDU 標頭. PDU 資料. Message ::= SEQUENCE { version INTEGER {version-1(0)}, community OCTET STRING, data ANY } . Version. Community. SNMP PDU. SNMP Header. SNMP Message Version Identifier

kipp
Download Presentation

SNMP 訊息格式

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SNMP 訊息格式 IP 標頭 UDP 標頭 SNMP 訊息 SNMP 標頭 PDU 標頭 PDU 資料

  2. Message ::= SEQUENCE { version INTEGER {version-1(0)}, community OCTET STRING, data ANY } Version Community SNMP PDU SNMP Header • SNMP Message • Version Identifier • Community Name ( “public”) • Protocol Data Unit • The length of SNMP messages should not exceed 484 octets.

  3. SNMP 區域名稱 • Community • Relationship between an Agent and Managers. • Community Name • Used to validate the SNMP messages. • A device can participate in more than one community (password). • A community name (password) defines the scope of control that a manager has over elements in a community. • Default community name: “public”.

  4. PDU Header • 可分成兩種形式 • 針對 GetRequest , GetNextRequest , SetRequest , GetReponse • 針對 Trap 而言 PDU 型態 要求代號 錯誤狀況 錯誤索引 generic-trap time-stamp specific-trap PDU type agent-addr enterprise variable-bindings

  5. PDU 型態 • 五種 SNMP-PDUs 型態 SNMP-PDUs::= CHOICE { getrequest GetRequest-PDU, get-next-request GetNextRequest-PDU, get-response GetResponse-PDU, set-request SetRequest-PDU, trap Trap-PDU}

  6. SNMP PDU • Request-id • Error-status • Error-index PDU ::= SEQUENCE { request-id INTEGER, error-status INTEGER { noError(0), tooBig(1), noSuchName(2), badValue(3), readOnly(4) genErr(5)}, error-index INTEGER, variable-bindings SEQUENCE OF { name ObjectName, value ObjectSyntax } }

  7. PDU type request-id 0 0 variable-bindings PDU type request-id variable-bindings error-status error-index SNMP PDUs (cont.) • GetRequest, GetNextRequest, SetRequest • GetResponse

  8. Trap PDU Trap-PDU ::= [4] IMPLICIT SEQUENCE { enterprise OBJECT IDENTIFIER, agent-addr NetworkAddress, generic-trap INTEGER { coldStart(0), warmStart(1), linkDown(2), linkUp(3), authenticationFailure(4), egpNeighborLoss(5), enterpriseSpecific(6)}, specific-trap INTEGER, time-stamp TimeTicks, variable-bindings VarBindList } Enterprise: Type of Object generating trap. AgentAddress: Address of object generating trap. GenericTrap: Generic trap type. SpecificTrap: Enterprise specific trap. TimeStamp: 表示該 Agent 啟動後,到發出 trap 的時間 VariableBindings “Interesting” information

  9. PDU 資料 • Variable binding VarBindList • VarBindList::=SEQUENCE OF VarBind • VarBind::=SEQUENCE { name ObjectName, value ObjectSyntax} Object Name Object Syntax Object Name Object Syntax

  10. 完整 SNMP 訊息格式 SNMP 標頭 PDU 標頭 PDU 資料

  11. BER 基本編碼方式 • BER 主要是將 ASN.1所描述的網管物件轉換成 a string of octets 的格式,包含以下三個欄位: • Type : 表示該網管物件的資料型態 • Length : 表示該網管物件內容的長度,以 Byte為單位 • Value : 表示該網管物件內容值

  12. BER 基本編碼方式(cont.) • INTEGER (0x02) • OCTET STRING (0x04) • OBJECT IDENTIFIER (0x06) • NULL (0x05) • SEQUENCE/SEQUENCE OF (Ox30) • GetRequest-PDU (0xA0) • GetNextRequest-PDU (0xA1)

  13. BER 基本編碼方式(cont.) • GetResponse-PDU (0xA2) • SetRequest-PDU (0xA3) • Trap-PDU (0xA4)

  14. Example 1 • Question:Manager 利用 SNMP protocol 去詢問 Agent 的 sysName (1.3.6.1.2.1.1.5) 經過 BER 的編碼過後的 SNMP Message SNMP 標頭 PDU 標頭 PDU 資料

  15. Example 1 (cont.) • 0:30290201 00 0406 70 75 62 6C 69 63 a01c02 16:04 05 ae 56 02 0201 00 0201 00 300e300c06 32:08 2b 06 01 02 01 01 05 00 0500 紅色:資料型態 黃色:長度 白色:內容 • INTEGER (0x02) • OCTET STRING (0x04) • OBJECT IDENTIFIER (0x06) • NULL (0x05) • SEQUENCE/SEQUENCE OF (Ox30) • GetRequest-PDU (0xA0)

  16. Object ID 編碼方式 • 針對 object ID 的前面兩個位數表示方法: • 例如:1.3.6.1………….. • Content: the first two numbers, x and y, encoded as 40x+y in 1 byte • 1.3 ------> 2B

  17. Example 2 • 當 Agent 收到 Manager 傳送過來的 Request message 時,立刻作 get Response message 的動作,如下: • 0:303e0201 00 0406 70 75 62 6C 69 63 a23102 16:04 05 ae 56 02 0201 00 0201 00 3023302106 32:08 2b 06 01 02 01 01 05 00 0415 … • INTEGER (0x02) • OCTET STRING (0x04) • OBJECT IDENTIFIER (0x06) • NULL (0x05) • SEQUENCE/SEQUENCE OF (Ox30) • GetRequest-PDU (0xA0)

  18. 30 2C 02 01 00 04 07 69 6E 74 65 72 6F 70 A0 1E 02 04 23 41 3D 3E 02 01 00 02 01 00 30 10 30 0E 06 0A 2B 06 01 02 01 02 02 01 0B 01 05 00 Message ::= SEQUENCE (0x30) version INTEGER (0x02) community OCTET STRING (0x04) GetRequest-PDU ::= [0] (10 1 00000 = 0xA0) request-id RequestID ::= INTEGER (0x02) error-status ErrorStatus ::= INTEGER (0x02) error-index ErrorIndex ::= INTEGER (0x02) variable-bindings VarBindList ::= SEQUENCE OF (0x30) VarBind ::= SEQUENCE (0x30) name ObjectName ::= OBJECT IDENTIFIER (0x06) value ObjectSyntax (NULL) Example 3

  19. Simple Network Management Protocol (SNMP) 參考 • RFC 1157 (SNMPv1), RFC 1215 (SNMPv1 Traps) • RFCs 1905-1907, 2578-2580 (SNMPv2) • RFCs 2571-2575 (SNMPv3)

More Related