计算机网络管理应用技术
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
community: “bearread” mib: system.sysContact (1.3.6.1.2.1.1.4) system.sysName (1.3.6.1.2.1.1.5) system.sysLocation (1.3.6.1.2.1.1.6)
6/81
Installing SNMP Agent
Select the underlined item and click “next”
7/81
Installing SNMP Agent
8/81
Installing SNMP Agent
9/81
Installing SNMP Agent
10/81
21/tcp 23/tcp 25/tcp 110/tcp
User level process/services generally use port number value >= 1024
27/81
Socket Types
Streaming Socket Datagram Socket Raw Socket
2/81
Installing SNMP Agent
Installing SNMP Agent
(windowXP platform)
3/81
Installing SNMP Agent
SNMP Manager & SNMP Agent
4/81
Installing SNMP Agent
5/81
Installing SNMP Agent
28/81
Socket Programming: TCP Socket
Client Socket, Server Socket, New Socket
New Socket
Accept
Com mun icat
ing
Server Socket
Connect
Client Socket Remote IP Remote Port
23/81
Socket Programming
Socket Programming
24/81
Socket Programming: Socket
Sockets provide an interface for programming networks at the transport layer. Socket = IP Address + Port Network communication using Sockets is very much similar to performing file I/O Socket-based communication is programming language independent.
22/81
TCP vs. UDP
UDP (User Datagram Protocol) A protocol that sends independent packets of data, called datagrams, from one computer to another Without guarantees about arrival Example Applications: Clock Server SNMP RTP
i ce Re ve
Datagram Socket
Local IP Local Port
Send
Datagram InetAddress Data
Local IP Local Port
30/81
Socket Programming: An Example for Java UDP Socket
//Sender byte[ ] buffSend = new byte[1024]; String strHello = “Hello baby!”; buffSend = strHello.getBytes(); InetSocketAddress addr = new InetSocketAddress(“10.10.10.22", 1978); DatagramPacket pack = new DatagramPacket (buffSend, 0, buffSend.length, addr); DatagramSocket sockSend = new DatagramSocket(); sockSend.send(pack);
JRE is needed JDK1.5 released http://java.sun.com/j2se/1.5.0/download.jsp
14/81
Mibbrowser Demo
Load/Unload Modules Explore MIB elements Get-request Get-next Set-request Get-bulk Show in Table Show in Line
21/81
TCP vs. UDP
TCP (Transport Control Protocol) A connection-oriented protocol Provides a reliable flow of data between two computers Example applications: HTTP FTP Telnet
Installing SNMP Agent
11/81
MIB files: c:\windows\system32
12/81
Mibbrowser Demo
Mibbrowser Demo
13/81
Mibbrowser Download
Download Web site: http://www.adventnet.com 2 components included: Snmp Disign Studio (30 days trial) Mibbrowser
35/81
SNMP PDU in RFC1157
GetRequest-PDU GetNextRequest-PDU GetResponse-PDU SetRequest-PDU ::=[0]IMPLICIT PDU ::=[1]IMPLICIT PDU ::=[2]IMPLICIT PDU ::=[3]IMPLICIT PDU
Message::=SEQUENCE{ version INTEGER{version-1(0)}, community OCTET STRING, data ANY } PDU::=CHOICE{ get-request GetRequest-PDU, get-next-request GetNextRequest-PDU, get-response GetResponse-PDU, set-request SetRequest-PDU, trap Trap-PDU}
Port is represented by a positive (16-bit) integer value Some ports have been reserved to support common/well known services:
– – – –
ftp telnet smtp pop3
25/81
Socket Programming: Port
The TCP and UDP protocols use ports to map incoming data to a particular process running on a computer.
26/81
Socket Programming: Port
计算机网络管理应用技术
Computer Network Management Application Technology
张沪寅
1/81
Course Contents
Installing SNMP Agent A simple SNMP demo: Mibbrowser Basic Network knowledge Socket Programming SNMP & Basic Encoding Rules Implementation of SNMP: low level socket Implementation of SNMP: using Java APIs CiscoWorks 2000 application
15/81
An example of receiving packets
1. QQing 2. Web pages 3. Downloading 4. SNMP packets
16/81
Basic Network Knowledge
Basic Network Knowledge
17/81
Байду номын сангаас
Preparation: Basic Network Knowledge
32/81
SNMP & Basic Encoding Rules
SNMP & Basic Encoding Rules
33/81
SNMP PDU
SNMP PDU 0—Get; 1—Get-next; 2—Get-response; 3—Set-request; 4—Trap
34/81
SNMP PDU in RFC1157
36/81
SNMP PDU in RFC1157
VarBinList::=SEQUENCE OF VarBin VarBin::=SEQUENCE{ name ObjectName, value ObjectSyntax }
37/81
SNMP PDU structure
sequence
version
39/81
Implementation of SNMP: Low Level Socket
Implementation of SNMP:
Low Level Socket
40/81
Datagram content
Example parameter: operate:get-request get-next set-request (0xA0) (0xA1) (0xA2)
TCP/IP vs. ISO/OSI IEEE802.3 vs. Ethernet II IP packet format TCP vs. UDP
18/81
TCP/IP layers & Applications
19/81
IEEE802.3 & Ethernet II
20/81
IP Packet Format
31/81
Socket Programming: An Example for Java UDP Socket
//Receiver DatagramSocket sockRcv = new DatagramSocket(1978); byte [] buffRcv = new byte[1024]; DatagramPacket pack = new DatagramPacket(buffRcv, buffRcv.length); sockRcv.receive(pack); // blocking process buffRcv properly
Listening ...
29/81
Socket Programming: UDP Socket
Datagram Socket, Datagram Packet, InetAddress (Address + Port)
Datagram
d Sen
InetAddress Data
Recei ve
Datagram Socket
community
operatetype
ID
Error-status
Error-index
Sequence of
Sequence of
Sequence of
null
38/81
Basic Encoding Rules
BER: type + length + value common type codes: 30—SEQUENCE 02—INTEGER 05—NULL 04—STRING 06—OBJECT IDENTIFIER
PDU::=SEQUENCE{ request-id INTEGER, error-status INTEGER{noError(0), tooBig(1), noSuchName(2), badValue(3), readOnly(4), genError(5)}, error-index INTEGER, variable-binding VarBinList}