Snmpv1: Communication and Functional Models
Snmpv1: Communication and Functional Models
Snmpv1: Communication and Functional Models
SNMPv1:
Communication and Functional Models
SNMP Architecture
SNMP Manager SNMP Agent
SNMP Manager SNMP Agent
Application Application
GetNext-Request
GetNext-Request
Get-Response
Get-Request
Set-Request
Get-Response
Get-Request
Set-Request
Trap
Trap
SNMP SNMP
UDP UDP
IP IP
網路介面 網路介面
Network
SNMP Messages
• Get-Request
• Get-Next-Request
• Set-Request
• Get-Response
• Trap
• Generic trap
• Specific trap
Administrative Model
Community Name
Used to validate the SNMP messages.
SNMP Password.
Authentication Failure
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
community
Access Policy
Manager
Community
Community Profile 1
Agent 1
Community Profile 2 Agent 2
Generalized
Administration
Model
Proxy Access Policy
Protocol Entities
Default UDP Ports for SNMP
Management Network Elements (NEs)
Station
Manager Agent
SNMP SNMP
162 Any 161 Any
UDP UDP
IP IP
網路介面 網路介面
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
SNMP Message Message ::=
SEQUENCE {
Version Identifier version
community
INTEGER {version-1(0)},
OCTET STRING,
Community Name }
data ANY
GetResponse
PDU type request-id error-status error-index variable-bindings
variable-bindings
name value name value ... name value
Trap-PDU
Enterprise:
Enterprise Trap-PDU ::= [4]
IMPLICIT SEQUENCE {
Type of Object generating trap.
enterprise OBJECT IDENTIFIER,
Agent Address:
Address agent-addr NetworkAddress,
Address of object generating trap. generic-trap INTEGER {
Generic Trap:
Trap coldStart(0),
Generic trap type. warmStart(1),
linkDown(2),
Specific Trap:
Trap linkUp(3),
Enterprise specific trap. authenticationFailure(4),
Time Stamp:
Stamp egpNeighborLoss(5),
Time elapsed between the last enterpriseSpecific(6)},
initialization of the network entity and specific-trap INTEGER,
the generation of the trap. time-stamp TimeTicks,
Variable Bindings variable-bindings VarBindList
“Interesting” information }
Enterprise: .1.3.6.1.4.1.311.1.1.3.1.1
Agent-Address: 10.10.13.137
Generic-Trap: 4
Specific-Trap: 0
Timestamp: 29756264
#VarBinds: 0
Enterprise-Specific Traps
Agent
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.118 .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 6c 69 63 a0 1a 02 0'.....public...
16: 02 18 bc 02 01 00 02 01 00 30 0e 30 0c 06 08 2b .........0.0...+
32: 06 01 02 01 01 01 00 05 00 -- -- -- -- -- -- -- ................
0: SNMP MESSAGE (0x30): 39 bytes
2: INTEGER VERSION (0x2) 1 bytes: 0 (SNMPv1)
5: OCTET-STR COMMUNITY (0x4) 6 bytes: "public"
13: GET-REQUEST-PDU (0xa0): 26 bytes
15: INTEGER REQUEST-ID (0x2) 2 bytes: 6332
19: INTEGER ERROR-STATUS (0x2) 1 bytes: noError(0)
22: INTEGER ERROR-INDEX (0x2) 1 bytes: 0
25: SEQUENCE VARBIND-LIST (0x30): 14 bytes
27: SEQUENCE VARBIND (0x30): 12 bytes
29: OBJ-ID (0x6) 8 bytes: .1.3.6.1.2.1.1.1.0
39: NULL (0x5) 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 6c 69 63 a2 36 02 0C.....public.6.
16: 02 18 bc 02 01 00 02 01 00 30 2a 30 28 06 08 2b .........0*0(..+
32: 06 01 02 01 01 01 00 04 1c 53 75 6e 20 53 4e 4d .........Sun SNM
48: 50 20 41 67 65 6e 74 2c 20 53 55 4e 57 2c 55 6c P Agent, SUNW,Ul
64: 74 72 61 2d 31 -- -- -- -- -- -- -- -- -- -- -- tra-1...........
0: SNMP MESSAGE (0x30): 67 bytes
2: INTEGER VERSION (0x2) 1 bytes: 0 (SNMPv1)
5: OCTET-STR COMMUNITY (0x4) 6 bytes: "public"
13: RESPONSE-PDU (0xa2): 54 bytes
15: INTEGER REQUEST-ID (0x2) 2 bytes: 6332
19: INTEGER ERROR-STATUS (0x2) 1 bytes: noError(0)
22: INTEGER ERROR-INDEX (0x2) 1 bytes: 0
25: SEQUENCE VARBIND-LIST (0x30): 42 bytes
27: SEQUENCE VARBIND (0x30): 40 bytes
29: OBJ-ID (0x6) 8 bytes: .1.3.6.1.2.1.1.1.0
39: OCTET-STR (0x4) 28 bytes: "Sun SNMP Agent, SUNW,Ultra-1"
system.sysDescr.0 : DISPLAY STRING- (ascii): Sun SNMP Agent, SUNW,Ultra-1
SNMP-Walk
- Use of SNMP Get-Next Request
snmptrapd, snmptrap u
c
UNSIGNED
COUNTER32
s STRING
snmptrapd -L o x
STRING
HEX
d DECIMAL
snmptrapd.conf STRING
n NULLOBJ
"\usr\etc\snmp\snmptrapd.conf" o
t
OBJID
TIMETICKS
authCommunity log comm a IPADDRESS
b BITS
logOption o
或
logOption f C:\logs\snmptraps.log
snmptrap
snmptrap -v 1 -c comm 10.10.1.15 .1.3.6.1.4.1.19652 10.34.11.78 2 0 "" ifIndex.3 i
3
snmptrap -v 1 -c comm 10.10.1.15 .1.3.6.1.4.1.19652 10.34.11.78 6 99 ""
snmptrap -v 1 -c comm managerIP enterpriseOID agentAddress genericTrap SpecificTrap
timeStamp oid type value oid type value …
注意事項
Windows 作業系統本身也有 snmptrap 指令,但
與 net-snmp 之 snmptrap 指令不同。
在 Command Line 模式下,執行 snmptrap 後,若
snmptrapd 沒收到 trap ,可能是執行 Windows 的
snmptrap 。
解決之道
將 net-snmp 之 snmptrap.exe 改名
snmptrap.exe 位於目錄 "usr\bin\"
"snmptrap.exe" "netsnmptrap.exe"
netsnmptrap -v 1 -c comm …
Get System Information
Get “System Group” of MIB II
Use get_request or get_next_request
sysDescr .1.3.6.1.2.1.1.1.0
sysObjectID .1.3.6.1.2.1.1.2.0
sysUptime .1.3.6.1.2.1.1.3.0
sysContact .1.3.6.1.2.1.1.4.0
sysName .1.3.6.1.2.1.1.5.0
sysLocation .1.3.6.1.2.1.1.6.0
Get Interface Information
Get “Interface Group” of MIB II
Repeatedly Use “get_next_request”
Note: We don’t know the ifIndex values in
ifTable.
First get the next object of .ifTable.ifEntry.0
Then repeatedly “get_next”
(C2 - C1 ) 8
Utilization (%) = 100%
(t2 - t1) Bandwidth
SNMP MIB Group