Excercise 1

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?
        # Create event scheduler
	set ns [new Simulator]

	# Turn on tracing
	set nam_file lab-ex.nam
	set nf [open $nam_file w]
	$ns namtrace-all $nf

	# Create the topology
	# Frist, the nodes
		......

	# Then, the links
		......
	
	# Set the routing protocol
		......

	# Now create agents and attach them to the appropriate nodes
		......

	# 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)

	proc finish {} {
		global ns nf nam_file
		$ns flush-trace
		close $nf
		exec nam $nam_file &
		exit 0
	}
	$ns at 1.0 "finish"

	$ns run
    

Exercise 2

Create a network which looks like the following:
			4
			|
			|
	  0-------------1----------2---------5
			|
			|
			3

Choose Dense Mode as the multicast routing protocol for the experiment. Node 0 is a UDP source for this group. The source will start transmission at time 0.05. Nodes 3 and 4 will join the multicast group at times 0.10 and 0.12, respectively. Node 3 will leave the multicast group at 0.5, and the execution will terminate at 0.6
	# Create event scheduler
	set ns [new Simulator]

	# Turn on tracing
		......

	# [Define nam colors?]
		......

	# Create topology

	# First the nodes
		......

	# Then the links 
		......

	# [Define topology layout in nam?]
		......

	# Choose the routing protocol
		......

	# Create multicast group
		......

	# Create the UDP agent and tie it to the multicast group
		......

	# Set group membership
		......

	# Final wrapup
		......

	# Run the script.
	$ns run

References:


Nader Salehi
Last modified: Mon Jun 26 18:04:49 PDT 2000