1 / 58

NS-2 網路模擬

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) 個別套件的安裝 範例介紹

catriona
Download Presentation

NS-2 網路模擬

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. 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

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

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

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

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

  10. .bashrc範例

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

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

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

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

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

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

  17. Getting Older Versions of Ns

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

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

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

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

  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)  按下play…  經過0.5秒後開始傳送資料 修改後, 重新執行程式

  28. Improving TCP Performance with Bandwidth Estimation and Selective Negative ACK Wireless Networks Rung-Shiang Cheng Assistant ProfessorDepartment of Computer and Communication, Kun Shan UniversityEmail: rscheng@mail.ksu.edu.tw 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. 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 W: congestion window Wt: 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 (1) (2) (3) (4) Based on Eq. (4), Wt is computed every round-trip (5)

  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. Simulation Model • Default value • Bottleneck: 155 Mbps • RTT: 20 ms • Packet size 512 Bytes Simplified TCP network model

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

  41. 計算Queue length (b). Reno startup procedure (c.) Modified 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 Results TCP goodput and the corresponding packet drop rate (RTT = 20 ms) Queue length at bottleneck: Buffer size = 19 Reno TCP Modified TCP

  45. 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)

  46. Numerical Results TCP goodput and fairness index 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. 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 Selective Negative Acknowledgement Structure of SACK and SNACK options

  50. 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

More Related