NS-2 Training 12/12/2011
Introduction NS-2: Network Simulator Generation 2 Latest Release: 2.35 / Nov. 4, 2011 Other Simulators OPNET QualNet ns-3
Installation (1/2) Cygwin Linux-like environment for Windows Download NS-2 The latest version: ns-2.35 ns-allinone-2.28/2.29 Download
Installation (2/2) Nam: Network Animator (nam-1.15 released Nov ) animation tool for viewing network simulation traces and real world packet traces
TCL Codes TCL (Tool Command Language) pronounced as "tickle" Basic terms Create a new simulator Definitions for nam Open a trace file Network behaviors Nodes, links, queue size, node position, traffic types, simulation times, etc. set ns [new Simulator] set nf [open out.nam w] $ns namtrace-all $nf set nd [open out.tr w] $ns trace-all $nd Initialize the packet format Create a scheduler Select the default address format /ns-2.xx/tcl/lib/ns-lib.tcl
Example
Output data NAM Trace appeared as "------" since no flag is set Explicit Congestion Notification
Analysis AWK Alfred Aho, Peter Weinberger, and Brian Kernighan programming language that is designed for processing text- based data pronounced as the same as the name of the bird, “auk”
Run AWK file Commands file1.awk a command file file2.tr a primary input file out.txt an output file awk -f file1.awk file2.tr awk -f file1.awk file2.tr > out.txt
AWK Form Pattern is typically an expression Action is a series of commands In NS-2 Simulator /pattern/ { action } BEGIN { action } END { action }
AWK You can measure Delay, Jitter, Packet loss, and Throughput Example
NSG2
NSG2 JAVA6.0 Creative Intelligence Information System Lab, Department of Computer Science and Engineering, National Sun Yat-sen University
Resources Gunplot Plot the analyzed results of awk Web site NS2 使用說明手冊 NS-2 Trace Formats Books 計算機網路實驗 — 以 NS2 模擬工具實作,柯志亨 計算機網路實驗 — 使用 NS2 模擬多媒體通訊與無線網路, 柯志亨團隊