1 / 10
Mobile Networking in ns
Speaker : Mark Yang
93.03.09
2 / 10
Abstract
Basic wireless model Pure wireless LANs Multihop ad-hoc networks
Extensions wireless model Wired-cum-wireless MobileIP
3 / 10
Basic – creating wireless topology
set topo [new Topography]
$topo load_flatgrid $opt(x) $opt(y)
where opt(x) and opt(y) are the boundaries used in simulation.
4 / 10
Basic – node config
$ns_ node-config -adhocRouting DSDV or DSR or TORA or AODV \-topoInstance $topo \-addressType hierarchical \-wiredRouting ON \-mobileIP ON \-llType LL \-macType Mac/802_11 \-antType Antenna/OmniAntenna \-propType Propagation/TwoRayGround \-phyType Phy/WirelessPhy \-channelType Channel/WirelessChannel \-ifqType Queue/DropTail/PriQueue \-ifqLen <integer> \-agentTrace ON or OFF \-routerTrace ON or OFF \-macTrace ON or OFF \-movementTrace ON or OFF
Wired-cum-wirelessMobileIP
5 / 10
Basic – node movement
$node set X_ <x1>
$node set Y_ <y1>
$node set Z_ <z1>
Start-position
$ns at $time $node setdest <x2> <y2> <speed>
Future destinations
6 / 10
Basic – new traces
$ns use-newtrace
s -t 0.029290548 -Hs 1 -Hd -1 -Ni 1 -Nx 390.00 -Ny 385.00 -Nz 0.00
-Ne -1.000000 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.255
-Id -1.255 -It message -Il 32 -If 0 -Ii 0 -Iv 32
event s,r,d,f
time
id for next hop
next hopdestination
node id
node’s x-coordinate
node’s z-coordinate
node’s y-coordinate
nodeenergy level
trace level
reason for this event
duration
dest’s ethernet addr
source’s ethernet addr
ethernet type
source’s addr.port
dest’s addr.port
packet type
packet size
flow id
unique id
ttl value -H: next hop info-N: node info-M: MAC level info-I: IP level info
7 / 10
Basic – traffic scenario generator
source pattern-file
ns cbrgen.tcl -type cbr -nn 10 -seed 1.0 -mc 8 -rate 4.0 > pattern-file
ns cbrgen.tcl -type tcp -nn 25 -seed 0.0 -mc 8 > pattern-file
# nodes: 10, max conn: 8, send rate: 0.25, seed: 1.0# 1 connecting to 2 at time 2.5568388786897245set udp_(0) [new Agent/UDP]$ns_ attach-agent $node_(1) $udp_(0)set null_(0) [new Agent/Null]$ns_ attach-agent $node_(2) $null_(0)set cbr_(0) [new Application/Traffic/CBR]$cbr_(0) set packetSize_ 512$cbr_(0) set interval_ 0.25$cbr_(0) set random_ 1$cbr_(0) set maxpkts_ 10000$cbr_(0) attach-agent $udp_(0)$ns_ connect $udp_(0) $null_(0)$ns_ at 2.5568388786897245 "$cbr_(0) start“ :
Introduce random “noise” in the scheduled departure time.
8 / 10
Basic – movement scenario generator
source pattern-file
~ns/indep-utils/cmu-scen-gen/setdest./setdest -n 3 -p 2.0 -s 20.0 -t 300 -x 600 -y 600 > pattern-file
set god_ [God instance]$ns_ at 50.000000000000 "$node_(2) setdest 369.463244915743 170.519203111152 3.371785899154”$ns_ at 51.000000000000 "$node_(1) setdest 221.826585497093 80.855495003839 14.909259208114”$ns_ at 33.000000000000 "$node_(0) setdest 89.663708107313 283.494644426442 19.153832288917”$god_ set-dist 1 2 2$god_ set-dist 0 2 3$god_ set-dist 0 1 1$node_(2) set Z_ 0.000000000000$node_(2) set Y_ 199.373306816804$node_(2) set X_ 591.256560093833$node_(1) set Z_ 0.000000000000$node_(1) set Y_ 345.357731779204$node_(1) set X_ 257.046298323157$node_(0) set Z_ 0.000000000000$node_(0) set Y_ 239.438009831261$node_(0) set X_ 83.364418416244 :
The shortest path between node 1 and node 2 is 2 hops.
9 / 10
Extensions – wired-cum-wireless
$ns_ node-config -addressType hierarchicalAddrParams set domain_num_ 2lappend cluster_num 2 1AddrParams set cluster_num_ $cluster_numlappend eilastlevel 1 1 4AddrParams set nodes_num_ $eilastlevel
set temp {0.0.0 0.1.0}for {set i 0} {$i < $num_wired_nodes} {incr i} { set W($i) [$ns_ node [lindex $temp $i]] }
$ns_ node-config -wiredRouting ONset temp {1.0.0 1.0.1 1.0.2 1.0.3}set BS(0) [$ns_ node [lindex $temp 0]]$BS(0) random-motion 0
$ns_ node-config -wiredRouting OFFfor {set j 0} {$j < $opt(nn)} {incr j} { set node_($j) [ $ns_ node [lindex $temp [expr $j+1]] ] $node_($j) base-station [AddrParams addr2id [$BS(0) node-addr]] }
W(0)
W(1)
BS(0)
node_(1)node_(0)
node_(2)
domain 0
domain 1
cluster 0
cluster 1
cluster 0
0,0,0
0,1,0
1,0,0
1,0,1 1,0,2
1,0,3
10 / 10
Extensions – MobileIP
$ns_ node-config -mobileIP ON
set HA [$ns_ node 1.0.0]set FA [$ns_ node 2.0.0]$HA random-motion 0$FA random-motion 0
set MH [$ns_ node 1.0.1]set node_(0) $MHset HAaddress [AddrParams addr2id [$HA node-addr]][$MH set regagent_] set home_agent_ $HAaddress
W(0)
W(1)
HA
MH
FA