AssalamOAlikum,
hope this may resolve your problem.
you may explicitly define your source and destination as follow.
# Setup traffic flow between nodes
# UDP connections between node_(2) and node_(3)
set udp [new Agent/UDP]
set sink [new Agent/Null]
$ns attach-agent $node_(2) $udp ///source
$ns attach-agent $node_(3) $sink /// destination
$ns connect $udp $sink
///////declear other source and destination as above
.
.
.
.
set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 1024
$cbr attach-agent $udp
$ns at 1.0 "$cbr start"
Regard
Amjad Ali
PhD student
School of Electrical Engineering and computer Science(SEECS)
NUST Pakistan