Chapter 5 SNMPv 1 Communication and Functional Models






















![Trap-PDU : : = [4] IMPLICIT SEQUENCE { Type of Object generating trap. enterprise Trap-PDU : : = [4] IMPLICIT SEQUENCE { Type of Object generating trap. enterprise](https://slidetodoc.com/presentation_image_h/f8a0efefa1228a6e3b77955054297f86/image-23.jpg)






















- Slides: 45
Chapter 5 SNMPv 1: Communication and Functional Models
SNMP Architecture SNMP Manager SNMP Agent SNMP UDP IP 網路介面 Network Trap Get-Response Set-Request Get. Next-Request Get-Request SNMP Agent Application Trap Get-Response Set-Request Get. Next-Request Get-Request SNMP Manager Application
SNMP Messages • • • Get-Request Get-Next-Request Set-Request Get-Response Trap • Generic trap • Specific trap
Administrative Model • • Based on community profile and policy SNMP Entities: • SNMP application entities - Reside in management stations and network elements - Manager and agent • SNMP protocol entities - Communication processes (PDU handlers) - Peer processes that support application entities
SNMP Community • • Security in SNMPv 1 is community-based Authentication scheme in manager and agent Community: Pairing of two application entities Community name: String of octets Two applications in the same community communicate with each other Application could have multiple community names Communication is not secured in SNMPv 1 - no encryption
SNMP Community n n n Community n Relationship between an Agent and Managers. Community Name n Used to validate the SNMP messages. n SNMP Password. n Default ‘Get’ community name: “public”. Authentication Failure n Agent sends “Authentication Failure Trap” to Manager.
SNMP Community
Community Profile • • • MIB view • An agent is programmed to view only a subset of managed objects of a network element Access mode • Each community name is assigned an access mode: : read-only and read-write Community profile = MIB view + access mode Operations on an object determined by community profile and the access mode of the object Total of four access privileges Some objects, such as table and table entry are non-accessible
Community Profile community
Access Policy • • Administration model is SNMP access policy SNMP community paired with SNMP community profile is SNMP access policy
Access Policy
Generalized Administration Model
Proxy Access Policy
Protocol Entities
Default UDP Ports for SNMP Management Station Network Elements (NEs) Manager Agent SNMP 162 UDP Any 161 UDP IP IP 網路介面 Any
Protocol Entities • Protocol entities support application entities • Communication between remote peer processes • Message consists of • Version identifier • Community name • Protocol Data Unit • Message encapsulated and transmitted
SNMP Message n n n n Version Identifier Community Name Protocol Data Unit Message : : = SEQUENCE { version community data } INTEGER {version-1(0)}, OCTET STRING, ANY The length of SNMP messages should not exceed 484 octets. Version Community SNMP PDU
SNMP PDUs
SNMP PDU Five SNMP PDUs: Get. Rquest : : = Get. Next. Request : : = Get. Response : : = Set. Request : : = Trap : : = [0] PDU [1] PDU [2] PDU [3] PDU [4] Trap-PDU : : = SEQUENCE { request-id INTEGER, error-status INTEGER { no. Error(0), too. Big(1), no. Such. Name(2), bad. Value(3), read. Only(4), gen. Err(5)}, error-index INTEGER, variable-bindings SEQUENCE OF { name Object. Name, value Object. Syntax } } PDU: Protocol Data Unit
error-status n n no. Error(0) too. Big(1) n n no. Such. Name(2) n n The value of any object named in the variable-bindings field does not manifest a type, length, and value that is consistent with that required for the variable. read. Only(4) n n Any object name in the variable-bindings does not match the name of some object available in the MIB view. bad. Value(3) n n The size of the Get. Response-PDU to be generated exceeds a local limitation. To set the value of an object with read-only access mode. gen. Err(5) n Any object named in the variable-bindings field cannot be accessed for reasons not covered by any of the foregoing rules.
error-index n n The index of the first variable, in the variable-bindings, with an error as indicated in the error-status field. If there are more than one error in the variable-bindings? n n Only the first error is indicated. For those variables without any error? n n Atomic vs. Best-effort SNMP is atomic!
SNMP PDU (cont. ) Get. Request, Get. Next. Request, Set. Request PDU type request-id 0 0 variable-bindings Get. Response PDU type request-id error-status error-index variable-bindings name value . . . name value
Trap-PDU : : = [4] IMPLICIT SEQUENCE { Type of Object generating trap. enterprise OBJECT IDENTIFIER, Agent Address: Address agent-addr Network. Address, Address of object generating trap. generic-trap INTEGER { cold. Start(0), Generic Trap: Trap warm. Start(1), Generic trap type. link. Down(2), Specific Trap: Trap link. Up(3), Enterprise specific trap. authentication. Failure(4), Time Stamp: Stamp egp. Neighbor. Loss(5), Time elapsed between the last enterprise. Specific(6)}, initialization of the network entity and specific-trap INTEGER, the generation of the trap. time-stamp Time. Ticks, variable-bindings Var. Bind. List Variable Bindings } “Interesting” information Enterprise: Enterprise PDU type enterprise agent-addr generic-trapspecific-traptime-stamp variable-bindings
Trap Type
Generic Trap Example Enterprise: Agent-Address: Generic-Trap: Specific-Trap: Timestamp: #Var. Binds: . 1. 3. 6. 1. 4. 1. 311. 1. 1. 3. 1. 1 10. 13. 137 4 0 29756264 0
Enterprise-Specific Traps n n Traps defined by enterprises Identification of Enterprise-Specific Traps n n n Enterprise OID Generic-Trap 6 Specific-Trap an Integer
Enterprise Trap Example Enterprise: . 1. 3. 6. 1. 4. 1. 522 Agent-Address: 10. 13. 24 Generic-Trap: 6 Specific-Trap: 4 Timestamp: 143739963 Variable. Bindings: (4). 1. 3. 6. 1. 4. 1. 522. 3. 14. 23. 1. 2. 11687128: 02: 18: 25. 1. 3. 6. 1. 4. 1. 522. 3. 14. 23. 11687128: 14. 1. 3. 6. 1. 4. 1. 522. 3. 14. 23. 1. 4. 11687128: (Info): Station 00092 d 142581 Associated. 1. 3. 6. 1. 4. 1. 522. 3. 14. 23. 1. 5. 11687128: Association. OK
Agent Manager
Get-Next Request A B T E 1. 1 1. 2 2. 1 2. 2 3. 1 3. 2 Z
Lexicographic Order
Get-Next Request MIB Tree : * In SNMP, Only leaf objects have values. 4 5 6 : Non-Leaf Object 1 2 3 : Leaf Object
Get-Next Requests with Indices
SNMP Get-Request Example >>snmpget -d 10. 144. 18. 1. 3. 6. 1. 2. 1. 1. 1. 0 Transmitted 41 bytes to camry (10. 144. 18. 118) port 161: Initial Timeout: 0. 80 seconds 0: 30 27 02 01 00 04 06 70 75 62 6 c 69 63 a 0 1 a 02 0'. . . public. . . 16: 02 18 bc 02 01 00 30 0 e 30 0 c 06 08 2 b. . 0. 0. . . + 32: 06 01 02 01 01 01 00 05 00 -- -- -- -. . . . 0: SNMP MESSAGE (0 x 30): 39 bytes 2: INTEGER VERSION (0 x 2) 1 bytes: 0 (SNMPv 1) 5: OCTET-STR COMMUNITY (0 x 4) 6 bytes: "public" 13: GET-REQUEST-PDU (0 xa 0): 26 bytes 15: INTEGER REQUEST-ID (0 x 2) 2 bytes: 6332 19: INTEGER ERROR-STATUS (0 x 2) 1 bytes: no. Error(0) 22: INTEGER ERROR-INDEX (0 x 2) 1 bytes: 0 25: SEQUENCE VARBIND-LIST (0 x 30): 14 bytes 27: SEQUENCE VARBIND (0 x 30): 12 bytes 29: OBJ-ID (0 x 6) 8 bytes: . 1. 3. 6. 1. 2. 1. 1. 1. 0 39: NULL (0 x 5) 0 bytes
SNMP Get-Response Example Received 69 bytes from 10. 144. 18. 118 port 161: 0: 30 43 02 01 00 04 06 70 75 62 6 c 69 63 a 2 36 02 0 C. . . public. 6. 16: 02 18 bc 02 01 00 30 2 a 30 28 06 08 2 b. . 0*0(. . + 32: 06 01 02 01 01 01 00 04 1 c 53 75 6 e 20 53 4 e 4 d. . Sun SNM 48: 50 20 41 67 65 6 e 74 2 c 20 53 55 4 e 57 2 c 55 6 c P Agent, SUNW, Ul 64: 74 72 61 2 d 31 -- -- -- -tra-1. . . 0: SNMP MESSAGE (0 x 30): 67 bytes 2: INTEGER VERSION (0 x 2) 1 bytes: 0 (SNMPv 1) 5: OCTET-STR COMMUNITY (0 x 4) 6 bytes: "public" 13: RESPONSE-PDU (0 xa 2): 54 bytes 15: INTEGER REQUEST-ID (0 x 2) 2 bytes: 6332 19: INTEGER ERROR-STATUS (0 x 2) 1 bytes: no. Error(0) 22: INTEGER ERROR-INDEX (0 x 2) 1 bytes: 0 25: SEQUENCE VARBIND-LIST (0 x 30): 42 bytes 27: SEQUENCE VARBIND (0 x 30): 40 bytes 29: OBJ-ID (0 x 6) 8 bytes: . 1. 3. 6. 1. 2. 1. 1. 1. 0 39: OCTET-STR (0 x 4) 28 bytes: "Sun SNMP Agent, SUNW, Ultra-1" system. sys. Descr. 0 : DISPLAY STRING- (ascii): Sun SNMP Agent, SUNW, Ultra-1
SNMP-Walk - Use of SNMP Get-Next Request n snmpwalk 10. 144. 18. 1. 3. 6. 1. 2. 1. 1 system. sys. Descr. 0 : DISPLAY STRING- (ascii): Sun SNMP Agent, SUNW, Ultra-1 system. sys. Object. ID. 0 : OBJECT IDENTIFIER: . iso. org. dod. internet. private. enterprises. 42. 2. 1. 1 system. sys. Up. Time. 0 : Timeticks: (198219958) 22 days, 22: 36: 39. 58 system. sys. Contact. 0 : DISPLAY STRING- (ascii): lino@ms. chttl. com. tw system. sys. Name. 0 : DISPLAY STRING- (ascii): camry system. sys. Location. 0 : DISPLAY STRING- (ascii): Information Technology Laboratory 3 F system. sys. Services. 0 : INTEGER: 72 (01001000)B
SNMP Trap Example Transmitted 64 bytes to 10. 144. 18. 100 port 162: 0: 30 3 e 02 01 00 04 06 70 75 62 6 c 69 63 a 4 31 06 0>. . . public. 1. 16: 09 2 b 06 01 04 01 84 64 01 01 40 04 0 a 90 12 74. +. . . d. . @. . t 32: 02 01 06 02 03 01 86 9 f 43 01 00 30 13 30 11 06. . . . C. . 0. 0. . 48: 04 2 b 06 01 01 04 09 54 72 61 70 20 74 65 73 74. +. . . Trap test 0: SNMP MESSAGE (0 x 30): 62 bytes 2: INTEGER VERSION (0 x 2) 1 bytes: 0 (SNMPv 1) 5: OCTET-STR COMMUNITY (0 x 4) 6 bytes: "public" 13: V 1 -TRAP-PDU (0 xa 4): 49 bytes 15: OBJ-ID ENTERPRISE (0 x 6) 9 bytes: . 1. 3. 6. 1. 4. 1. 612. 1. 1 26: IPADDRESS AGENT-ADDR (0 x 40) 4 bytes: 10. 144. 18. 116 32: INTEGER GENERIC-TRAP (0 x 2) 1 bytes: 6 35: INTEGER SPECIFIC-TRAP (0 x 2) 3 bytes: 99999 40: TIMETICKS TIME-STAMP (0 x 43) 1 bytes: 0 (0 x 0) 43: SEQUENCE VARBIND-LIST (0 x 30): 19 bytes 45: SEQUENCE VARBIND (0 x 30): 17 bytes 47: OBJ-ID (0 x 6) 4 bytes: . 1. 3. 6. 1. 1 53: OCTET-STR (0 x 4) 9 bytes: "Trap test"
net-snmp (Windows) n Download: n n Choose net-snmp-5. 5. 0 -2. x 64. exe or net-snmp-5. 5. 0 -1. x 86. exe Installation: n n http: //sourceforge. net/projects/net-snmp/files/net-snmp%20 binaries/5. 5 binaries/ if php-snmp or Get. If has been installed before net-snmp, n the mib directory will be C: usrmibs n Copy "C: Program Filesnet-snmpusrsharesnmpmibs" to C: usrmibs n Unzip http: //ycchen. im. ncnu. edu. tw/nm/macro. Removed. zip to C: usrmibs Commands: n snmpget, snmpgetnext, snmpset, snmpwalk, . . . n See http: //www. net-snmp. org/wiki/index. php/Tutorials Examples: n n n snmpget -v 1 -c public 10. 32. 10. 84. 1. 3. 6. 1. 2. 1. 1. 1. 0 snmpget -v 1 -c public 10. 32. 10. 84 if. Number. 0 sys. Up. Time. 0 snmpget -v 2 c -c public 10. 32. 10. 84 SNMPv 2 -MIB: : sys. Up. Time. 0 snmpwalk -v 1 -c public 10. 32. 10. 84 system snmpgetnext -d -v 1 -c public 10. 32. 10. 84 if. In. Octets. 1
snmptrapd, snmptrap n snmptrapd -L o snmptrapd. conf n "usretcsnmptrapd. conf" auth. Community log comm log. Option o TYPE: i u c s x STRING d STRING n o t a b INTEGER UNSIGNED COUNTER 32 STRING HEX DECIMAL NULLOBJ OBJID TIMETICKS IPADDRESS BITS 或 log. Option f C: logssnmptraps. log n snmptrap -v 1 -c comm 10. 1. 15. 1. 3. 6. 1. 4. 1. 19652 10. 34. 11. 78 2 0 "" if. Index. 3 i 3 snmptrap -v 1 -c comm 10. 1. 15. 1. 3. 6. 1. 4. 1. 19652 10. 34. 11. 78 6 99 "" snmptrap -v 1 -c comm manager. IP enterprise. OID agent. Address generic. Trap Specific. Trap time. Stamp oid type value …
注意事項 n Windows 作業系統本身也有snmptrap指令,但與 net-snmp之snmptrap指令不同。 在Command Line模式下,執行snmptrap後,若 snmptrapd沒收到trap,可能是執行Windows的 snmptrap。 n 解決之道 n n 將net-snmp之snmptrap. exe改名 n n snmptrap. exe位於目錄"usrbin" "snmptrap. exe" "netsnmptrap. exe" netsnmptrap -v 1 -c comm …
Get System Information n n Get “System Group” of MIB II Use get_request or get_next_request sys. Descr sys. Object. ID sys. Uptime sys. Contact sys. Name sys. Location . 1. 3. 6. 1. 2. 1. 1. 1. 0. 1. 3. 6. 1. 2. 1. 1. 2. 0. 1. 3. 6. 1. 2. 1. 1. 3. 0. 1. 3. 6. 1. 2. 1. 1. 4. 0. 1. 3. 6. 1. 2. 1. 1. 5. 0. 1. 3. 6. 1. 2. 1. 1. 6. 0
Get Interface Information n Get “Interface Group” of MIB II Repeatedly Use “get_next_request” Note: We don’t know the if. Index values in if. Table. First get the next object of. if. Table. if. Entry. 0 + Then repeatedly “get_next” + Until the whole subtree is visited. +
Traffic Monitoring n n Get “if. In. Octets” and “if. Out. Octets” of MIB II Interface Group t 1: C 1 t 2: C 2 Utilization (%) = (C 2 - C 1 ) 8 (t 2 - t 1) Bandwidth 100%
SNMP MIB Group