You are on page 1of 2

Supplementary Lab Exercises on NS2

Objectives:

1. To introduce simple error model in ns2 to drop TCP packets


2. Using AWK script to analyze the simulation output.
3. Setup a queue monitor for a loss model
4. Display TCP slow start phase in your ns- 2 simulation by plotting congestion window along y axis and
time along x axis.

Exercise # 1
Build a 3-node network consisting of a TCP Source, an intermediate node acting as the forwarding agent
and a TCP Sink (Destination). Introduce a simple error model to drop TCP packets.

Deliverables:

i. 3node_serr.tcl : The Tcl script for 3 node network with error model, this runs for 50 seconds

ii. 3node_serr.nam : The nam trace file for the same

iii. 3node_serr.tr : The output trace file

Exercise #2
TCP Reno sources use Fast Retransmit algorithm to improve throughput performance. Write an awk
script on your previously created 3 node example with simple error model to show 'packet drops',
'regular acknowledgements', 'Duplicate acknowledgements' and 'packet retransmissions'.

Deliverables

i. 3node_serr.tcl : The tcl script for 3 node network with error model, this runs for 50 seconds

ii. 3node_serr.nam : The nam trace file for the same

iii. 3node_serr.tr : The out-put trace file

iv dupak.awk : The awk script ( How to run : awk -f dupak.awk 3node_serr.tr)

Exercise #3
Let us define 'Packet Error Ratio' (PER) as the total number of packets dropped (lost) to the total number
of packets transmitted. Setup a queue monitor for a loss model in the 3 node example. Write an awk
script to verify the packet loss probability that you have set on the error model with the obtained PER
value.
Deliverables

i. 3node_serr.tcl : The tcl script for 3 node network with error model and queue monitor
between node 1 and 2 this runs for 100 seconds

ii. 3node_serr.nam : The nam trace file for the same

iii. 3node_serr.tr : The out-put trace file

iv PER.awk : The awk script, it calculates the PER ( How to run : awk -f PER.awk qm.out)

v qm.out : The out-put file generated by queue monitor

Exercise #4

Most TCP implementations begin data transfer by setting the congestion window (cwnd) to 2 MSS. The
slow start threshold (ssthresh) at the start is a very high value (ideally infinity). TCP begins aggressively to
probe for the available bandwidth. Build a 3-node network consisting of a TCP Source, an intermediate
node acting as the forwarding agent and a TCP Sink (Destination). Use FTP traffic source. Run your
simulations for at least 100 seconds. All links are full duplex with bandwidth set to 100 Mbps and delay
set to 10 ms.

Display TCP slow start phase in your ns- 2 simulation. Use Xgraph to plot congestion window along y axis
and time along x axis.

Deliverables

i. 3node.tcl : The tcl script for 3 node network

ii. 3node.nam : The nam trace file for the same

iii. 3node.tr : The out-put trace file

iv cwnd.awk: The awk script to extract cwnd from output trace file. How to run: (How to run :
awk -f cwnd.awk 3node.tr)

v. graph.pdf: the congestion window graph showing the slow start and avoidance regions

You might also like