Docsity

Routing and Link Failure-Computer Networking-Lab Manual, Exercises of Computer Networks

Toggle sidebar
bg1
Computer Networks-Lab Exercise
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
1. Create file ex1.tcl, create following objects
a. Simulator (ns)
b. An output file (out.tr)
2. Create following procedures
a. Finish
b. Record
3. Schedule the events as follow
a. Call record at 0
b. Call finish at 10
4. Execute the scrip
Exercise2: Creating Large Topologies and observing link failure
1. Create a large topology as shown by creating nodes and duplex links
2. The link speed should be 1 Mbps and delay should be 10ms, use
droptail
3. Attach UDP agents and CBR traffic sources to node 0 and node 3
4. Start the simulation and observe the path followed by packets
5. Use following lines to make a link failure and repair later
$ns* rtmodel-at 1.0 down $n1* $n2*
$ns* rtmodel-at 2.0 up $n1* $n2*
*replace names with variables in your script
Docsity.com
pf3
pf4

Partial preview of the text

Download Routing and Link Failure-Computer Networking-Lab Manual and more Exercises Computer Networks in PDF only on Docsity!

Computer Networks-Lab Exercise

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

  1. Create file ex1.tcl, create following objects a. Simulator (ns) b. An output file (out.tr)
  2. Create following procedures a. Finish b. Record
  3. Schedule the events as follow a. Call record at 0 b. Call finish at 10
  4. Execute the scrip

Exercise2: Creating Large Topologies and observing link failure

  1. Create a large topology as shown by creating nodes and duplex links
  2. The link speed should be 1 Mbps and delay should be 10ms, use droptail
  3. Attach UDP agents and CBR traffic sources to node 0 and node 3
  4. Start the simulation and observe the path followed by packets
  5. Use following lines to make a link failure and repair later $ns* rtmodel-at 1.0 down $n1* $n2* $ns* rtmodel-at 2.0 up $n1* $n2* *replace names with variables in your script
  1. Start the simulation and observe the data loss between second 1 and 2
  2. Add line *$ns rtproto DV at the start of your script (after creation of simulator object)
  3. Start the simulation again and observe what happens when link fails

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"