0% found this document useful (0 votes)
238 views15 pages

Using DSR in ns2: Rishi Sinha

This document provides instructions for using the Dynamic Source Routing (DSR) protocol in the ns-2 network simulator. It describes DSR's basic reactive and source routing mechanisms. It also explains how to configure DSR in ns-2 scripts and edit the DSR code to enable different trace messages. The document demonstrates how to analyze trace files to extract information like cache miss and packet drop times.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
238 views15 pages

Using DSR in ns2: Rishi Sinha

This document provides instructions for using the Dynamic Source Routing (DSR) protocol in the ns-2 network simulator. It describes DSR's basic reactive and source routing mechanisms. It also explains how to configure DSR in ns-2 scripts and edit the DSR code to enable different trace messages. The document demonstrates how to analyze trace files to extract information like cache miss and packet drop times.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Using DSR in ns2

Rishi Sinha
Objective
• Quick introduction to using DSR
• Not about wireless simulation as such
• Leaves not much in terms of using DSR
• DSR code recompiling for various options
• DSR code recompiling for various trace
messages
DSR characteristics
• Reactive
• Source-routing
• ARP-like behavior
• Router object in ns – sends and receives
packets from agents and link layer
DSR basic mechanisms
• Route discovery – limited
• Route discovery – flooding
• Source route construction
• Route reply
• Route error
• Salvaging
DSR in ns script
$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) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF
The val array
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(nn) 2 ;# number of mobilenodes
set val(rp) DSR ;# routing protocol
DSR code in ns
• $NS/dsr/[Link]
• Edit to make changes
• In $NS:
– make depend
– make
• ns defaults - $NS/tcl/lib/[Link]
DSR traces using node-config
• $ns_ node-config -routerTrace ON
• s 128.014398266 _0_ RTR --- 3 DSR 24 [0 0 0 0]
------- [0:255 2:255 32 0] 1 [1 2] [0 2 0 0->0] [0 0
0 0->0]
• Send
• Time
• Node
• Router or agent
• Packet (event) id
• Packet type
• Size
DSR traces using DSR code
• Unconditional trace () statements
• Conditional trace statements – verbose
• trace() implementation checks for verbose
• So unconditional not output
• Make changes in [Link] and recompile
ns
Non-verbose output
void
DSRAgent::trace(char* fmt, ...)
{
...
if (verbose) {
va_start(ap, fmt);
vsprintf(logtarget->pt_->buffer(), fmt, ap);
logtarget->pt_->dump();
va_end(ap);
}
}
Non-verbose output
• Remove the conditional shown above
• SRR 127.93668 _0_ new-request 0 0 #1 -> 2
• SRR 128.00957 _0_ new-request 16 0 #2 -> 2
• SRR 128.021161410 _2_ reply-sent 2 -> 0 #2 (len
3) [(0) 1 2 ]
Verbose output
• Let the conditional be
• Output will include non-verbose output
• Change these lines:
• static const int verbose = 0;
• static const int verbose_srr = 0;
Verbose output
• S$miss 127.93668 _0_ 0 -> 2
• Sdebug 127.93668 _0_ stuck into send buff 0 ->
2
• S$hit 135.40639 _0_ 0 -> 2 [(0) 1 2 ]
DSR options
• Timeouts
– Time arp_timeout = 30.0e-3; // (sec) arp request
timeout
– Time rt_rq_period = 0.5; // (sec) length of one
backoff period
– Time rt_rq_max_period = 10.0; // (sec) maximum time
between rt reqs

• bool dsragent_snoop_forwarded_errors = true;


// give errors we forward to our cache?
• bool dsragent_snoop_source_routes = true;
// should we snoop on any source routes we see?
Trace file analysis
• Using grep and awk to get times of all
cache misses:
$ cat [Link] > awk ‘$1==“S\$miss”{print $2, $3}’

• Using grep and awk to get times of all


drops:
$ cat [Link] > awk ‘$1==“SRR” &&
$4==“dropped”{print $2, $3}’

You might also like