投影片下載

advertisement
NS-2網路模擬
Rung-Shiang Cheng (程榮祥)
Department of Computer and Communication, Kun Shan University
rscheng@mail.ksu.edu.tw
http://teachers.ksu.edu.tw/rscheng/
Outline
 NS-2基本操作
– NS-2安裝與設定(for Linux)
– 個別套件的安裝
 範例介紹
– Improving TCP Performance with Bandwidth Estimation
and Selective Negative ACK Wireless Networks
NS-2安裝與設定(for Linux)
3
NS-2是什麼?
 Network Simulator, version 2
– 物件導向網路模擬器
– C++, OTCL
– Router, Link, End point, TCP/IP protocols
– Ethernet, WiFi, Sensor Networks
4
NS-2的下載與安裝
 下載NS-2
– NS-2網址 http://www.isi.edu/nsnam/ns/
– Download and Build ns

• Getting everything at once
• Ns-allinone 套件
 選擇 current release 2.XX
5
NS-2的下載與安裝
 安裝NS-2
– 解壓縮
– 安裝
– 開始進行安裝….
NS-2的下載與安裝
 各別套件的安裝位置
7
NS-2的下載與安裝
 安裝完成訊息
8
NS-2的下載與安裝
 修改使用者環境設定
 將NS-2要求設定的路徑,加入PATH參數中
9
.bashrc範例
10
測試可否使用Network Animator
 請在命令列(Command Line)輸入nam指令
 若可以看到下列視窗表示nam安裝成功 (若否,則進行個別
套件安裝)
目前使用的
是1.13版
個別套件的安裝 – 以NAM為例
 Download and Build ns
– Getting the Pieces
最新版本的
nam
12
下載新版的nam
 將下載的檔案移至NS-allinone的目錄下
 原先的版本是nam-1.13,新的版本是nam-1.14
個別套件的安裝 – 以NAM為例
 使用tar指令將下載的檔案解壓縮
 開始進行安裝
…..(省略)……
14
個別套件的安裝 – 以NAM為例
 檢查是否產生nam執行檔
 指定使用新的NAM版本來取代舊的NAM版本
15
測試可否使用新安裝好的Network Animator
 請在命令列(Command Line)輸入nam指令
 若可以看到下列視窗表示nam安裝成功
目前使用的
版本已經更
新為1.14版
Getting Older Versions of Ns
17
開始使用NS-2
 Hello World程式
如何使用NS-2進行網路模擬
 NS-2的執行流程
19
如何使用NS-2進行網路模擬
 設計模擬劇本
 產生網路拓撲
 產生網路流量
 利用NAM觀察模擬過程
The first TCL script (1/3)
使用文字編輯器輸入下列TCL程式碼 (檔名為template.tcl)
程式碼來源 ⇒ http://www.isi.edu/nsnam/ns/tutorial/index.html
The first TCL script (1/3)
 在命令列輸入ns template.tcl
The first TCL script (1/3)
 執行結果
沒有任何東西….(因為尚未產生網路拓撲)
產生網路拓撲 (2/3)
加入這段
程式碼:
產生2個node並
建立duplex-link
程式碼來源 ⇒ http://www.isi.edu/nsnam/ns/tutorial/index.html
The first TCL script (2/3)
 重新執行程式
已經產生網路拓樸,但沒有資料在
傳送….
The first TCL script (3/3)
再接下去
加入這段
程式碼:
產生CBR流量並
設定傳資料的起
始和結束時間
The first TCL script (3/3)

 修改後, 重新執行程式

經過0.5秒後開
始傳送資料
按下play…
Improving TCP Performance with Bandwidth
Estimation and Selective Negative ACK
Wireless Networks
Rung-Shiang Cheng
Assistant Professor
Department of Computer and Communication, Kun Shan University
Email: rscheng@mail.ksu.edu.tw
1. Rung-Shiang Cheng, Hui-Tang Lin, Improving TCP Performance with Bandwidth Estimation and Selective Negative
Acknowledgment in Wireless Networks, Journal of Communications and Networks, vol. 9, no. 3, pp. 236-246, Sep. 2007.
(SCI)
Outline
 Introduction
 TCP Congestion Control
 TCP Enhancement
– Bandwidth Estimation Schemes for TCP over High-Speed
Networks
– SNACK-based Error Recovery Scheme
 Conclusion
TCP Overview
 TCP is the most widely used Internet protocol
– Web, FTP, Telnet, E-mail, Peer-to-peer etc.
 A two way, reliable, connection-oriented protocol
– Reliable data transfer
• Byte-stream
– App writes bytes, TCP sends segments
– Flow control: keep sender from overrunning receiver
– Congestion control: keep sender from overrunning
network
30
Reliability in TCP
 Checksum used to detect bit level errors
 Sequence numbers used to detect sequencing errors
– Duplicates are ignored
– Reordered packets are reordered (or dropped)
– Lost packets are retransmitted
 Timeouts used to detect lost packets
– Requires RTO calculation
– Requires sender to maintain data until it is ACKed
31
Motivation
 Why Study TCP Performance
– Dependence on TCP/IP networks
• More people rely on TCP/IP networks than ever before
– Emergence of New Networking Technologies
• TCP algorithms suitable for one environment, do not always work best in
another, e.g., Wireless (WiFi, WiMax), satellite, High-speed
networks etc.
• Need for research into new algorithms
 Critical Role of TCP
– Many believe that network performance can be boosted by simply
upgrading hardware
– TCP has total control of how application data should be released to the
network
– Unless TCP is optimized, hardware alone cannot boost network
performance
32
Congestion Control
 Approach: increase transmission rate (congestion window
size), probing for usable bandwidth, until loss occurs
– additive increase: increase cwnd by 1 MSS every RTT
until loss detected
– multiplicative decrease: cut cwnd in half after loss
W  1,
W  1 / W ,

W 
W / 2,
1,
S low- startph ase, if W  Wt
C on ge stion
avoidan ce, if W  Wt
if congestion(receivetriple- duplicateACK)
upon timerexpiry
W: congestion window
Wt: slow-start threshold
33
Poor Link Unitization at High BandwidthDelay Product (BDP) Networks
 Internet’s subsequent growth and worldwide expansion has
meant faster links and increased diversity in network access
technologies
 TCP congestion control performs poorly as bandwidth or delay
increases
– TCP increases by 1 Packet/RTT even if spare bandwidth is
huge
– A single TCP flow can saturate a 10Gbps link where there
is unrealistically low packet loss
 Because TCP lacks fast response
34
Enhanced Startup Procedure
 Two changes in the modified start-up procedure
– An appropriate initial threshold
– Smooth the transition from the slow-start phase to the
congestion-avoidance phase
 Goal
– Fast response to currently available bandwidth
– Friendly to TCP flows that potentially share bandwidth
– Scalable (no per-flow state)
35
Enhanced Startup Procedure
W
(1)
t
W   t  b  q (2)

W  (b  q )
1



  bq 
(3)
t
t
      1     
1

(4)
      b  q     1     
t

Based on Eq. (4), Wt is computed every round-trip
Wt    t
(5)
36
Enhanced Startup Procedure
 The source updates its window size for each ACK received, as
follows:

 W
W  1   ,
W 
 Wt 
W  1 / W ,

S l owstart, if W  Wt
C on ge stion
avoidan ce, if W  Wt
 When a triple-duplicate ACK is received:
ˆ  m/ tlong (7)
Wt  W / 2
W  max { Wt , ˆ  t }
(8)
37
(6)
加入自行修改的TCP模組
 切換目徑至tcp 目錄下:
 新增自行修改的TCP模組
 接著到ns目錄下編輯Mackfile
 將新增的模組名稱加入Makefile中
 最後重新編譯Makefile即可
Simulation Model
Simplified TCP network model
 Default value
– Bottleneck: 155 Mbps
– RTT: 20 ms
– Packet size 512 Bytes
39
Numerical Results
Reno: 63.44%
Vegas: 63.53%
Modified TCP 95.14%, in the
first 20 seconds
(a). Congestion window dynamic
40
計算Queue length
(b). Reno startup procedure
(c.) Modified startup procedure
Numerical Results
Goodput achieved with different bottleneck link capacities (RTT = 20 ms)
42
Numerical Results
Effect of different round-trip time (bottleneck bandwidth = 155 Mbps)
43
Numerical Results
TCP goodput and the corresponding packet drop rate (RTT = 20 ms)
Queue length at
bottleneck:
Buffer size = 19
Reno TCP
44
Modified TCP
Numerical Results
Fair share: 15.50 Mbps
Modified TCP : 15.53 Mbps
Reno: 11.83 Mbps
Fairness index: 0.982
Variations of congestion window
size (bottleneck =155 Mbps)
45
Numerical Results
TCP goodput and fairness index
Jain’s Fairness Index:


f (x , x , x x ) 
1
2
3
n

2
n
i 1 i
2
n
i 1 i
n
x
x
TCP Performance Issues in Wireless
Environments
 Limited by
– Erratic bit-error
– Varying latency
– Shared spectrum
• pose formidable challenges when attempting to provide
reliable, end-to-end data transmission for transport protocols
such as TCP
 Inappropriate reduction of congestion window
– Wireless transmission errors not related to network
congestion
– TCP backs off upon detection of packet loss
– Severe degradation in TCP throughput
47
TCP Enhancement Schemes
 Splitting TCP Connections
– Indirect-TCP (I-TCP), Snoop Agent
 Link-Layer schemes
– Explicit Loss Notification (ELN)
 End-to-end schemes
– SACK: adding Selective ACK to TCP
– Combat multiple losses problem
– Cannot provide the status of the receiver buffer completely
if the number of blocks is greater than three
48
Selective Negative Acknowledgement
 Goal
– Enhance the TCP performance, leaving the functionality of the
MAC protocol unchanged
 Integrates the respective capabilities of SACK and
negative acknowledgement (NAK)
 Capable of specifying a large number of holes in a bitefficient manner
 hole 1 offset: specifies the starting
location of the first hole
 hole 1 length: the size of the first hole
 bit-vector: missing data in the
corresponding MSS-sized block of
the receiver buffer
Structure of SACK and SNACK options
49
SNACK Bit-vector Example
Receiver side buffer
Retransmitted segment 6 received but
segment 1 not received
SNACK example
Retransmitted segment 1 received but
segment 6 not received
50
Proposed Error Recovery Procedure
51
Performace Evaluation
 Simulation topology
Gilbert-Elliott model
PG= 0.001, PB = 0.005,
PGG =0.96, PBB = 0.94
 Gilbert-Elliot error model
– Good state, G: losses occur with a low probability PG
– Bad state, B: the channel operates in a fading condition and the loss
probability , PB, is higher
52
Analytical Model
Basic access mechanism
Virtual carrier sensing mechanism
TDATA / (DIFS + TDATA + SIFS + TACK)
ThnoRTS / CTS 

ThRTS / CTS 
DIFS  TDATA1  SIFS  TACK
2  DIFS  SIFS  TACK
TDATA / (DIFS + TRTS + TCTS + TDATA + (3.
SIFS) + TACK)
m
 (CWmin /2) SLOT  DIFS  TDATA2  SIFS  TACK  (CWmin /2) SLOT
m
 (CWmin /2) SLOT   TDATA1  TDATA2
m
2  DIFS  3  SIFS  TRTS  TCTS  TACK  (CWmin /2) SLOT  TDATA1  TDATA2
TDATA1: the time required to transmit a MAC frame including the TCP data packet
TDATA2: the time required to transmit a MAC frame including the TCP layer ACK
TACK: the time required to transmit a MAC layer ACK frame including a physical layer header
(CWmin /2).SLOT: the assumed average backoff time
53
Effect of Channel Collisions and Physical Errors
The analytical upper bound of TCP
throughput over 802.11 networks
TCP throughput over 802.11 WLAN
(packet size = 1400 bytes)
54
the high-speed link is
more seriously
affected by losses
Comparison between SNACK and SNACK-S
Figure 1. TCP goodput with
different RTT
Figure 2. TCP goodput with
different FER
Figure 1的Unix Shell Script
Figure 2的Unix Shell Script
Conclusion
 Large delay-bandwidth networks
– Resolve lack-fast-response problem in TCP
– Improve throughput while remain fair to other active TCP
implementation
 Wired/wireless Networks
– Applies SNACK-based error recovery scheme to improve the
performance of TCP over wireless channels.
– SNACK scheme recovers from packet loss events in an effective
manner
 Simulation results show that the proposed scheme greatly
improves the TCP goodput in heterogeneous wired/wireless
networks
58
Download