3. Set up a ns-2 simulation with specification as follows:
# Creating the core event scheduler/simulator
... FILL IN ...
# Creating 4 nodes
... FILL IN ...
# Outputs nam traces
set nf [open out.nam w]
$ns namtrace-all $nf
# Creating 3 links
# Connecting node 0 and 2
# Connecting node 1 and 2
# Connecting node 2 and 3
# All with bandwidth 5Mb, delay 2ms, and RED queue
... FILL IN ...
# link orientation, for nam display purpose only
$ns duplex-link-op $n0 $n2 orient right-up
$ns duplex-link-op $n1 $n2 orient right-down
$ns duplex-link-op $n2 $n3 orient right
# Create a TCP connection from node 0 to node 3
... FILL IN ...
# Create an FTP source and attach it to the TCP connection
... FILL IN ...
# Schedule events to happen
... FILL IN ...
# A finish proc to flush traces and out call nam
proc finish {} {
global ns nf
$ns flush-trace
close $nf
puts "running nam..."
exec nam out.nam &
exit 0
}
# Start the event scheduler
... FILL IN ...
prompt> ns lab3.tcl
References: