Research breakthrough possible @S-Logix

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • +91- 81240 01111

Social List

How to create congestion in wired network using NS2?


The topology in the wired network is set-up using the node and link creation APIs. The bottleneck is a duplex link that has router in both directions representing the traffic flow from multiple sources. The congestion in the wired network can be created using the bottleneck link. The tcl script in test5.tcl creates the congestion in which each link is configured with the specific bandwidth, propagation delay and DropTail queue. Data transmission between the sender1 and receiver1 is created using the tcp connection and FTP application. Data transmission between the sender2 and receiver2 is created using the udp agent and CBR traffic. Congestion occurs at the link between router1 and router2 (bottleneck link) due to the high data flow rate that exceeds the link capacity. The length of the queue is limited. TCP enforces congestion control mechanism automatically by adjusting the sending data rate according to the acknowledgment arrival time.

Sample Code

# Filename: test5.tcl
#create links between the nodes

$ns duplex-link $n0 $n2 2Mb 10ms DropTail
$ns duplex-link $n1 $n2 2Mb 10ms DropTail
$ns simplex-link $n2 $n3 0.3Mb 100ms DropTail
$ns simplex-link $n3 $n2 0.3Mb 100ms DropTail
$ns duplex-link $n3 $n4 0.5Mb 40ms DropTail
$ns duplex-link $n3 $n5 0.5Mb 30ms DropTail
#Set Queue Size of link (n2-n3) to 10

$ns queue-limit $n2 $n3 20
#Setup a TCP connection

set tcp [new Agent/TCP/Newreno]
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink/DelAck]
$ns attach-agent $n4 $sink
$ns connect $tcp $sink
$tcp set fid_ 1
$tcp set window_ 8000
$tcp set packetSize_ 552

#Setup a FTP over TCP connection
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set type_ FTP
#Setup a UDP connection

set udp [new Agent/UDP]
$ns attach-agent $n1 $udp
set null [new Agent/Null]
$ns attach-agent $n5 $null
$ns connect $udp $null
$udp set fid_ 2

#Setup a CBR over UDP connection

set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set type_ CBR
$cbr set packet_size_ 1000
$cbr set rate_ 0.01mb
$cbr set random_ false

$ns at 0.1 "$cbr start"
$ns at 1.0 "$ftp start"
$ns at 10.0 "$ftp stop"
$ns at 10.5 "$cbr stop"



Congestion control mechanism of TCP

create congestion in wired network using NS2
Congestion control mechanism of TCP