Excercise
By now you should know basic commands for creating simple
networks. Make a test subdirectory at your home directory.
Change your directory to test. Create lab1-ex.tcl
Write a tcl script that forms a network consisting of 5 nodes,
numbered from 0 to 4, which form a ring. The links have a 128K
bandwidht with 10ms delay. Set the routing protocol to DV
(Distance vector). Send UDP packets from node 0 to node 2 with
the rate of 0.02 seconds per packet. Start transmission at 0.05.
Bring down the link between node 1 and node 2 at 0.25. Finish the
transmission at 1.000. Then run nam to view the results. What do
you see? Will packets be re-routed after the link goes down? Is
this what you expect?
proc finish {} {
global ns nf nam_file
$ns flush-trace
close $nf
exec nam $nam_file &
exit 0
}; # finish
set ns [new Simulator]
set nam_file lab-ex.nam
set nf [open $nam_file w]
$ns namtrace-all $nf
# Create the topology
# Frist, the nodes
.....
# Create the connection
.....
# Now create agents and attach them to the appropriate nodes
# Set the routing protocol
# start transmitting packets from 0 to 2
# Bring down the link between 1 and 2 using this command
$ns rtmodel-at 0.25 down $n(0) $n(1)
$ns at 1.00 "finish"
$ns run
Nader Salehi
Last modified: Thu Jun 22 19:40:34 PDT 2000