850 likes | 1.07k Views
Adhoc Networks Routing Tutorial - Part II -. Internet Computing Laboratory @ KUT ( http://icl.kut.ac.kr ) Youn-Hee Han. It is licensed under a Creative Commons Attribution 2.5 License. Reactive Routing Protocols. Reactive Approach - Principle. On-Demand
E N D
Adhoc Networks Routing Tutorial- Part II - Internet Computing Laboratory @ KUT (http://icl.kut.ac.kr) Youn-Hee Han It is licensed under a Creative Commons Attribution 2.5 License
Reactive Routing Protocols Computer Network
Reactive Approach - Principle • On-Demand • Re-active, become active only when needed • The routes are created when required • The source has to discover a route to the destination. • The source and intermediate nodes have to maintain a route as long as it is used. • Routes have to be repaired in case of topology changes. • Normally 3 Phases • Route Discovery • Route Maintain • Route Delete • More Scalable than Table Drive (Proactive) Protocols Computer Network
Reactive Approach - Principle • Representative Protocols • DSR– Dynamic Source Routing • AODV– Ad Hoc On-demand Distance Vector Routing • TORA – Temporally Ordered Routing Algorithm Computer Network
Dynamic Source Routing (DSR) • Source routing • Full Routes are kept in each data packet • Sender of a packet determines the complete sequence of nodes to forward the packet • Reaction to topology changes more rapid • node caches multiple routes to destination • Avoids need to perform Route Discovery each time a route breaks • Each host participating in the ad hoc network maintains a route cache in which it caches source routes for destination nodes Computer Network
Dynamic Source Routing (DSR) • Route Discovery: • allows any host to dynamically discover a route to any other host in the ad hoc network. • a host initiating a route discovery broadcasts a route request packet, Route Request (RREQ) • each route request packet contains a route record, request ID • If a host saw the packet (with the same request ID) before, discards it. • Otherwise, the host looks up its route caches to look for a route to destination, If not find, appends its address into the packet, rebroadcast, • If finds a route in its route cache, sends a route reply packet, which is sent to the source by route cache, RREQ’s info. or the route discovery. • if successful, initiating host receives a route reply packet, Route Reply (RREP) • Any node which has a route to the destination replies with a route reply • the route is saved in the cache for future use • Any route that is seen through a node is cached Computer Network
Dynamic Source Routing (DSR) • Route maintenance: • A host monitors the correct operation of routes in use • A host is able to detect that the network topology has changed such that it can no longer use its route to D because a link along the route no longer works • A Route ERROR is sent to the Source • All nodes along the path remove that route • 예를들어 S – E – F – J – D • 임의의 노드 이동 (if F) • E와 J는 Route cache에 저장된 경로중 F가 포함된 경로는 모두 삭제 • E와 J는 각각 S와 D에게 Route ERROR를 보냄 • S와 D도 Route cache에 저장된 경로중 F가 포함된 경로는 모두 삭제 • If receives a Route ERROR, the source uses a cached alternate route to destination or sends out request packets for a new route Computer Network
DSR –Route Discovery • When node S wants to send a packet to node D, but does not know a route to D, node S initiates a route discovery • Source node S floods Route Request (RREQ) • Each node appends its own address when forwarding RREQ Y Z S E F B C M L J A G H D K I N Represents a node that has received RREQ for D from S Computer Network
DSR –Route Discovery • Originating a RREQ RREQ Y Broadcast transmission (ACKed) Z [S] S E F B C M L J A G H D K I N Represents transmission of RREQ Represents a node that has received RREQ for D from S Computer Network
DSR –Route Discovery • Forwarding RREQ Y RREQ Z Path Accumulation S [S,E] E F B C M L J A G [S,C] H D K I N • Node H receives packet RREQ from two neighbors B and C • Node C and E send RREQ to each other • Duplicate RREQ are discarded [X,Y] Represents list of Node ID appended to RREQ Computer Network
DSR –Route Discovery • Forwarding RREQ Y Z S E F [S,E,F] B C M L J A G H D K [S,B,A] [S,C,G] I N [S,C,H] • Node C receives RREQ from G and H, but does not forward • it again, because node C has already forwarded RREQ once • Duplicate RREQ are discarded Computer Network
DSR –Route Discovery • Forwarding RREQ Y Z S E F [S,E,F,J] B C M L J A G H D [S,C,H,I] K I N [S,C,G,K] Computer Network
DSR –Route Reply • Destination D on receiving the first RREQ, sends a Route Reply (RREP) • RREP includes the route from S to D on which RREQ was received by node D • Route Reply is sent by reversing the route in Route Request (RREQ) • this requires bi-directional link • to ensure this, RREQ should be forwarded only if it received on a link that is known to be bi-directional • If IEEE 802.11 MAC is used to send data, then links have to be bi-directional (since ACK is used) • If unidirectional (asymmetric) links are used, then RREP may need a route discovery for S from node D • Piggyback RREP on RREQ to S Computer Network
DSR –Route Reply • RREP delivery Y RREP [S,E,F,J,D] Z S E F B C M L J A G H D K I N RREP control message Computer Network
DSR Optimization - Route Caching • Each node caches a new route it learns • When node S finds route [S,E,F,J,D] to node D, node S also learns route [S,E,F] to node F • When node K receives Route Request [S,C,G] destined for node, node K learns route [K,G,C,S] to node S • When node F forwards Route Reply RREP[S,E,F,J,D], node F learns route [F,J,D] to node D • When node E forwards Data [S,E,F,J,D] it learns route [E,F,J,D] to node D • Other optimisations: • Piggybacking on route discoveries • data on route requests • RREP on Route Discovery from D to S • RREP Hop Limit Computer Network
DSR - Summary • Advantages • Reactive: routes maintained only between nodes who need to communicate • Route caching can further reduce route discovery overhead • a single route discovery may yield many routes to the destination, due to intermediate nodes replying from local caches • Disadvantages • Packet header size grows with route length due to source routing • Flood of route requests may potentially reach all nodes in the network • Care must be taken to avoid collisions between route requests and route reply propagated by neighboring nodes Computer Network
DSR - Summary • Increased contention if too many route replies come back due to nodes replying using their local cache • Route Reply Storm problem • Reply storm may be eased by preventing a node from sending RREP if it hears another RREP with a shorter route • Route reply storms also prevented by randomising delay time before sending route replies Computer Network
DSR–one more example source broadcasts a packet containing address of source and destination source (1,4) 1 4 The destination sends a reply packet to source. 8 (1,3) destination 3 7 (1,4,7) 2 The node discards the packets having been seen (1,2) 6 5 (1,3,5,6) (1,3,5) The route looks up its route caches to look for a route to destination If not find, appends its address into the packet Computer Network
AODV • AODV: Ad hoc On-demand Distance Vector routing protocol • an IETF Experimental RFC • References • C. E. Perkins, E. M. Belding-Royer, and S. R. Das, “Ad hoc On-Demand Distance Vector (AODV) Routing,” IETF RFC 3561, July, 2003. • C. E. Perkins and E. M. Royer, “Ad hoc On-Demand Distance Vector Routing,” Proceedings 2nd IEEE Workshop on Mobile Computing Systems and Applications, February 1999, pp. 90-100. Computer Network
Adhoc On-demand Distance Vector (AODV) • Pure on-demand routing protocol • A node does not perform route discovery or maintenance until it needs a route to another node or it offers its services as an intermediate node • Nodes that are not on active paths do not maintain routing information and do not participate in routing table exchanges • Uses a broadcast route discovery mechanism • Uses hop-by-hop routing • Routes are based on dynamic table entries maintained at intermediate nodes • Similar to Dynamic Source Routing (DSR), but DSR uses source routing Computer Network
Adhoc On-demand Distance Vector (AODV) • Designed for MANETs with 10,000 to 100,000 nodes • Uses a broadcast route discovery mechanism as in DSR • Each node only keeps next-hop information • Improves scalability and performance • Reduces dissemination of control traffic • Eliminates overhead on data traffic • From DSR • Route discovery • Route maintenance • From DSDV • Hop-by-hop routing • Sequence numbers Computer Network
AODV – overview • Route Table Entry • Destination IP Address (KEY) • Destination Sequence Number • it is used to determine the freshness of the information contained from the originating node. • crucial to avoiding routing loops • Valid Destination Sequence Number flag • Other state and routing flags • valid, invalid, repairable, being repaired • Network Interface • Hop Count • number of hops needed to reach destination • Next Hop • List of Precursors • Neighboring nodes to which a RREP was forwarded. • Lifetime (expiration or deletion time of the route) Computer Network
AODV – overview Route Table Entry Node 1 에서의 routing table 4 2 5 3 1 6 Computer Network
AODV – overview Route Table Entry Node 1 에서의 routing table 4 2 5 3 1 6 Computer Network
AODV – overview • Basic Message Set • RREQ – Route request • RREP – Route reply • RERR – Route error • HELLO – For link status monitoring Computer Network
AODV – overview • RREQ Messages • While communication routes between nodes are valid, AODV does not play any role. • A RREQ message is broadcastedwhen a node needs to discover a route to a destination. • As a RREQ propagates through the network, intermediate nodes use it to update their routing tables (in the direction of the source node) • Setup Reverse Path to Source Node • DSN is set to the value in the originator sequence number field of the RREQ, if it is greater than the stored DSN. • The RREQ also contains the most recent sequence number for the destination (DSN). • If the source node don’t know it, DSN is zero • A valid destination route must have a sequence number at least as great as that contained in the RREQ. Computer Network
AODV – overview • RREQ Message Format • J: Join Flag, R: Repair Flag • G: Gratuitous RREP flag • indicates whether a gratuitous RREP should be unicast to the node specified in the Destination IP Address field • D: Destination only flag • indicates only the destination may respond to this RREQ • U: Unknown sequence number • indicates the destination sequence number is unknown • Hop Count • The number of hops from the Originator IP Address to the node handling the request. • RREQ ID • A sequence number uniquely identifying the particular RREQ when taken in conjunction with the originating node's IP address. • Destination Sequence Number • The latest sequence number received in the past by the originator for any route towards the destination. • Originator Sequence Number • The current sequence number to be used in the route entry pointing towards the originator of the route request. 1 Computer Network
Y Z S E F B C M L J A G H D K I N AODV Route Discovery (1/7) Computer Network
Y Z S E F B C M L J A G H D K I N AODV Route Discovery (2/7) RREQ 전송 Computer Network
Y Z S E F B C M L J A G H D K I N AODV Route Discovery (3/7) Reverse Path Computer Network
Y Z S E F B C M L J A G H D K I N AODV Route Discovery (4/7) Computer Network
Y Z S E F B C M L J A G H D K I N AODV Route Discovery (5/7) Computer Network
Y Z S E F B C M L J A G H D K I N AODV Route Discovery (6/7) Route Table Computer Network
AODV – overview • RREP Messages • When a RREQ reaches a destination node, the destination route is made available by unicasting a RREP back to the source route. • A node generates a RREP if: • It is itself the destination. • It has an active route to the destination. • Ex: an intermediate node may also respond with an RREP if it has a “fresh enough” route to the destination. • As the RREP propagates back to the source node, intermediate nodes update their routing tables (in the direction of the destination node). • Setup Forward Path to Source Node Computer Network
AODV – overview • RREP Message Format • R: Repair Flag • A: Acknowledgment required • receiver of the RREP is expected to return a RREP-ACK message • Prefix Size • If nonzero, the 5-bit Prefix Size specifies that the indicated next hop may be used for any nodes with the same routing prefix (as defined by the Prefix Size) as the requested destination • Hop Count • The number of hops from the RREP generator to the Destination IP Address. • Destination Sequence Number • The destination sequence number associated to the route. • Lifetime • The time in milliseconds for which nodes receiving the RREP consider the route to be valid. • Destination IP Address • The IP address of the destination for which a route is supplied. • Originator IP Address • The IP address of the node which originated the RREQ for which the route is supplied. 2 Computer Network
RREP 전송 Forward Path AODV Route Discovery (7/7) Route Table Y Z S E F B C M L J A G H D K I N Computer Network
AODV – overview • RERR Messages • This message is broadcast for broken links • Generated directly by a node or passed on when received from another node • RERR Message is broadcasted when: • A node detects that a link with adjacent neighbor is broken (destination no longer reachable). • If it gets a data packet destined to a node for which it does not have an active route and is not repairing. • If it receives a RERR from a neighbor for one or more active routes. Computer Network
AODV – overview • RERR Message Format • N: No delete flag • set when a node has performed a local repair of a link, and upstream nodes should not delete the route. • DestCount • The number of unreachable destinations included in the message; MUST be at least 1. • Unreachable Destination IP Address • The IP address of the destination that has become unreachable due to a link break. • Unreachable Destination Sequence Number • The sequence number in the route table entry for the destination listed in the previous Unreachable Destination IP Address field. • RREP-ACK Message Format 3 4 Computer Network
AODV – overview • Hello Messages • HELLO messages are used to determine local connectivity • HELLO Message = RREP with TTL = 1 • If a node does not receive any packets (HELLO messages or otherwise) from a neighbor for more than ALLOWED_HELLO_LOSS * HELLO_INTERVAL, the node will assume that the link to this neighbor is currently lost. • A node should use HELLO messages only if it is part of an active route. Computer Network
AODV – overview Basic Messaging Routing Source G A RREQ RREQ RREQ RREP RREQ B D RREQ RREP RREQ RREQ RREP F Destination C RREQ RREQ E Computer Network
AODV – overview • Why Sequence Numbers in AODV • To avoid using old/broken routes • To determine which route is newer • To prevent formation of loops • Assume that A does not know about failure of link C-D because RERR sent by C is lost • Now C performs a route discovery for D. Node A receives the RREQ (say, via path C-E-A) • Node A will reply since A knows a route to D via node B • Results in a loop (for instance, C-E-A-B-C ) A B C D E A B C D E Computer Network
AODV – overview • destination sequence number(DSN) used as timestamps. • DSN is updated whenever a node receives new (i.e., not stale) information about the sequence number from RREQ, RREP, or RERR messages • Source sequence number in RREQ indicates “freshness” of reverse route to the source • Destination sequence number in RREQ indicates the latest sequence number received in the past by the originator towards the destination. • Destination sequence number in RREP or RERR indicates “freshness” of route to the destination Computer Network
AODV – overview • Sequence Numbers Rule • A sender node MUST increment it before it sends a RREQ • An intermediate node in RREQ path determines whether Received DSN < Stored DSN. If it is, the RREQ message MUST be discarded and the sender is notified of the new information. • Ensures RREQs not forwarded unnecessarily • Before a node sends a RREP in response to a RREQ, it MUST update its own sequence number to MAX {its current stored DSN : DSN in the RREQ packet}. Computer Network
AODV – overview • When does an intermediate node sends RREP to the RREQ originator? • “an intermediate node has a more fresh information” • It means • Seq(A) < Seq(B) • Intermediate node (B) either has a newer route to endpoint than the start node (A) • If a node receives a RREQ, when does a node updates its routing table entry? • 1. Received Number > Stored Number • 2. Received Number == Stored Number, and (The number in hop count field of the message + 1) < Stored hop count number Computer Network
Start to transmit data packet Broadcast RREQ packet NET_TRAVERSAL_TIME Timer set Retry ++ Generate RREQ packet(Hop Count = 0) NET_TRAVERSAL_TIME=2 * NET_TRAVERSAL_TIME AODV – Flowchart Generate RREQ packet Control Messages sent of Port 654 UDP When need to send data. Have a route to destination? No Yes Yes RREP received withinNET_TRAVERSAL_TIME? Retry < RREQ_RETRIES? No Yes No Packet Sending is not allowed End
AODV – Flowchart • Receive RREQ packet Receive RREQ packet Already Process RREQ ID? Yes Discard it No Set the Reverse path Destination ? No Fresh Route Information to destination ? No Yes Yes Rebroadcast RREQ packet Reply RREP packet Computer Network
AODV – Flowchart • Receive RREP packet Receive RREP packet Set Forward path Source node? No Update next hop information Yes Start to transmit data packet Unicast RREP via Reverse path Computer Network
AODV – Flowchart • Detecting broken link Detecting Broken Link Generate RERR packet Precursor count = 1? No Yes Multiple unicast RERR Unicast RERR via Reverse path Computer Network
Timeouts • A routing table entry maintaining a reverse path is purged after a timeout interval • timeout should be long enough to allow RREP to come back • A routing table entry maintaining a forward path is purged if not used for a active_route_timeout interval • if no is data being sent using a particular routing table entry, that entry will be deleted from the routing table (even if the route may actually still be valid) Computer Network
Link Failure Detection • Hellomessages • Absence of hello message is used as an indication of link failure • When it is sent? • Every HELLO_INTERVAL, a node checks whether it has sent a broadcast (a RREQ or an layer 2 message) within the HELLO_INTERVAL • If it has not, it broadcasts HELLO • Alternatively, failure to receive several MAC-level acknowledgement may be used as an indication of link failure • A neighbor of node X is still considered active for if the neighbor sent a packet within active_route_timeout interval which was forwarded using an entry in the routing table Computer Network