Part I: Fundamentals
description
Transcript of Part I: Fundamentals
11
Part I: Fundamentals
22USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Outline
Overviewns Primer Getting started Wired world Wireless world
Emulator
33USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
ns Primer – Wired World
Basic ns Architecture Basic Tcl, OTcl Elements of ns
A complete example Multicast routing
Visualization
44USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
ns Architecture
Object-oriented (C++, OTcl)Scalability + Extensibility Control/”data” separation Split C++/OTcl object
Modular approach Fine-grained object composition
55USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Object-Oriented
+Reusability+Maintenance
– Performance (speed and memory)– Careful planning of modularity
66USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
C++ and OTcl Separation
C++ for “data” Per packet action
OTcl for control Periodic or triggered action
+Compromise between composibility and speed
– Learning and debugging
77USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
OTcl and C++: The Duality
C++ OTcl
Pure C++objects
Pure OTclobjects
C++/OTcl split objects
ns
88USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Extending Tcl Interpreter
OTcl: object-oriented TclTclCL: C++ and OTcl linkageDiscrete event schedulerData network components Link layer and up Emulation support
Tcl
OTcl
TclCL
ns-2
Event
Sch
ed
ule
r
Network Components
C/C++
99USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Hello World - Interactive Modeswallow 71% ns
% set ns [new Simulator]
_o3
% $ns at 1 “puts \“Hello World!\””
1
% $ns at 1.5 “exit”
2
% $ns run
Hello World!
swallow 72%
1010USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Hello World - Batch Mode
simple.tclset ns [new Simulator]
$ns at 1 “puts \“Hello World!\””
$ns at 1.5 “exit”
$ns run
swallow 74% ns simple.tcl
Hello World!
swallow 75%
1111USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Basic tclset a 43set b 27proc test { a b } {
set c [expr $a + $b]set d [expr [expr $a - $b] * $c]for {set k 0} {$k < 10} {incr k} {
if {$k < 5} { puts “k < 5, pow = [expr pow($d, $k)]” } else { puts “k >= 5, mod = [expr $d % $k]” } }}test 43 27
1212USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Basic OTclClass MomMom instproc greet {} {
$self instvar age_puts “$age_ years old mom: How are you doing?”
}
Class Kid -superclass MomKid instproc greet {} {
$self instvar age_puts “$age_ years old kid: What’s up, dude?”
}
set mom [new Mom]
$mom set age_ 45
set kid [new Kid]
$kid set age_ 15
$mom greet
$kid greet
1313USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Elements of ns-2
Create the event scheduler[Turn on tracing]Create networkSetup routingInsert errorsCreate transport connectionCreate trafficTransmit application-level data
1414USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Creating Event Scheduler
Create event scheduler set ns [new Simulator]
Schedule events $ns at <time> <event> <event>: any legitimate ns/tcl
commands
Start scheduler $ns run
1515USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Tracing
Trace packets on all links $ns trace-all [open test.out w]
<event> <time> <from> <to> <pkt> <size> -- <fid> <src> <dst> <seq> <attr><event> <time> <from> <to> <pkt> <size> -- <fid> <src> <dst> <seq> <attr>+ 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0+ 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0- 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0- 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0r 1.00234 0 2 cbr 210 ------- 0 0.0 3.1 0 0r 1.00234 0 2 cbr 210 ------- 0 0.0 3.1 0 0
Trace packets on all links in nam-1 format $ns namtrace-all [open test.nam w]
Must appear immediately after creating scheduler
1616USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Tracing
Turn on tracing on specific links $ns trace-queue $n0 $n1 $ns namtrace-queue $n0 $n1
1717USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Creating Network
Nodes set n0 [$ns node] set n1 [$ns node]
Links and queuing $ns duplex-link $n0 $n1
<bandwidth> <delay> <queue_type>
<queue_type>: DropTail, RED, CBQ, FQ, SFQ, DRR
1818USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Creating Network: LAN
LAN $ns make-lan <node_list>
<bandwidth> <delay> <ll_type> <ifq_type> <mac_type> <channel_type>
<ll_type>: LL <ifq_type>: Queue/DropTail, <mac_type>: MAC/802_3 <channel_type>: Channel
1919USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Inserting Errors
Creating Error Module set loss_module [new ErrorModel] $loss_module set rate_ 0.01 $loss_module unit pkt $loss_module ranvar [new
RandomVariable/Uniform] $loss_module drop-target [new
Agent/Null]
Inserting Error Module $ns lossmodel $loss_module $n0 $n1
2020USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Network Dynamics
Link failures Hooks in routing module to reflect
routing changes
Four models$ns rtmodel Trace <config_file> $n0 $n1$ns rtmodel Trace <config_file> $n0 $n1$ns rtmodel Exponential {<params>} $n0 $n1$ns rtmodel Exponential {<params>} $n0 $n1$ns rtmodel Deterministic {<params>} $n0 $n1$ns rtmodel Deterministic {<params>} $n0 $n1$ns rtmodel-at <time> up|down $n0 $n1$ns rtmodel-at <time> up|down $n0 $n1
Parameter list[<start>] <up_interval> <down_interval> [<finish>][<start>] <up_interval> <down_interval> [<finish>]
2121USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Setup Routing
Unicast $ns rtproto <type> <type>: Static, Session, DV, cost,
multi-path
Multicast $ns multicast (right after [new
Simulator]) $ns mrtproto <type> <type>: CtrMcast, DM, ST, BST
2222USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Creating Connection: UDP
UDP set udp [new Agent/UDP] set null [new Agent/Null] $ns attach-agent $n0 $udp $ns attach-agent $n1 $null $ns connect $udp $null
2323USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Creating Traffic: On Top of UDP
CBR set src [new Application/Traffic/CBR]
Exponential or Pareto on-off set src [new
Application/Traffic/Exponential] set src [new
Application/Traffic/Pareto]
2424USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Creating Connection: TCP
TCP set tcp [new Agent/TCP] set tcpsink [new Agent/TCPSink] $ns attach-agent $n0 $tcp $ns attach-agent $n1 $tcpsink $ns connect $tcp $tcpsink
2525USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Creating Traffic: On Top of TCP
FTP set ftp [new Application/FTP] $ftp attach-agent $tcp
Telnet set telnet [new Application/Telnet] $telnet attach-agent $tcp
2626USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Creating Traffic: Trace Driven
Trace driven set tfile [new Tracefile] $tfile filename <file> set src [new Application/Traffic/Trace] $src attach-tracefile $tfile
<file>: Binary format (native!) inter-packet time (msec) and packet size
(byte)
2727USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Application-Level Simulation
Features Build on top of existing transport
protocol Transmit user data, e.g., HTTP header
Two different solutions TCP: Application/TcpApp UDP: Agent/Message
2828USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Application/TcpApp
Abstraction: TCP as a FIFO pipeBefore sending: S notifies about R data sizeAfter receiving: R gets data (arbitrary string) from S
SS RR
}Out-of-band
Expect N bytes
Get first N bytes of data pkt (empty)
ack
2929USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Application/TcpApp
Step 1: FullTcp connectionset tcp1 [new Agent/TCP/FullTcp]set tcp1 [new Agent/TCP/FullTcp]
set tcp2 [new Agent/TCP/FullTcp]set tcp2 [new Agent/TCP/FullTcp]
$ns attach-agent $n1 $tcp1$ns attach-agent $n1 $tcp1
$ns attach-agent $n2 $tcp2$ns attach-agent $n2 $tcp2
$ns connect $tcp1 $tcp2$ns connect $tcp1 $tcp2
$tcp2 listen$tcp2 listen
3030USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Application/TcpApp
Step 2: reliable, in-order user data transferset app1 [new Application/TcpApp $tcp1]set app1 [new Application/TcpApp $tcp1]
set app2 [new Application/TcpApp $tcp2]set app2 [new Application/TcpApp $tcp2]
$app1 connect $app2$app1 connect $app2
# <ns-2 command>: will be executed when # <ns-2 command>: will be executed when received at the receiver TcpAppreceived at the receiver TcpApp
$ns at 1.0 “$app1 send $ns at 1.0 “$app1 send <data_byte> \”<ns-2 command>\””<data_byte> \”<ns-2 command>\””
3131USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Agent/Message
A UDP agent (without UDP header)Up to 64 bytes user messageGood for fast prototyping a simple ideaUsage requires extending ns functionality We’ll give an example tomorrow
SS RR
pkt: 64 bytesof arbitrary string
Receiver-sideprocessing
3232USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Summary: Generic Script Structure
set ns [new Simulator]set ns [new Simulator]
# [Turn on tracing]# [Turn on tracing]
# Create topology# Create topology
# Setup packet loss, link dynamics# Setup packet loss, link dynamics
# Create routing agents# Create routing agents
# Create: # Create:
# - multicast groups# - multicast groups
# - protocol agents# - protocol agents
# - application and/or setup traffic sources# - application and/or setup traffic sources
# Post-processing procs# Post-processing procs
# Start simulation# Start simulation
3333USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
ns Primer – Wired World
Basic nsA complete example Multicast routing
Visualization
3434USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
G2time1.3s G2time1.2s
G1G2
time1.35s
Example: Multicast Routing
Dynamic group membership under Dense Mode
n0 n1
n2
n3
1.5Mb, 10ms
1.5Mb, 10ms
G1time1.25s
G2
1.5Mb, 10ms
3535USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast: Step 1
Scheduler, tracing, and topology
# Create scheduler# Create scheduler
set ns [new Simulator]set ns [new Simulator]
# Turn on multicast# Turn on multicast
$ns multicast$ns multicast
# Turn on Tracing# Turn on Tracing
set fd [new “mcast.nam” w]set fd [new “mcast.nam” w]
$ns namtrace-all $fd$ns namtrace-all $fd
3636USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast: Step 2
Topology
# Create nodes# Create nodes
set n0 [$ns node]set n0 [$ns node]
set n1 [$ns node]set n1 [$ns node]
set n2 [$ns node]set n2 [$ns node]
set n3 [$ns node]set n3 [$ns node]
# Create links# Create links
$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail
$ns duplex-link $n0 $n2 1.5Mb 10ms DropTail$ns duplex-link $n0 $n2 1.5Mb 10ms DropTail
$ns duplex-link $n0 $n3 1.5Mb 10ms DropTail$ns duplex-link $n0 $n3 1.5Mb 10ms DropTail
3737USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast: Step 3
Routing and group setup
# Routing protocol: let’s run distance vector# Routing protocol: let’s run distance vector
$ns mrtproto DM$ns mrtproto DM
# Allocate group addresses# Allocate group addresses
set group1 [Node allocaddr]set group1 [Node allocaddr]
set group2 [Node allocaddr]set group2 [Node allocaddr]
3838USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast: Step 4
Sender 0
# Transport agent for the traffic source# Transport agent for the traffic sourceset set udp0udp0 [new Agent/UDP] [new Agent/UDP]$ns attach-agent $$ns attach-agent $n1n1 $ $udp0udp0$$udp0udp0 set dst_addr_ $ set dst_addr_ $group1group1$$udp0udp0 set dst_port_ 0 set dst_port_ 0
# Constant Bit Rate source #0 # Constant Bit Rate source #0 set set cbr0cbr0 [new Application/Traffic/CBR] [new Application/Traffic/CBR]$$cbr0cbr0 attach-agent $ attach-agent $udp0udp0# Start at time 1.0 second# Start at time 1.0 second$ns at 1.0 "$$ns at 1.0 "$cbr0cbr0 start" start"
3939USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast: Step 5
Sender 1
# Transport agent for the traffic source# Transport agent for the traffic sourceset set udp1udp1 [new Agent/UDP] [new Agent/UDP]$ns attach-agent $$ns attach-agent $n3n3 $ $udp1udp1$$udp1udp1 set dst_addr_ $ set dst_addr_ $group2group2$$udp1udp1 set dst_port_ 0 set dst_port_ 0
# Constant Bit Rate source #0 # Constant Bit Rate source #0 set set cbr1cbr1 [new Application/Traffic/CBR] [new Application/Traffic/CBR]$$cbr1cbr1 attach-agent $ attach-agent $udp1udp1# Start at time 1.1 second# Start at time 1.1 second$ns at 1.1 "$$ns at 1.1 "$cbr1cbr1 start" start"
4040USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast: Step 6
Receiver with dynamic membership
# Can also be Agent/Null# Can also be Agent/Null
set rcvr [new Agent/LossMonitor]set rcvr [new Agent/LossMonitor]
# Assign it to node $n2# Assign it to node $n2
$ns at $ns at 1.21.2 "$n2 join-group $rcvr $ "$n2 join-group $rcvr $group2group2""
$ns at $ns at 1.251.25 "$n2 leave-group $rcvr $ "$n2 leave-group $rcvr $group2group2""
$ns at $ns at 1.31.3 "$n2 join-group $rcvr $ "$n2 join-group $rcvr $group2group2""
$ns at $ns at 1.351.35 "$n2 join-group $rcvr $ "$n2 join-group $rcvr $group1group1""
4141USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast: Step 7
End-of-simulation wrapper (as usual)
$ns at 2.0 "finish"$ns at 2.0 "finish"proc finish {} {proc finish {} {
global ns fdglobal ns fdclose $fdclose $fd$ns flush-trace$ns flush-traceputs "running nam..."puts "running nam..."exec nam out.nam &exec nam out.nam &exit 0exit 0
}}$ns run$ns run
4242USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Other Examples
Available in the Lab this afternoonWeb traffic modelMulticast routingREDQueueing
4343USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
ns Primer – Wired World
Basic nsTwo examples TCP, multicast routing
Visualization
4444USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Visualization Tools
nam-1 (Network AniMator Version 1) Packet-level animation Well supported by ns
xgraph Conversion from ns trace to xgraph
format
4545USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
nam
Basic visualization Topology layout Animation control Synchronous replay
Fine-tune layoutTCP/SRM visualizationEditor: generate ns simulation scripts
4646USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
nsnam Interface
ColorNode manipulationLink manipulationTopology layoutProtocol stateMisc
4747USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
nam Interface: Color
Color mapping$ns color 40 red$ns color 40 red
$ns color 41 blue$ns color 41 blue
$ns color 42 chocolate$ns color 42 chocolate
Color flow id association$tcp0 set fid_ 40$tcp0 set fid_ 40 ;# red packets;# red packets
$tcp1 set fid_ 41$tcp1 set fid_ 41 ;# blue packets;# blue packets
4848USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
nam Interface: Nodes
Color$node color red$node color red
Shape (can’t be changed after sim starts)$node shape box$node shape box ;# circle, box, hexagon;# circle, box, hexagon
Marks (concentric “shapes”)$ns at 1.0 “$n0 add-mark m0 blue box”$ns at 1.0 “$n0 add-mark m0 blue box”
$ns at 2.0 “$n0 delete-mark m0”$ns at 2.0 “$n0 delete-mark m0”
Label (single string)$ns at 1.1 “$n0 label \”web cache 0\””$ns at 1.1 “$n0 label \”web cache 0\””
4949USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
nam Interfaces: Links
Color$ns duplex-link-op $n0 $n1 color "green"$ns duplex-link-op $n0 $n1 color "green"
Label$ns duplex-link-op $n0 $n1 label "abced"$ns duplex-link-op $n0 $n1 label "abced"
Dynamics (automatically handled)$ns rtmodel Deterministic {2.0 0.9 0.1} $n0 $n1$ns rtmodel Deterministic {2.0 0.9 0.1} $n0 $n1
Asymmetric links not allowed
5050USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
nam Interface: Topo Layout
“Manual” layout: specify everything
$ns duplex-link-op $n(0) $n(1) orient right$ns duplex-link-op $n(0) $n(1) orient right
$ns duplex-link-op $n(1) $n(2) orient right$ns duplex-link-op $n(1) $n(2) orient right
$ns duplex-link-op $n(2) $n(3) orient right$ns duplex-link-op $n(2) $n(3) orient right
$ns duplex-link-op $n(3) $n(4) orient 60deg$ns duplex-link-op $n(3) $n(4) orient 60deg
If anything missing automatic layout
5151USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
nam Interface: Protocol State
Monitor values of agent variables$ns add-agent-trace $srm0 srm_agent0$ns add-agent-trace $srm0 srm_agent0
$ns monitor-agent-trace $srm0$ns monitor-agent-trace $srm0
$srm0 tracevar C1_$srm0 tracevar C1_
$srm0 tracevar C2_$srm0 tracevar C2_
# … …# … …
$ns delete-agent-trace $tcp1$ns delete-agent-trace $tcp1
5252USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
nam Interface: Misc
Annotation Add textual explaination to your sim
$ns at 3.5 "$ns trace-annotate \“packet drop\"“$ns at 3.5 "$ns trace-annotate \“packet drop\"“
Set animation rate
$ns at 0.0 "$ns set-animation-rate 0.1ms"$ns at 0.0 "$ns set-animation-rate 0.1ms"
5353USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast Example: nam-Enhanced
Packet coloringNode colorNode labelLink labelAnnotationManual layoutQueueing
5454USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast: Step 1.1
Define nam color
# Colors for packets from two mcast groups# Colors for packets from two mcast groups$ns color 10 blue$ns color 10 blue$ns color 11 red$ns color 11 red
# Prune packets (# Prune packets (predefinedpredefined))$ns color 30 purple$ns color 30 purple# Graft packets# Graft packets$ns color 31 green$ns color 31 green
5555USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast: Step 2.1
Layout topology
# Manual layout: # Manual layout: order of the link is significantorder of the link is significant!!
$ns duplex-link-op $n0 $n1 orient right$ns duplex-link-op $n0 $n1 orient right
$ns duplex-link-op $n0 $n2 orient right-up$ns duplex-link-op $n0 $n2 orient right-up
$ns duplex-link-op $n0 $n3 orient right-down$ns duplex-link-op $n0 $n3 orient right-down
# Show queue on simplex link n0->n1# Show queue on simplex link n0->n1
$ns duplex-link-op $n0 $n1 queuePos 0.5$ns duplex-link-op $n0 $n1 queuePos 0.5
5656USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast: Step 4.1, 5.1
Source coloring# Group 0# Group 0
$udp0 set fid_ 10$udp0 set fid_ 10
$n1 color blue$n1 color blue
$n1 label “Source for group 0”$n1 label “Source for group 0”
# Group 1# Group 1
$udp1 set fid_ 11$udp1 set fid_ 11
$n3 color red$n3 color red
$n3 label “Source for group 1”$n3 label “Source for group 1”
5757USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast: Step 6.1
Receiver coloring$n2 label “Receiver”$n2 label “Receiver”
$ns at 1.2 "$n2 join-group $rcvr $group2; \$ns at 1.2 "$n2 join-group $rcvr $group2; \
$n2 add-mark m0 red"$n2 add-mark m0 red"
$ns at 1.25 "$n2 leave-group $rcvr $group2; \$ns at 1.25 "$n2 leave-group $rcvr $group2; \
$n2 delete-mark m0"$n2 delete-mark m0"
$ns at 1.3 "$n2 join-group $rcvr \ $group2; \$ns at 1.3 "$n2 join-group $rcvr \ $group2; \
$n2 add-mark m1 red"$n2 add-mark m1 red"
$ns at 1.35 "$n2 join-group $rcvr $group1; \$ns at 1.35 "$n2 join-group $rcvr $group1; \
$n2 add-mark m2 blue"$n2 add-mark m2 blue"
5858USC INFORMATION SCIENCES INSTITUTEUSC INFORMATION SCIENCES INSTITUTE
Multicast: Step 7.1
One final tweak
# Animation was too fast...# Animation was too fast...
$ns set-animation-rate 0.8ms$ns set-animation-rate 0.8ms