Presentation is loading. Please wait.

Presentation is loading. Please wait.

NS-2 網路模擬 Rung-Shiang Cheng ( 程榮祥 ) Department of Computer and Communication, Kun Shan University

Similar presentations


Presentation on theme: "NS-2 網路模擬 Rung-Shiang Cheng ( 程榮祥 ) Department of Computer and Communication, Kun Shan University"— Presentation transcript:

1 NS-2 網路模擬 Rung-Shiang Cheng ( 程榮祥 ) Department of Computer and Communication, Kun Shan University rscheng@mail.ksu.edu.tw http://teachers.ksu.edu.tw/rscheng/

2 Outline  NS-2 基本操作 – NS-2 安裝與設定 (for Linux) – 個別套件的安裝  範例介紹 – Improving TCP Performance with Bandwidth Estimation and Selective Negative ACK Wireless Networks

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

4 4 NS-2 是什麼 ?  Network Simulator, version 2 – 物件導向網路模擬器 – C++, OTCL – Router, Link, End point, TCP/IP protocols – Ethernet, WiFi, Sensor Networks

5 5 NS-2 的下載與安裝  下載 NS-2 – NS-2 網址 http://www.isi.edu/nsnam/ns/http://www.isi.edu/nsnam/ns/ – Download and Build ns Getting everything at once Ns-allinone 套件   選擇 current release 2.XX

6 NS-2 的下載與安裝  安裝 NS-2 – 解壓縮 – 安裝 – 開始進行安裝 ….

7 NS-2 的下載與安裝  各別套件的安裝位置 7

8 8 NS-2 的下載與安裝  安裝完成訊息

9 9 NS-2 的下載與安裝  修改使用者環境設定  將 NS-2 要求設定的路徑,加入 PATH 參數中

10 .bashrc 範例 10

11 測試可否使用 Network Animator  請在命令列 (Command Line) 輸入 nam 指令  若可以看到下列視窗表示 nam 安裝成功 ( 若否, 則進行個別 套件安裝 ) 目前使用的 是 1.13 版

12 12 個別套件的安裝 – 以 NAM 為例  Download and Build ns – Getting the Pieces 最新版本的 nam

13 下載新版的 nam  將下載的檔案移至 NS-allinone 的目錄下  原先的版本是 nam-1.13, 新的版本是 nam-1.14

14 個別套件的安裝 – 以 NAM 為例  使用 tar 指令將下載的檔案解壓縮  開始進行安裝 14 …..( 省略 )……

15 個別套件的安裝 – 以 NAM 為例  檢查是否產生 nam 執行檔  指定使用新的 NAM 版本來取代舊的 NAM 版本 15

16 測試可否使用新安裝好的 Network Animator  請在命令列 (Command Line) 輸入 nam 指令  若可以看到下列視窗表示 nam 安裝成功 目前使用的 版本已經更 新為 1.14 版

17 17 Getting Older Versions of Ns

18 開始使用 NS-2  Hello World 程式

19 19 如何使用 NS-2 進行網路模擬  NS-2 的執行流程

20 如何使用 NS-2 進行網路模擬  設計模擬劇本  產生網路拓撲  產生網路流量  利用 NAM 觀察模擬過程

21 The first TCL script (1/3) 程式碼來源 ⇒ http://www.isi.edu/nsnam/ns/tutorial/index.html 使用文字編輯器輸入下列 TCL 程式碼 ( 檔名為 template.tcl)

22 The first TCL script (1/3)  在命令列輸入 ns template.tcl

23 The first TCL script (1/3)  執行結果 沒有任何東西 ….( 因為尚未產生網路拓撲 )

24 產生網路拓撲 (2/3) 加入這段 程式碼: 產生 2 個 node 並 建立 duplex-link 程式碼來源 ⇒ http://www.isi.edu/nsnam/ns/tutorial/index.html

25 The first TCL script (2/3)  重新執行程式 已經產生網路拓樸, 但沒有資料在 傳送 ….

26 The first TCL script (3/3) 再接下去 加入這段 程式碼: 產生 CBR 流量並 設定傳資料的起 始和結束時間

27 The first TCL script (3/3)  修改後, 重新執行程式 經過 0.5 秒後開 始傳送資料 按下 play…  

28 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)

29 Outline  Introduction  TCP Congestion Control  TCP Enhancement – Bandwidth Estimation Schemes for TCP over High-Speed Networks – SNACK-based Error Recovery Scheme  Conclusion

30 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 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 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 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 W: congestion window W t : slow-start threshold

34 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 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 36 Enhanced Startup Procedure (1) (2) (3) (4) (5) Based on Eq. (4), W t is computed every round-trip

37 37 Enhanced Startup Procedure  The source updates its window size for each ACK received, as follows:  When a triple-duplicate ACK is received: (6) (7) (8)

38 加入自行修改的 TCP 模組  切換目徑至 tcp 目錄下 :  新增自行修改的 TCP 模組  接著到 ns 目錄下編輯 Mackfile  將新增的模組名稱加入 Makefile 中  最後重新編譯 Makefile 即可

39 39 Simulation Model  Default value – Bottleneck: 155 Mbps – RTT: 20 ms – Packet size 512 Bytes Simplified TCP network model

40 40 (a). Congestion window dynamic Numerical Results Reno: 63.44% Vegas: 63.53% Modified TCP 95.14%, in the first 20 seconds

41 計算 Queue length (c.) Modified startup procedure(b). Reno startup procedure

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

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

44 44 Numerical Results TCP goodput and the corresponding packet drop rate (RTT = 20 ms) Queue length at bottleneck: Buffer size = 19 Reno TCPModified TCP

45 45 Fair share: 15.50 Mbps Modified TCP : 15.53 Mbps Reno: 11.83 Mbps Fairness index: 0.982 Numerical Results Variations of congestion window size (bottleneck =155 Mbps)

46 Numerical Results TCP goodput and fairness index Jain’s Fairness Index:

47 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 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 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 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 51 Proposed Error Recovery Procedure

52 52 Performace Evaluation  Simulation topology  Gilbert-Elliot error model – Good state, G: losses occur with a low probability P G – Bad state, B: the channel operates in a fading condition and the loss probability, P B, is higher P G = 0.001, P B = 0.005, P GG =0.96, P BB = 0.94 Gilbert-Elliott model

53 53 Analytical Model T DATA1 : the time required to transmit a MAC frame including the TCP data packet T DATA2 : the time required to transmit a MAC frame including the TCP layer ACK T ACK : the time required to transmit a MAC layer ACK frame including a physical layer header (CWmin /2) . SLOT: the assumed average backoff time T DATA / (DIFS + T DATA + SIFS + T ACK ) T DATA / (DIFS + T RTS + T CTS + T DATA + (3 . SIFS) + T ACK ) Basic access mechanismVirtual carrier sensing mechanism

54 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

55 Figure 1. TCP goodput with different RTT Figure 2. TCP goodput with different FER Comparison between SNACK and SNACK-S

56 Figure 1 的 Unix Shell Script

57 Figure 2 的 Unix Shell Script

58 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


Download ppt "NS-2 網路模擬 Rung-Shiang Cheng ( 程榮祥 ) Department of Computer and Communication, Kun Shan University"

Similar presentations


Ads by Google