ns-2 網路模擬 rung-shiang cheng ( 程榮祥 ) department of computer and communication, kun shan...

Post on 30-Dec-2015

231 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

NS-2網路模擬

Rung-Shiang Cheng (程榮祥 )Department of Computer and Communication, Kun Shan University

rscheng@mail.ksu.edu.twhttp://teachers.ksu.edu.tw/rscheng/

Outline

NS-2基本操作– NS-2安裝與設定 (for Linux)

– 個別套件的安裝範例介紹

– Improving TCP Performance with Bandwidth Estimation and Selective Negative ACK Wireless Networks

3

NS-2 安裝與設定 (for Linux)

4

NS-2 是什麼 ?

Network Simulator, version 2– 物件導向網路模擬器– C++, OTCL– Router, Link, End point, TCP/IP protocols– Ethernet, WiFi, Sensor Networks

5

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

NS-2 的下載與安裝

安裝 NS-2– 解壓縮

– 安裝

– 開始進行安裝… .

NS-2 的下載與安裝

各別套件的安裝位置

7

8

NS-2 的下載與安裝

安裝完成訊息

9

NS-2 的下載與安裝

修改使用者環境設定

將 NS-2要求設定的路徑,加入 PATH 參數中

.bashrc 範例

10

測試可否使用 Network Animator

請在命令列 (Command Line)輸入 nam指令

若可以看到下列視窗表示 nam 安裝成功 (若否 ,則進行個別套件安裝 )

目前使用的是 1.13 版

12

個別套件的安裝 – 以 NAM 為例

Download and Build ns

– Getting the Pieces

最新版本的nam

下載新版的 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版

17

Getting Older Versions of Ns

開始使用 NS-2

Hello World程式

19

如何使用 NS-2 進行網路模擬

NS-2的執行流程

如何使用 NS-2 進行網路模擬

設計模擬劇本產生網路拓撲產生網路流量利用 NAM觀察模擬過程

The first TCL script (1/3)

程式碼來源 ⇒ http://www.isi.edu/nsnam/ns/tutorial/index.html

使用文字編輯器輸入下列 TCL 程式碼 ( 檔名為 template.tcl)

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 ChengAssistant ProfessorDepartment of Computer and Communication, Kun Shan UniversityEmail: 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

30

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

31

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

32

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

33

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

expiry timer upon 1,

ACK) duplicate- triple(receive congestion if ,2/

if , ,/1

if , ,1

W

WWWW

WWW

W t

t

avoidance Congestion

phase start-Slow

W: congestion windowWt: slow-start threshold

34

Poor Link Unitization at High Bandwidth-Delay 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

35

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)

36

Enhanced Startup Procedure

t

W (1)

(2) qbtW

(3)

11

1

tqb

t

qbt

qbW 1)(

(4)

tWt (5)

Based on Eq. (4), Wt is computed every round-trip

37

Enhanced Startup Procedure

The source updates its window size for each ACK received, as follows:

When a triple-duplicate ACK is received:

t

tt

WWWW

WWW

WW

W

if ,,/1

if ,,1

avoidance Congestion

start Slow(6)

longtm /ˆ

}ˆ ,{ max2/

tWWWW

t

t

(7)

(8)

加入自行修改的 TCP 模組

切換目徑至 tcp 目錄下 :

新增自行修改的 TCP模組接著到 ns目錄下編輯Mackfile

將新增的模組名稱加入Makefile中

最後重新編譯Makefile即可

39

Simulation Model

Default value– Bottleneck: 155 Mbps– RTT: 20 ms– Packet size 512 Bytes

Simplified TCP network model

40

(a). Congestion window dynamic

Numerical Results

Reno: 63.44% Vegas: 63.53%Modified TCP 95.14%, in the first 20 seconds

計算 Queue length

(c.) Modified startup procedure(b). Reno startup procedure

42

Numerical Results

Goodput achieved with different bottleneck link capacities (RTT = 20 ms)

43

Numerical Results

Effect of different round-trip time (bottleneck bandwidth = 155 Mbps)

44

Numerical ResultsTCP goodput and the corresponding packet drop rate (RTT = 20 ms)

Queue length at bottleneck:

Buffer size = 19

Reno TCP Modified TCP

45

Fair share: 15.50 MbpsModified TCP : 15.53 Mbps Reno: 11.83 MbpsFairness index: 0.982

Numerical Results

Variations of congestion window size (bottleneck =155 Mbps)

Numerical Results

TCP goodput and fairness index

ni i

ni i

nxn

xxxxxf

12

2

1321 ),,(

Jain’s Fairness Index:

47

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

48

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

49

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 bit-efficient 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

50

SNACK Bit-vector Example

Receiver side buffer

SNACK example

Retransmitted segment 6 received but segment 1 not received

Retransmitted segment 1 received but segment 6 not received

51

Proposed Error Recovery Procedure

52

Performace Evaluation

Simulation topology

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

PG= 0.001, PB = 0.005, PGG =0.96, PBB = 0.94

Gilbert-Elliott model

53

Analytical Model

DATA2DATA1ACK

ACKDATA2ACKDATA1CTSnoRTS

TTTSIFSDIFS

m

TSIFSTDIFSTSIFSTDIFS

mTh

SLOT /2)(CW2

SLOT /2)(CWSLOT /2)(CW

min

minmin/

DATA2DATA1ACKCTSRTSCTSRTS TTTTTSIFSDIFS

mTh

SLOT /2)(CW32 min/

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

TDATA / (DIFS + TDATA + SIFS + TACK) TDATA / (DIFS + TRTS + TCTS + TDATA +

(3 . SIFS) + TACK)

Basic access mechanism Virtual carrier sensing mechanism

54

Effect of Channel Collisions and Physical Errors

TCP throughput over 802.11 WLAN (packet size = 1400 bytes)

the high-speed link is more seriously affected by losses

The analytical upper bound of TCP throughput over 802.11 networks

Figure 1. TCP goodput with different RTT

Figure 2. TCP goodput with different FER

Comparison between SNACK and SNACK-S

Figure 1 的 Unix Shell Script

Figure 2 的 Unix Shell Script

58

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

top related