NS2-TCP Internet Computing KUT (http://icl.kut.ac.kr)http://icl.kut.ac.kr Youn-Hee Han It is licensed under a Creative Commons Attribution.

Slides:



Advertisements
Similar presentations
NS2 Tutorial – Part II Internet Computing KUT Youn-Hee Han.
Advertisements

NS-2 (network simulator) NS by example παρουσίαση Κων/νος Τρούλος.
NS2-TCP Internet Computing KUT ( Youn-Hee Han It is licensed under a Creative Commons Attribution.
An Introduction to NS-2 * Gayatri Swamynathan CS 276 TA *some slides are from a presentation by Haobo Yu & Nader Salehi, USC/ISI.
Brief Intro to ns2: The most widely used Network Simulator COMP5416 Advanced Network Technologies Based on: Marc Greis's
Ns-2 Tutorial Exercise (1) Multimedia Networking Group, The Department of Computer Science, UVA Jianping Wang Adopted from Nicolas’s slides Jianping Wang,
Ns-2 tutorial Karthik Sadasivam Banuprasad Samudrala CSCI 5931 Network Security Instructor : Dr. T. Andrew Yang.
Network Simulator (NS) Prof. Nelson L. S. da Fonseca State University of Campinas, Brazil.
5-Jul-141 S.Pushpalatha, Associate Professor, PSNACET.
Introduction to NS. Information Main website Documentation, mailing list archive, tutorial Location of Source codes –C++ files.
TCP and FTP Internet Engineering. 1 Protocol of transport layer Reliability ( guarantee packet arrives to destination ) –Retransmission control Use for.
NS TUTORIAL Padma Haldar USC/ISI 09/04/02.
Receiver-driven Layered Multicast S. McCanne, V. Jacobsen and M. Vetterli SIGCOMM 1996.
6/3/ Improving TCP Performance over Mobile Ad Hoc Networks by Exploiting Cross-Layer Information Awareness CS495 – Spring 2005 Northwestern University.
The War Between Mice and Elephants Presented By Eric Wang Liang Guo and Ibrahim Matta Boston University ICNP
Network Simulator 2 Tejas Vasavada.
Katz, Stoica F04 EECS 122 Introduction to Computer Networks (Fall 2003) Network simulator 2 (ns-2) Department of Electrical Engineering and Computer Sciences.
CprE 543x – ns-2 Tutorial Zak Abichar, Dept of Electrical and Computer Engineering Iowa State University Ames,
A simulation-based comparative evaluation of transport protocols for SIP Authors: M.Lulling*, J.Vaughan Department of Computer science, University college.
Questions  RED vs. DropTail  What’s the key difference?  Why RED drops packet randomly?  What’s the major effect if using RED.
1 Ns Tutorial Alhussein A. Abouzeid Elect. Eng. Dept./U. of Washington Parts of this educational presentation use examples available.
Day 3 Outline Multicast example (from Day 2) Wireless Misc. utilities
1 TCP-LP: A Distributed Algorithm for Low Priority Data Transfer Aleksandar Kuzmanovic, Edward W. Knightly Department of Electrical and Computer Engineering.
1 Modified Schedule Day 2 Network AniMator (nam) Examples simple.tcl mcast.tcl Day 3 Wireless (ad-hoc)
17/10/2003TCP performance over ad-hoc mobile networks. 1 LCCN – summer 2003 Uri Silbershtein Roi Dayagi Nir Hasson.
Submitters: Stella Pantofel Michael Halperin Igor Berman
EECS122 - UCB1 Measurements and Modeling Table of Contents 1. Measurements Measurements 2. Modeling and its Shortcomings Modeling and its Shortcomings.
Process-to-Process Delivery:
1 Ns Tutorial: Case Studies John Heidemann (USC/ISI) Polly Huang (ETH Zurich) March 14, 2002.
Wireless Networking and Systems CSE 590 ns2 tutorial.
1 Enabling Large Scale Network Simulation with 100 Million Nodes using Grid Infrastructure Hiroyuki Ohsaki Graduate School of Information Sci. & Tech.
NS2 - Wireless Network Ming-Feng Yang. 2 2 Outline Basic wireless model Extensions wireless model Example - Ad hoc network Example – WLAN Example – Mobile.
Tutorial: The ns-2 Network Simulator Amirali Habibi Shrif Univesity Adapted from: Michael Welzl Institute of Computer Science University of Innsbruck,
Sharing Information across Congestion Windows CSE222A Project Presentation March 15, 2005 Apurva Sharma.
Role and Mechanism of Queue Internet Engineering.
JIA-HUI HUANG INSTITUTE OF COMPUTER SCIENCE AND INFORMATION ENGINEERING NATIONAL TAIPEI UNIVERSITY OF TECHNOLOGY Network Simulator – NS-2 1.
Network Simulator-2 Sandeep singla 1998A2A7540. NS-2 A discrete event simulator Focused on modeling network protocols –Wired, wireless –TCP,UDP,unicast,multicast.
TNK092: Network Simulation - Nätverkssimulering Lecture 3: TCP Vangelis Angelakis.
NetFlow Very useful for traffic analysis Very useful for traffic analysis Standard sampler: Standard sampler: –Cisco Netflow –Juniper Traffic Sampling.
1 Network Simulator Tutorial. 2 Network Simulation * Motivation: Learn fundamentals of evaluating network performance via simulation Overview: fundamentals.
Internet Computing KUT Youn-Hee Han
NS-2 Tutorial. Motivation What’s NS-2 Network simulator –Discrete event simulator It covers multiple layers –Application layer, transport layer, network.
Packet switching network Data is divided into packets. Transfer of information as payload in data packets Packets undergo random delays & possible loss.
1 NS Fundamentals. USC INFORMATION SCIENCES INSTITUTE 2 OTcl and C++: The Duality C++ OTcl Pure C++ objects Pure OTcl objects C++/OTcl split objects ns.
Ns-2 Tutorial (1) Multimedia Networking Group, The Department of Computer Science, UVA Jianping Wang Jianping Wang, 2002 cs757 1.
1 Introduction to NS-2 r Tutorial overview of NS m Create basic NS simulation r Walk-through a simple example m Model specification m Execution and trace.
Chapter 4 Random Number Generator Speaker : H.M. Liang.
Lab 2, Network Simulator ns2 Shiv Kalyanaraman Yong Xia (TA) Satish Raghunath Sept 4,
Network Simulator Tutorial Wireless Networks. Acknowledgements Material is taken from the presentations by Jim Kurose, University of Massachusetts, Amherst.
Network Simulator 2. Introduction Open source network simulator NS uses two languages: C++ and OTcl  C++ is fast to run but slower to change Kernel 
The Creation of NS2 Simulated Environment ( 1 ) LI Chengbo
TNK092: Network Simulation - Nätverkssimulering Lecture #1: Course basics and a first taste of NS2 Vangelis Angelakis Ph.D.
NS-2 Shahin Shayandeh December 2004 Session 1. Ns-2, the Network Simulator  A discrete event simulator Simple model  Focused on modeling network protocols.
Applications and transport agent API 許庭瑋.
Network Simulation Using NS2
Lab 2, Network Simulator ns2
Network Topology. Network Topology Cont. Sender = 0 and Receiver = 5 Sender = 0 and Receiver = 5 Sender transmits ftp traffic over TCP/IP to receiver.
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
2005/12/14 1 Improving TCP Performance over Mobile Ad Hoc Networks by Exploiting Cross-Layer Information Awareness Xin Yu Department of Computer Science.
DMET 602: Networks and Media Lab Amr El Mougy Yasmeen EssamAlaa Tarek.
Ch 1: Simulation of Computer Networks. 1.1 Computer Networks and the Layering Concept Layering Concept Service Interface Protocol.
NS-2 Training 12/12/2011. Introduction  NS-2: Network Simulator Generation 2  Latest Release: 2.35 / Nov. 4, 2011 
NS-2 Simulator 최 종 훈 Contents  About NS  Installation  Based on Linux  Based on Windows  Architecture  Using NS-2  Example  References.
DMET 602: Networks and Media Lab
(Modified from Polly Huang’s and last year’s original)
Choe, Hyun Jung (Stella)
Introduction to ns-2: “The” Network Simulator
Ns Tutorial: Case Studies
Process-to-Process Delivery:
Karthik Sadasivam Banuprasad Samudrala
Presentation transcript:

NS2-TCP Internet Computing KUT ( Youn-Hee Han It is licensed under a Creative Commons Attribution 2.5 License

Computer Network2 shortTcp.tcl (section 4.5) set ns [new Simulator] #There are several sources of TCP sharing a bottlenexk link #and a single destination. Their number is given by the parameter NodeNb #$out will contain the transfer time of different connections set Out [open Out.ns w] #$Conn will contain the number of connections set Conn [open Conn.tr w] #Open the Trace files set tf [open out.tr w] $ns trace-all $tf #Open the NAM trace file set nf [open out.nam w] $ns namtrace-all $nf #We define three files that will be used to trace the queue size, #the bandwidth and losses at the bottleneck. set qsize [open queuesize.tr w] set qbw [open queuebw.tr w] set qlost [open queuelost.tr w]

Computer Network3 shortTcp.tcl (section 4.5) #defineing the topology set N [$ns node] set D [$ns node] $ns duplex-link $N $D 2Mb 1ms DropTail $ns queue-limit $N $D 3000 #Number of sources set NodeNb 6 #Number of flows per source node set NumberFlows 530 #Nodes and links for {set j 1} {$j<=$NodeNb} {incr j} { set S($j) [$ns node] $ns duplex-link $S($j) $N 100Mb 1ms DropTail $ns queue-limit $S($j) $N 1000 } #TCP Source and Destination #window_: the upper bound on the advertised window (flow control) for the TCP connection. for {set i 1} {$i<=$NodeNb} {incr i} { for {set j 1} {$j<=$NumberFlows} {incr j} { set tcpsrc($i,$j) [new Agent/TCP/Newreno] set tcp_snk($i,$j) [new Agent/TCPSink] $tcpsrc($i,$j) set window_ 2000; }

Computer Network4 shortTcp.tcl (section 4.5) #Connections for {set i 1} {$i<=$NodeNb} {incr i} { for {set j 1} {$j<=$NumberFlows} {incr j} { $ns attach-agent $S($i) $tcpsrc($i,$j) $ns attach-agent $D $tcp_snk($i,$j) $ns connect $tcpsrc($i,$j) $tcp_snk($i,$j) } #FTP sources for {set i 1} {$i<=$NodeNb} {incr i} { for {set j 1} {$j<=$NumberFlows} {incr j} { set ftp($i,$j) [$tcpsrc($i,$j) attach-source FTP] } #Genertors for random size of files set rng1 [new RNG] $rng1 seed 0 set rng2 [new RNG] $rng2 seed 0 #Random interarrival time of TCP transfers at each source i set RV [new RandomVariable/Exponential] $RV set avg_ $RV use-rng $rng1

Computer Network5 shortTcp.tcl (section 4.5) #Random size of files to transmit set RVSize [new RandomVariable/Pareto] $RVSize set avg_ $RVSize set shape_ 1.5 $RVSize use-rng $rng2 #We now define the beginning times of transfers and the transfer sizes #Arrivals of sessions follow a Poisson process. for {set i 1} {$i<=$NodeNb} {incr i} { set t [$ns now] for {set j 1} {$j<=$NumberFlows} {incr j} { #set the beginning time of next transfer from source i set t [expr $t + [$RV value]] set Conct($i,$j) $t #set the size of next transfer from source i set Size($i,$j) [expr [$RVSize value]] $ns at $Conct($i,$j) "$ftp($i,$j) send $Size($i,$j)" #update the number of flows $ns at $Conct($i,$j) "countFlows $i 1" }

Computer Network6 shortTcp.tcl (section 4.5) #Next is a recursive procedure that checks for each session whether it has ended. #If a connection has ended then we print in the file $Out # * the connection identifiers i and j, * the start and end time of the connection, # * the throughput of the session, * the size of the transfer in bytes #and we further define another beginning of transfer after a random time. proc Test {} { global Conct tcpsrc Size NodeNb NumberFlows ns RV ftp Out tcp_snk RVSize set time 0.1 for {set i 1} {$i<=$NodeNb} {incr i} { for {set j 1} {$j<=$NumberFlows} {incr j} { #we now check if the transfer is over if {[$tcpsrc($i,$j) set ack_]==[$tcpsrc($i,$j) set maxseq_]} { if {[$tcpsrc($i,$j) set ack_]>=0} { #If the transfer is over, we print relevant info. in #Out puts $Out "$i,$j\t$Conct($i,$j)\t[expr [$ns now]]\t\ [expr ($Size($i,$j))/(1000*([expr [$ns now]] - $Conct($i,$j)))]\t$Size($i,$j)" countFlows $i 0 $tcpsrc($i,$j) reset $tcp_snk($i,$j) reset } $ns at [expr [$ns now]+$time] "Test" }

Computer Network7 shortTcp.tcl (section 4.5) for {set i 1} {$i<=$NodeNb} {incr i} { set Cnts($i) 0 } #The following recursive procedure updates the number of connections as a function of time. #Each 0.2 it prints them into $Conn. This is done by calling the procedure with the "sign" parameter #equal 3 (in which case the "ind" parameter does not play a role). #The procedure is also called by the Test procedure whenever a connection from source i ends by #assigning the "sign" parameter 0, or when it begins, by assigning it 1 (i is passed through the "ind" variable). proc countFlows {ind sign} { global Cnts Conn NodeNb set ns [Simulator instance] if {$sign==0} { set Cnts($ind) [expr $Cnts($ind) - 1] } elseif {$sign==1} { set Cnts($ind) [expr $Cnts($ind) + 1] } else { puts -nonewline $Conn "[$ns now] \t" set sum 0 for {set j 1} {$j<=$NodeNb} {incr j} { puts -nonewline $Conn "$Cnts($j) \t" set sum [expr $sum + $Cnts($j)] } puts $Conn "$sum" $ns at [expr [$ns now] + 0.2] "countFlows 1 3" }

Computer Network8 shortTcp.tcl (section 4.5) #Define a 'finish' procedure proc finish {} { global ns tf qsize qbw qlost $ns flush-trace close $qsize close $qbw close $qlost #Execute xgraph to display the queue size, queue bandwidth and loss rate exec xgraph queuesize.tr -geometry 800x400 -t "Queue size" -x "secs" -y "# packets" & exec xgraph queuebw.tr -geometry 800x400 -t "bandiwidth" -x "secs" -y "Kbps" -fg white & exec xgraph queuelost.tr -geometry 800x400 -t "# Packets lost" -x "secs" -y "packets" & exit 0 } #QUEUE Monitoring set qfile [$ns monitor-queue $N $D [open queue.tr w] 0.05] [$ns link $N $D] queue-sample-timeout;

Computer Network9 shortTcp.tcl (section 4.5) #The following procedure records queue size, bandwidth and loss rate proc record {} { global ns qfile qsize qbw qlost N D set time 0.05 set now [$ns now] #print the current queue size in $qsize, the current used #bandwidth in $qbw, and the loss rate in $qloss $qfile instvar parrivals_ pdepartures_ bdrops_ bdepartures_ pdrops_ puts $qsize "$now [expr $parrivals_- $pdepartures_- $pdrops_]" puts $qbw "$now [expr $bdepartures_*8/1024/$time]" set bdepartures_ 0 puts $qlost "$now [expr $pdrops_/$time]" $ns at [expr $now+$time] "record" } $ns at 0.0 "record" $ns at 0.01 "Test" $ns at 0.5 "countFlows 1 3" $ns at 20 "finish" $ns run