190 likes | 358 Views
FAMU-FSU COLLEGE OF ENGINEERING Department of Electrical and Computer Engineering. Computer Network Project The Dynamic Source Routing Protocol for Ad Hoc Networks. Students: Hung Khong – Derek Vollmer Instructor: Dr Ming Yu 04-2008. Content. Description of DSR routing protocols.
E N D
FAMU-FSU COLLEGE OF ENGINEERINGDepartment of Electrical and Computer Engineering Computer Network Project The Dynamic Source Routing Protocol for Ad Hoc Networks Students: Hung Khong – Derek Vollmer Instructor: Dr Ming Yu 04-2008
Content Description of DSR routing protocols Simulation Summary & Implementation Simulation Result Lessons Learned & Conclusion
Description of DSR routing protocols 1- Introduction to DSR • DSR Definition: • A send packets to E, the router to E is embedded in A’s header. Intermediate node uses this source route to determine to whom the packet should be forwarded. • Different packets may have different routers. • All nodes are willing to forward packets for other nodes in the network • The diameter of a network will not be too large • The node’s speed is moderate and nodes may move at any time without notice • All nodes are overhearing (promiscuous) increase power consumption.
Description of DSR routing protocols 2- Route Discovery (RREQ & RREP) • Every RREQ packet contains (initiator & target address, route record, request ID) • Each node maintains a list of (initial add. & request id) • When an intermediate node X receives a RREQ: • Discard RREQ if RREQ’s (initial add. & request id) is in node’s list • Returns a route reply packet which contains a route from initiator to target • If X is the target node • If X has an entry in its route cache for the route to target • Appends itself address to the route record in RREQ and re-broadcast RREQ • Uses exponential back-off algorithm to limit the rate of RREQ to reduce the overhead
Description of DSR routing protocols 3- Route Discovery (RREQ & RREP) • E on receiving the first RREQ, sends a Route Reply (RREP) including the route from A to E • RREP packet is sent to A by: • Route Reply can be sent by reversing the route in RREQ If links are bi-directional • If unidirectional (asymmetric) links are allowed, then a route to A is needed • Local route cache has a route to A • Piggybacking Route Reply in Route Request packet for A • Perform its own RREQ for target node A • If IEEE 802.11 MAC is used, then links have to be bi-directional • Route Caching : each node caches a new route it learns by all means
Description of DSR routing protocols 4- Route Maintenance • E sends a route error to A along route E-D-B-A when it finds link [E-F] broken • Nodes hearing RERR update their route cache to remove all invalid routes related with link E-F • How to find link [E-F] is down: • MAC level ack • Passive acknowledge (overhearing neighbor node transmission) • Insert a bit in packet’s header to request a DSR specific ack returned by next hop. • How to send RRER packet to A: • Use reverse route • Use intermediate node ‘s route cache to get to node A • Piggybacking RRER packet in route discovery packet A
Simulation Summary & Implementation 1- Simulation Summary • Simulation Topology: Ad-hoc network of 50 mobile nodes moving randomly within flat rectangular 1500x300m • Simulation time: 900 seconds • Data traffic : CBR UDP traffic source with 20 sources • Data rate: 4 256-byte packets/s • Radio channel: Lucent WaveLAN • Node movement velocity: 1 m/s and 20 m/s • Node Pause time: 0:100:900 (s)
Simulation Summary & Implementation 2- Simulation Implementation Traffic models • Random traffic connections of TCP or CBR can be setup between mobile nodes using a traffic-scenario generator script. ns cbrgen.tcl [-type cbr|tcp] [-nn nodes] [-seed seed] [-mc connections][-rate rate] Mobility models • The node-movement generator is available under ~ns/indep-utils/cmu-scen-gen/setdest directory and consists of setdest{.cc,.h} and Makefile. ./setdest [-n num_of_nodes] [-p pausetime] [-M maxspeed] [-t simtime] [-x maxx] [-y maxy] > [outdir/movement-file] Simulation trace files s 606.210364161 _39_ RTR - 1306 DSR 44 [13a a 27 800] ----[39:255 8:255 255 8] 2 [0 0] [0 0 0 0->0] [1 1 8 39->10]
#------- TESTCBR1.TCL---------------------------------------------------------------------------------- set randNum [expr 1000*rand()] set nodes 50 set connections 20 set bytesPerSecond 4.0 set pause 0 set speed 20.0 set x 1500 set y 300 set runTime 900 set version 2 for {set pause 0} {$pause <= 900} {incr pause 50} { set handle1 [open dsrRatio$version.txt a+] set handle2 [open dsrOver$version.txt a+] puts $handle1 "pause = $pause" puts $handle2 "pause = $pause" close $handle1 close $handle2 for {set i 0} { $i<10} {incr i} { exec ./ns indep-utils/cmu-scen-gen/cbrgen.tcl -type cbr -nn $nodes -seed $randNum -mc $connections -rate $bytesPerSecond > tcl/mobility/scene/cbr-$nodes-$connections-$bytesPerSecond-2 exec indep-utils/cmu-scen-gen/setdest/setdest -n $nodes -p $pause -M $speed -x $x -y $y -t $runTime > tcl/mobility/scene/scen-$x-$y-$nodes-$connections-$speed if {[catch {exec ./ns run.tcl -x $x -y $y -sc tcl/mobility/scene/scen-$x-$y-$nodes-$connections-$speed -cp tcl/mobility/scene/cbr-$nodes-$connections-$bytesPerSecond-2 >> runOut.txt} result]} { #exec ./ns run.tcl -x $x -y $y -sc tcl/mobility/scene/scen-$x-$y-$nodes-$connections-$speed -cp tcl/mobility/scene/cbr-$nodes-$connections-$bytesPerSecond exec awk -f awkcode1.awk runOut1.tr >> dsrRatio$version.txt exec awk -f macoverhead.awk runOut1.tr >>dsrOver$version.txt } } } #-----------AWK file to count the received packet/sent packet------------------- BEGIN {counter1 = 0; counter2 = 0;} $1~/s/ && /AGT/ { counter1 ++ } $1~/r/ && /AGT/ { counter2 ++ } END { print ( counter1, counter2) } #---------------------------------------------------------------------------------------------------- #---------- MACOVERHEAD File to find the overhead ----------------------------- BEGIN {dsrpktno = 0; dsrbyte = 0; cbrpktno = 0; cbrbyte = 0; } $1~/s/ && /DSR/ && /MAC/ { dsrpktno ++ ; dsrbyte+=$8 ;} $1~/s/ && /cbr/ && /MAC/ { cbrpktno ++ ; cbrbyte+=$8; } END { print ( dsrpktno, dsrbyte , cbrpktno, cbrbyte) } #----------------------------------------------------------------------------------------------------- Simulation Summary & Implementation 3- Simulation Code
def dsrPacketRatio(testNum, speed): speed = str(speed) testNum = str(testNum) fileRead = 'c:/dsrRatio%s.txt'%testNum fileWrite = 'c:/dsrRatioAvg%s.m'%testNum fileHandle = open(fileRead, 'r'); file2 = open(fileWrite, 'w'); pauseTimes = []; avgRatio = []; ratio = []; while 1: line = fileHandle.readline(); if not line: break; line = line[:-1]; items = line.split(' ') if items[0] == "pause": pauseTimes.append(int(items[2])); else: percentRatio = int(items[1])/float(items[0]); ratio.append(percentRatio); if len(ratio) == 10: sum = 0; for item in ratio: sum = sum+item; average = sum/10; ratio = []; avgRatio.append(average); file2.write('avgRatio = %s;\n' % str(avgRatio)); file2.write('pauseTimes = %s;\n' %str(pauseTimes)) file2.write("plot(pauseTimes, avgRatio)\ntitle('Packet Delivert Ratio (%sm/s)')\nxlabel('Pause Time (secs)')\nylabel('#data packets received/ #data packets sent')\n"%speed) file2.write('axis([0 900 0 1])\n'); fileHandle.close() file2.close() def routingOverhead(testNum, speed): testNum = str(testNum); speed = str(speed) fileRead = 'c:/dsrOver%s.txt' % testNum; fileWrite = 'c:/dsrOverHead%s.m'%testNum; fileHandle = open(fileRead, 'r'); file2 = open(fileWrite, 'w'); pauseTimes = []; avgOverhead = []; overhead = []; totalPackets = [] while 1: line = fileHandle.readline(); if not line: break; line = line[:-1]; items = line.split(' ') if items[0] == "pause": pauseTimes.append(int(items[2])); else: overhead.append(int(items[0])); packets = int(items[0])+int(items[2]); totalPackets.append(packets); if len(overhead) == 10: sum = 0; for item in overhead: sum = sum+item; average = sum/10; overhead = []; avgOverhead.append(average); sum = 0; for item in totalPackets: sum = sum+item; packetAvg = sum/len(totalPackets); file2.write('avgOverhead = %s;\n' % str(avgOverhead)); file2.write('pauseTimes = %s;\n' %str(pauseTimes)) file2.write("plot(pauseTimes, avgOverhead)\ntitle('Routing Overhead (%sm/s)')\nxlabel('Pause Time (secs)')\nylabel('Routing Overhead (Packets)')\n"% speed) file2.write('axis([0 900 0 %s])\n'%str(packetAvg)); fileHandle.close() file2.close() Simulation Summary & Implementation 3- Simulation Code (cont)
Simulation Result Scenario- 1500x300, 50 nodes, 20 sources, 1m/s, 4 512-byte packets/s.
Simulation Result Scenario- 1500x300, 50 nodes, 20 sources, 1m/s, 1 512-byte packet/s.
Tried changing the CMUPriQueue length from 50 to 50000. No effect. Changed the send_buffer size from 64 to 512 to 65535. No effect Changed the ARP_buffer from 64 to 65535. No effect. Modified the cbrgen.tcl file to only allow one node to communicate to one other node. No effect. Modified the packet size in cbrgen.tcl to generate 256 byte packets then 128 byte packets. This helped. Lowering the packet/s rate also helped. Simulation Result Desperate Measures
Simulation Result Scenario- 1500x300, 50 nodes, 20 sources,20 m/s, 4 256-byte packet/s.
Simulation Result Scenario- 1500x300, 50 nodes, 20 sources,20 m/s, 4 128-byte packet/s.
Simulation Result Scenario- 1500x300, 50 nodes, 20 sources,1 m/s, 4 128-byte packet/s.
Conclusion • Given a certain packet size, the protocol performs as expected. • DSR on-demand protocol has low routing-overhead. • Conduct further investigation of packet size influencing delivery ratio and the effect of denser topologies. 17
Lessons Learned • The cbrgen read-me file claims argument –s is max speed when it is speed type. –M is for max speed. • When simulating DSR, one must use CMUPriQueue or a segmentation fault will occur. • The send rate parameter at the top of the scenario file is the inverse of the rate argument in the command. When looking at other people’s results, we noticed they claimed 4 packets/s, but sent the same number of packets corresponding to a send rate of 4 (0.25 Packets/s). 18