Hi! We connect the VM to NS2 emulation as an ethernet interface. We
have read it from a paper of magdeburg university. I agree with you
because i think that the routing will be done inside the VM, but
something strange happens, because if i put a node too far it listens
the other nodes request, but these nodes dont listen him. I think that
here is the problem because this should not happen.We did an attempt changing the virtual machines kernel but it also fail.<br>
<br> I will paste the ns2 code for you. We use a bridge connecting all
the VM because our final target is to connect a external interface as a
nokia810. We use iptables on the bridge to avoid the duplicated traffic
but the problem is not at iptables i am certain. <br>
<br>Could be the problem in using DumbAgent protocol?<br>i am very
sorry for my bad english but i have tried to explain it clearly...if
you dont understand something, just ask me and i will try to explain it
better.<br><br>
thanks a lot <br>regards<br><br><br><br>set scriptname routingdemo<br>set val(chan) Channel/WirelessChannel ;# Channel Type<br>set val(prop) Propagation/TwoRayGround ;# radio-propagation model<br>
set val(netif) Phy/WirelessPhy ;# network interface type<br>set val(mac) Mac/802_11 ;# MAC type<br>set val(ifq) Queue/DropTail/PriQueue ;# interface queue type<br>
set val(ll) LL ;# link layer type<br>set val(ant) Antenna/OmniAntenna ;# antenna model<br>set val(ifqlen) 50 ;# max packet in ifq<br>set val(x) 10000 ;# x range in meters<br>
set val(y) 10000 ;# y range in meters<br>#set val(rp) AODV ;# routing protocol<br>set val(rp) DumbAgent ;# routing protocol<br>set val(nn) 4 ;# number of mobile nodes<br>
#set val(stime) 60.0 ;# simulation time<br>set val(stime) 360000.0 ;# simulation time = 100 hours<br><br>#establecemos un ancho de banda mayor para los enlaces wireless<br>Mac/802_11 set dataRate_ 11Mb<br>
Mac/802_11 set basicRate_ 2Mb<br><br><br><br>set ns [new Simulator]<br>$ns use-scheduler RealTime<br><br>set tracefd [open "|gzip > $scriptname.tr.gz" w]<br>$ns trace-all $tracefd<br>#set tr0 [new BaseTrace/ShmGZ test.tr.gz 16 400 104857600]<br>
<br>set namtrace [open "|gzip > $scriptname.nam.gz" w]<br>#set namtrace [open "|nam -r 0.1 -" w]<br>$ns namtrace-all-wireless $namtrace $val(x) $val(y)<br><br>#Procedure needed when running nam in real-time<br>
proc NamTime {} {<br> #Send time to nam periodically<br> global ns namtrace<br> set now [$ns now]<br> set next [expr $now + 0.05]<br> puts $namtrace "T -t $now"<br> flush $namtrace<br> $ns at $next "NamTime"<br>
}<br><br>#$ns at 1.0 "NamTime"<br><br>proc UniformErr {} {<br> set err [new ErrorModel]<br> $err unit packet<br> $err set rate_ 0.01<br> $err ranvar [new RandomVariable/Uniform]<br> $err drop-target [new Agent/Null]<br>
return $err<br>}<br><br>set topo [new Topography]<br><br>$topo load_flatgrid $val(x) $val(y)<br><br># Create GOD<br>create-god $val(nn)<br><br># Create channel<br>set chan_1_ [new $val(chan)]<br><br># Configure node parameters<br>
$ns node-config -adhocRouting $val(rp) \<br> -llType $val(ll) \<br> -macType $val(mac) \<br> -ifqType $val(ifq) \<br> -ifqLen $val(ifqlen) \<br> -antType $val(ant) \<br> -propType $val(prop) \<br> -phyType $val(netif) \<br>
-topoInstance $topo \<br> -agentTrace OFF \<br> -routerTrace OFF \<br> -macTrace ON \<br> -movementTrace OFF \<br> -channel $chan_1_ \<br> -IncomingErrProc UniformErr<br><br><br><br>#Procedure to configure an ns-2 node initially<br>
proc setup_node {id x y z color} {<br> <br> global ns node_<br> set node_($id) [$ns node]<br> $node_($id) set X_ $x<br> $node_($id) set Y_ $y<br> $node_($id) set Z_ $z<br> $node_($id) color $color<br>
$ns at 0 "$node_($id) setdest $x $y 0"<br> $ns at 0 "$node_($id) color $color"<br> $node_($id) random-motion 0<br>}<br> <br>setup_node 1 100 300 0 "black"<br>setup_node 2 300 300 0 "green"<br>
setup_node 3 500 300 0 "blue"<br>setup_node 4 6000 6000 0 "cyan"<br> <br>for {set i 1} {$i <= $val(nn)} {incr i} {<br> $ns at 0 "$node_($i) start";<br> $ns at $val(stime) "$node_($i) reset";<br>
}<br><br><br><br>#Network objects to access the TAP devices at the link layer<br>set raw1 [new Network/Raw]<br><br><br>$raw1 open br0 readwrite <br><br><br>#Tap Agent for each node<br>Agent/Tap set maxpkt_ 3100<br>set a1 [new Agent/Tap/Raw "2E:01:F0:54:0C:4D"]<br>
set a2 [new Agent/Tap/Raw "C2:91:EA:41:C5:6D"]<br>set a3 [new Agent/Tap/Raw "8A:9E:7A:5E:A7:C4"]<br>set a4 [new Agent/Tap/Raw "9E:C3:B1:0D:AE:F4"]<br><br>puts "install nets into taps..."<br>
#Assign network objects to TAP agents<br>$a1 network $raw1<br>$a2 network $raw1<br>$a3 network $raw1<br>$a4 network $raw1<br><br>#$ns duplex-link $node_(1) $node_(2) 10Mb 10ms DropTail<br><br><br>#Assign TAP agents to ns-2 nodes<br>
$ns attach-agent $node_(1) $a1<br>$ns attach-agent $node_(2) $a2<br>$ns attach-agent $node_(3) $a3<br>$ns attach-agent $node_(4) $a4<br><br><br><br> <br>$ns at $val(stime) "stop"<br>$ns at $val(stime) "puts \"NS EXITING ...\" ; $ns halt"<br>
<br>proc stop {} {<br> global ns tracefd raw1<br> $ns flush-trace<br> close $tracefd<br> $raw1 close<br><br>}<br> <br>puts "okey"<br> <br>$ns run