


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Objective
Understanding the working of default routing and link failure (Basics)
While doing simulation a procedure can repeat itself to record values of variables, for this the structure is as under
e.g. To call procedure record after 0.5 second the command will be
proc record { } {
set time [$ns now] #returns current time of simulator $ns at [expr $time+$time] "record" } To write values to file simple use puts $filename “$value”
Exercise1 : Record current time and value of one variable in a file out.tr and plot a graph using xgraph, use following steps as guide line
Exercise2: Creating Large Topologies and observing link failure
Hint: Use array to create large topology
Exercise 3 (Taken from http://www.cs.tut.fi)
Create the network topology shown below (also known as “dumbbell topology”). In the figure, every circle represents a node, while lines represent links. 2
All the links are 10 Mbit/s full-duplex links with 2 ms delay, except for the link between r1-r2: it is 4 Mbit/s full-duplex link with 6 ms delay. Thus, the link r1-r2 is a bottleneck link.
The queuing discipline of all links is DropTail (FIFO). Limit the maximum queue size at r1-r2 link to 12 packets. Attach one-way TCP senders to the nodes n1, n2, and n3. Use TCP Tahoe agent at n1, TCP Reno at n2, and TCP NewReno (Slow-but-Steady variant) at n3 node.
Use the following TCP parameters: #TCP Tahoe parameters Agent/TCP set maxcwnd_ 20 Agent/TCP set windowInit_ 2 Agent/TCP set packetSize_ 1460 Agent/TCP set tcpTick_ 0. #TCP Reno parameters Agent/TCP/Reno set maxcwnd_ 20 Agent/TCP/Reno set windowInit_ 2 Agent/TCP/Reno set packetSize_ 1460 Agent/TCP/Reno set tcpTick_ 0.
#Plotting window size with xgraph
proc plotWindow {tcpSource file} {
global ns
set time 0.
set now [$ns now]
set cwnd [$tcpSource set cwnd_]
puts $file "$now $cwnd"
$ns at [expr $now+$time] "plotWindow $tcpSource $file"
} 4
#Define the finish procedure that closes the trace files and starts nam and xgraph proc finish {} {
global ns nf tcpTahoe tcpReno tcpNewReno
$ns flush-trace
#Close the trace files
close $nf
close $tcpTahoe
close $tcpReno
close $tcpNewReno
#Execute nam and xgraph on the trace files
exec nam out.nam &
exec xgraph tcpTahoe tcpReno tcpNewReno -geometry 800x400 -t "cwnd" -x "Time, secs" -y "Window, pkts" exit 0
}
$ns at 0.0 "plotWindow $tcp1 $tcpTahoe"
$ns at 0.0 "plotWindow $tcp2 $tcpReno"
$ns at 0.0 "plotWindow $tcp3 $tcpNewReno"