[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] How to set the routing?



Hi all,
 
    I'm doing a script and the topology as following,
 
    4  5-------6
    |  |       |
    0  2       7  9
    |  |       |  |
   ------     ------
    |  |       |  |
    1  3       8  10
 
    here the nodes 0,1,2,3 and 7,8,9,10 construct two lans. And I want to send ftp packets from
0 to 8. But the first packet is wandering in the 7,8,9,10 lan until the simulation is over. Who can give
me some advices. Thanks.
 
   Here's the script:
 
    set ns [new Simulator]
set f [open mylan32.nam w]
$ns namtrace-all $f
 
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
 
set nodelist_ "$n0 $n1 $n2 $n3"
 
set na [$ns node]
set nb [$ns node]
 
set nc [$ns node]
 
set n4 [$ns node]
set n5 [$ns node]
set n6 [$ns node]
set n7 [$ns node]
 
set nodelist1_ "$n4 $n5 $n6 $n7"
 

$ns duplex-link $na $n0  10Mb 20ms DropTail
$ns duplex-link $nb $n2  10Mb 20ms DropTail
 
$ns duplex-link $nb $nc  10Mb 20ms DropTail
$ns duplex-link $nc $n4  10Mb 20ms DropTail
 

$ns duplex-link-op $na $n0 orient down
$ns duplex-link-op $nb $n2 orient down
 
$ns duplex-link-op $nb $nc orient right
$ns duplex-link-op $nc $n4 orient down
 

set lan1_ [$ns make-lan $nodelist_ 10Mb 1ms LL Queue/DropTail Mac/802_3 Channel]
 
set lan2_ [$ns make-lan $nodelist1_ 10Mb 1ms LL Queue/DropTail Mac/802_3 Channel]
 

$ns compute-routes
 
set tcp0 [$ns create-connection TCP/Reno $n0 TCPSink $n5 0]
$tcp0 set window_ 128
set ftp0 [$tcp0 attach-app FTP]
$ns at 0.1 "$ftp0 start"
$ns at 5.0 "$ns halt"
puts "running..."
$ns run
 
puts "finishing..."
$ns flush-trace
close $f
 
 
 
 
Qiang Liu
 
Institute of Computing Technology,
Chinese Academy of Sciences