[Olsr-users] ns2 and olsrd
Ignacio Alvarez e IƱaki Fuentes telematica
(spam-protected)
Wed May 6 12:50:05 CEST 2009
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.
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.
Could be the problem in using DumbAgent protocol?
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.
thanks a lot
regards
set scriptname routingdemo
set val(chan) Channel/WirelessChannel ;# Channel Type
set val(prop) Propagation/TwoRayGround ;# radio-propagation
model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(x) 10000 ;# x range in meters
set val(y) 10000 ;# y range in meters
#set val(rp) AODV ;# routing protocol
set val(rp) DumbAgent ;# routing protocol
set val(nn) 4 ;# number of mobile nodes
#set val(stime) 60.0 ;# simulation time
set val(stime) 360000.0 ;# simulation time = 100 hours
#establecemos un ancho de banda mayor para los enlaces wireless
Mac/802_11 set dataRate_ 11Mb
Mac/802_11 set basicRate_ 2Mb
set ns [new Simulator]
$ns use-scheduler RealTime
set tracefd [open "|gzip > $scriptname.tr.gz" w]
$ns trace-all $tracefd
#set tr0 [new BaseTrace/ShmGZ test.tr.gz 16 400 104857600]
set namtrace [open "|gzip > $scriptname.nam.gz" w]
#set namtrace [open "|nam -r 0.1 -" w]
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
#Procedure needed when running nam in real-time
proc NamTime {} {
#Send time to nam periodically
global ns namtrace
set now [$ns now]
set next [expr $now + 0.05]
puts $namtrace "T -t $now"
flush $namtrace
$ns at $next "NamTime"
}
#$ns at 1.0 "NamTime"
proc UniformErr {} {
set err [new ErrorModel]
$err unit packet
$err set rate_ 0.01
$err ranvar [new RandomVariable/Uniform]
$err drop-target [new Agent/Null]
return $err
}
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
# Create GOD
create-god $val(nn)
# Create channel
set chan_1_ [new $val(chan)]
# Configure node parameters
$ns node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-topoInstance $topo \
-agentTrace OFF \
-routerTrace OFF \
-macTrace ON \
-movementTrace OFF \
-channel $chan_1_ \
-IncomingErrProc UniformErr
#Procedure to configure an ns-2 node initially
proc setup_node {id x y z color} {
global ns node_
set node_($id) [$ns node]
$node_($id) set X_ $x
$node_($id) set Y_ $y
$node_($id) set Z_ $z
$node_($id) color $color
$ns at 0 "$node_($id) setdest $x $y 0"
$ns at 0 "$node_($id) color $color"
$node_($id) random-motion 0
}
setup_node 1 100 300 0 "black"
setup_node 2 300 300 0 "green"
setup_node 3 500 300 0 "blue"
setup_node 4 6000 6000 0 "cyan"
for {set i 1} {$i <= $val(nn)} {incr i} {
$ns at 0 "$node_($i) start";
$ns at $val(stime) "$node_($i) reset";
}
#Network objects to access the TAP devices at the link layer
set raw1 [new Network/Raw]
$raw1 open br0 readwrite
#Tap Agent for each node
Agent/Tap set maxpkt_ 3100
set a1 [new Agent/Tap/Raw "2E:01:F0:54:0C:4D"]
set a2 [new Agent/Tap/Raw "C2:91:EA:41:C5:6D"]
set a3 [new Agent/Tap/Raw "8A:9E:7A:5E:A7:C4"]
set a4 [new Agent/Tap/Raw "9E:C3:B1:0D:AE:F4"]
puts "install nets into taps..."
#Assign network objects to TAP agents
$a1 network $raw1
$a2 network $raw1
$a3 network $raw1
$a4 network $raw1
#$ns duplex-link $node_(1) $node_(2) 10Mb 10ms DropTail
#Assign TAP agents to ns-2 nodes
$ns attach-agent $node_(1) $a1
$ns attach-agent $node_(2) $a2
$ns attach-agent $node_(3) $a3
$ns attach-agent $node_(4) $a4
$ns at $val(stime) "stop"
$ns at $val(stime) "puts \"NS EXITING ...\" ; $ns halt"
proc stop {} {
global ns tracefd raw1
$ns flush-trace
close $tracefd
$raw1 close
}
puts "okey"
$ns run
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.olsr.org/pipermail/olsr-users/attachments/20090506/32f0f7db/attachment.html>
More information about the Olsr-users
mailing list