實驗一 網路驅動程式安裝

Download Report

Transcript 實驗一 網路驅動程式安裝

網路實體連結
Instructor:
Teaching Assistant:
1
Outline
•
•
•
•
Structure of a Typical LAN
Simplex vs. Duplex
Wiring and Making connectors
Experiment Steps
2
Structure of a Typical LAN
3
Simplex vs. Duplex
• Baseband vs.Broadband
• Duplex: 2 NICs using Twisted Pair
Tx±
Tx±
Rx±
Rx±
X
Y
• Duplex: 2 NICs over one Hub
X
Rx±
Tx±
Rx±
Tx±
Rx±
Tx±
Tx±
Rx±
Hub
Y
4
Connector and Wire
• Connector:RJ-45
• Wiring:Category 5
– NIC to Hub/Switch
– NIC to NIC
– Hub/Switch to Hub/Switch
• Before Making A Cable
– NIC
– Hub/Switch
– Wiring and Connectors
5
Connector : RJ-45
• 8P ?
• Colors vs. Twisted Pairs
–
–
–
–
W-O & O
W-G & G
W-BL & BL
W-BR & BR
• 8 wires for 8 functions ?
– Nope !
網路卡插槽
接頭腳位
功能
1
Tx+
2
Tx3
Rx+
4
5
6
Rx7
8
-
6
Wiring : 5 Categories
Category
1
2
3
4
5
Description
銅線沒有纏繞,僅能傳輸聲音
銅線沒有纏繞,可傳資料
銅線纏繞絞距為 3 次/英尺
纏繞更密
纏繞最密
傳輸率
4 Mbps
10 Mbps
16 Mbps
100 Mbps
• The 6th Category ?
– Gears up for Gigabit Ethernet !!
7
3 Configurations
• NIC to Hub
Tx+ 1
Tx- 2
Rx+1
Rx- 2
雙絞線
Rx+ 3
Rx- 6
• NIC to NIC
• Hub to Hub
Tx+3
Tx- 6
甲端網路卡插槽
乙端集線器插槽
Tx+ 1
Tx- 2
Tx+ 1
Tx- 2
Rx+ 3
Rx- 6
Rx+ 3
Rx- 6
雙絞線
甲端網路卡插槽
乙端網路卡插槽
Rx+1
Rx- 2
Rx+1
Rx- 2
Tx+3
Tx- 6
甲端集線器插槽
雙絞線
Tx+3
Tx- 6
乙端集線器插槽
8
Before Making A Cable
• NIC-driver configuration
• Hub/Switch
• Wiring
• Caution
– Auto-Sense don’t always sense automatically
9
Experiment Steps (1/2)
• 製作五條網路線
接頭作法說明
網路線代號
線的甲端
1
2
3
4
5
6
7
8
U
橙白 橙 藍白 藍 綠白 綠 棕白 棕
V
按 TIA/EIA 568A 排列
X
同V
Y
按 TIA/EIA 568A 排列
Z
按 TIA/EIA 568B 排列
線的乙端
同左
按 568B 排列
同左
同左
– RJ-45接頭安裝說明
• 使用剝線器撥掉外皮
<注意使用剝線器要小心不要剝到自己的手 >
• 將各絞線依序導入接頭中的小溝
• 放入壓線器8P的壓線孔中,接著用力夾緊,接頭即告完
成
10
Experiment Steps (2/2)
• 測試線材與接頭
– 利用Hub(10/100Mbps)的燈號來測試每
一條線是否正常
• 若網路線在測試步驟中都沒有使燈亮過,很
有可能是您的製程有問題
11
網路協定觀察與分析
Instructor:
Teaching Assistant:
12
大綱
•
•
•
•
•
Introduction to sniffer
Ethereal Operation Guide
HTTP Protocol Overview
Protocol Analysis Example (HTTP)
Experiment Requirements
13
Networks
Introduction
to Sniffer
Traffic
Generator
Adapter Card
F10
Capture
From
<File>
Option
Discard
Capture
Filter
Classic Capture views
Trigger
Detector
Capture Buffer
Discard
Protocol
Expert Mode
Interpreters
Focus Mode
Classic Mode
F3
F3
Classic & Expert
Display
Filters
Object
Database
Display Views
Expert Overview
14
Disk File
Printer
Ethereal User Interface
擷取封包
前的部份
設定
針對已擷
取之封包
分析的一
些工具
15
設定欲擷取封包之網卡
開始擷
取封包
觀察此張
網路卡的
細節
16
設定欲擷取之封包類型
勾選表示
允許擷取
此類型的
封包
17
已擷取之封包資料圖
所有擷取
的封包
單一封包
內容
內容細節 : 十
六進位表示法 18
封包流量分析圖
UDP封包
時間分布
TCP封包
時間分布
選擇是否
顯示出來
選定所欲
進行分析
的類型
線條種類
的選擇
19
協定分佈圖
TCP封包
的佔有率
及其數量
UDP封包
的佔有率
及其數量
20
封包流向表
封包種類
針對140.113.179.36
這台節點所有傳接送的
封包總數和流量大小
21
主機流量統計
網路卡型
號
擷取封包
的時間
封包數量
總流量
22
HTTP Overview (1/2)
• Application-level, distributed, collaborative,
hypermedia information system.
• HTTP/0.9 (1990) : raw data transfer
• HTTP/1.0 (RFC1945) : MIME-like message
• HTTP/1.1 (RFC2068) : persistent connection,
caching, hierarchical proxies, new methods….
23
HTTP Overview (2/2)
Web Server
WWW Client A
TCP connection
Port 80
Proxy
WWW Client B
24
Multipurpose Internet Mail
Extension -- MIME
• Non-textual data --> RFC 822 (7 bit)
MIME-type
1. Textual message bodies other than US-ASCII
2. Textual header information other than US-ASCII
3. Non-textual message part
4. Multi-part message bodies
25
Protocol Parameters
• HTTP version
• URI (Uniform Resource
Identifiers)
• Date/Time
• Character sets
• Content coding
• Transfer coding
• Media types
26
Persistent Connections
• Separate TCP connections (HTTP/1.0) :
increasing HTTP server load and traffic
load
• Default behavior of HTTP/1.1
• Either client or server close connection by :
Connection : close
• Pipelined requests/responses within a
connection
27
HTTP Messages -- Methods
• OPTION : request for information about the
communication options available on the
request/response chain
• GET : retrieve information
• HEAD : retrieve information (test hypertext links
for validity, accessibility, and recent modification)
• POST : subordinate to a directory, newsgroup,
database...
• PUT : store entity
• DELETE : delete entity
• TRACE : see what is being received at the other
28
end of the request chain
HTTP Messages -- Status Codes
•
•
•
•
•
1XX : Informational
2XX : Success
3XX : Redirection (further actions needed)
4XX : Client error
Examples.
5XX : Server error
100 : Continue
201 : Created
302 : Multiple choices
403 : Forbidden
504 : Gateway time-out
29
Caching
• Reduces the number of network round-trips and
bandwidth requirement
• Semantic transparency
• Expiration model
– age, expiration(lifetime) calculation
• Validation model
– cache validator (Last-Modified header)
• Response cachability : 200, 203, 206, 300, 301,
410
• Cache control mechanism
30
Caching
• Cache control
– Cache control header
1. What is cachable
2. Expiration mechanism modify
3. Cache revalidation & reload control
4. Entity transform
31
Related RFC list
• RFC822 : Standard for the Format of ARPA Internet Text
Message
• RFC1630 : Universal Resource Identifier in WWW
• RFC1700 : Assigned Numbers
• RFC1738 : Universal Resource Locators
• RFC1808 : Relative Uniform Resource Locators
• RFC1945 : Hypertext Transfer Protocol -- HTTP/1.0
• RFC2045 : MIME part one
• RFC2047 : MIME part three
• RFC2069 : Digest Access Authentication
32
存取Yahoo首頁所產生的HTTP協定封包
使用filter
來篩選所有
HTTP協定
的封包
33
第一個HTTP封包內容
GET / HTTP/1.1
要求傳送根目錄下的首頁
由Accept、Accept-Language以及Accept-Encoding指明主機
端可接受的文件樣式。
由User-Agent指明本機端採用MSIE作為HTTP協定處理器。
由Connection指明TCP層繼續保持連線。
34
第二個HTTP封包內容
HTTP/1.1 200 OK
傳回根目錄下的首頁
由Server指明網頁端採用Apache/1.2.4作為HTTP協定處理器。
由Last-Modified指明最後修改時間為 13 Mar 2007 10:19:26。
由Content-type指明內容為text/html的文件樣式。
Data部分包含/news目錄下的首頁 。
35
網路協定列表:
• HTTP必須列入
實驗觀察
• 選擇另一個協定作
為觀察與分析的對
象,所有RFC可由
IETF首頁或
NCTUCCCA取得
協定
OSI layer
功能
SNMP
Application
ARP
Network
由IP位址查詢MAC位址。
RARP
Network
由MAC位址查詢IP位址。
DNS
Application
由domain name查詢IP位址。
SMTP
Application
寄送電子郵件至指定的電子郵件帳號。
POP3
Application
接收並保存電子郵件。
RPC
Session
呼叫並執行遠端主機上的程序。
RIP
Network
Unicast routing protocol。
DVMRP
Network
Multicast routing protocol。
NFS
Application
分散式檔案管理與存取系統。
NetBIOS
Presentation
在一群指定的主機間提供溝通機制,共享資源。
HTTP
Application
超媒體文件傳送、接收與管理。
RTP/RTSP
Application
支援在單和多目標廣播網路服務中傳輸即時資料。
SIP
Application
提供整合語音與其它多媒體的通訊服務。
網路設備與資料流量的監督與管理。
36
實驗三
Linux網路協定程式追蹤
教師:
助教:
Outline
• Why Linux ?
• Linux 核心的內部
• Linux 開機始末
•實驗步驟
38
Why Linux ?
• Free !!
• Compatible with System V & BSD UNIX
• Compliant to POSIX 1.0
• Fast update !!
• Internet
• Powerful !!
• Pure 32-bit OS
• Candidate OS for embedded system
• Source code open !!
• Suitable for academic use
39
Linux 核心內部
Application Level
User Programs & Applications
System call
Process
Management
Memory
Management
Concurrency
Multitasking
Vitual
Memory
File System
Files &
Directorys
FS types
Architecture
Dependent
Code
Memory
Manager
Block Device
CPU
RAM
Disks & CDs
Device
Control
TTY & Device
access
Kernel Level
Networking
Connectivity
Device
Control
Network
Subsystem
IF drivers
Console,
Serial Ports
Network
Interfaces
Kernel Parts
Features Implemented
Software Support
Hardware Control
Hardware Level
40
Linux 開機始末
•
•
•
•
•
•
Load the kernel
Probe & setup the hardware
Create system process
System initialization
getty
login process
41
實驗步驟
•安裝 Linux
•追蹤開機始末
•編譯核心
•設定Linux網路組態
•在kernel中追蹤 network driver
42
安裝 Linux
• Where to get it ?
– ftp://linux.cs.nctu.edu.tw
• Which distributions ?
– Fedora, Ubuntu, Debian
• Which versions?
– Fedora 5
• How do I install it ?
• Existing documents ?
– /usr/doc
43
追蹤Linux開機始末
• Capture bootup sequence
– dmesg
– Scroll Lock, Shift + [PgUp | PgDw]
– syslogd
• Traverse /etc/initab
• /etc/rc.d/
• Tools
• grep
• Microsoft Visio Studio - Edit - Find in files
44
編譯核心
• Obtain the kernel source
• make [config | menuconfig | xconfig]
– Modules support
– Choose your adapter driver
– Choose TCP/IP protocol stack
•
•
•
•
•
•
make clean, make
make modules_install
cp arch/i386/boot/bzImage to /boot
cp System.map to /boot
move to /boot and mkinitrd
rewrite grub/grub.conf
45
設定網路組態
• Internet 參數
– Network interface configuration
• ifconfig eth0 x.x.x.x netmask y.y.y.y broadcast
z.z.z.z
( Set IP address, netmask, broadcast address)
– Routing table configuration
• route add -net default gw 140.113.88.254 dev eth0
( Add new network route on device eth0 and route
packets via a gateway )
• route add -net 140.113.23.0 dev eth0
( Add new network route on device eth0 )
46
追蹤kernel中的network driver
• Trace by debugger (KDB)
• Trace by printing, record by logging
– klogd vs. syslogd
/etc/syslogd.conf
log file
Klogd
Daemon
Syslogd
Daemon
log file
......
Kernel
Routines
log file
• Trigger network modules by “ping”
47
決定待測機器
• (H and M)=(R and M)=(N1 and M)=(N2
and M)≠(F and M)
• 公式中的and代表作bitwise的AND運算。
• ( H and M ) = ( R and M ) 代表H和R在同一個network
狀態
本機位址
本機Netmask
已連上Internet
-
IP address(32-bit)
H(host)
M(mask)
router或gateway位址
已連上Internet
R(router)
選擇的遠端(跨subnet)待測機器位址
已連上Internet
F(far)
選擇的近端(同subnet)待測機器位址
已連上Internet
N1(near)
選擇的近端(同subnet)待測機器位址
尚未連上Internet
N2(near)
48
實驗四 Linux子網域分割之設
定與觀察
教師:
助教:
Outline
• Traditional IP Allocation
• Netmask: the Concept
• Subnetting Realization
– Proxy-ARP Transparent Router
– Different Lengths of Netmask
• How Kernel Works
– Broadcasting
– Routing Table Lookup
– Routing Table Cache
• Experiment
50
Traditional IP Allocation
51
Netmask: the Concept
Used to determine whether two
hosts are under the same
network
•Unicast:
•A → B
•A → Router → C
•Broadcast:
•A → Everyone
•Router:
•Longest Prefix Match
52
Subnetting Realization
- Proxy-ARP Transparent Router
•Get the mapping between
MAC address and IP address
of a host by ARP requests
•Sharing information with
each subnet
53
Subnetting Realization
- Different Lengths of Netmask
54
How Kernel Works
• Three possible scenarios when a packet arrives
– Routing Table Lookup, Routing Cache, Broadcasting
• Routing Table Lookup
55
How kernel works
• Routing Cache
• Broadcasting
– Set destination Ethernet address to ff:ff:ff:ff:ff:ff
56
Experiment
• Proxy-ARP
– B or C ping A
– B ping C
– Open ARP on A
– B or C ping A again
– B ping C again
• Longest Prefix Matching and Routing Cache
– Modify kernel source code and recompiled
– Load new kernel
– C ping B to check /var/log/messages
• Broadcasting
57