Computer Networks. Section1. Routing Algorithms and Network Layer Protocol Presenter: Shu-Ping Lin. Outline. Routing Algorithms The Network Layer in The Internet. Outline. Routing Algorithms The Network Layer in The Internet. Store-and-Forward Packet Switching. Routing Algorithm.
Computer Networks Section1. Routing Algorithms and Network Layer Protocol Presenter: Shu-Ping Lin
Outline • Routing Algorithms • The Network Layer in The Internet
Outline • Routing Algorithms • The Network Layer in The Internet
Routing Algorithm • Routing algorithm • Datagram • Virtual circuit • Differences between routing and forwarding • Routing versus forwarding
Routing Algorithm (cont’d) • Requirement of routing algorithm • Correctness and Simplicity • Robustness • Stability • Fairness • Optimality
Routing Algorithm (cont’d) • Nonadaptive (static routing) • Do not base routing decisions on measurement of the current traffic and topology. • The route used to get from node to node is computed in advance. • Adaptive (dynamic routing) • Change routing decisions to reflect changes in topology and traffic.
Optimality Principle • If router J is on the optimal path from router I to router K, the the optimal path from J to K also falls along the same route. • Sink tree • The set of optimal routes from all sources to a given destination • The goal of all routing algorithms is to discover and use the sink trees for all routers.
Shortest Path Routing • Link metric • Dijkstra algorithm
Flooding • Every incoming packet is sent out on every outgoing link except the one it arrived on. • Termination of flooding process • Hop counter • Record of packet which has been flooded • Applications of flooding • Military application • Comparison
Distance Vector Routing • Each router maintains a table giving the best known distance to each destination and which line to be used. • Tables are updated by exchanging information with the neighbors. • Items in the table • Preferred outgoing line • Estimate of the distance to that distance
Distance Vector Routing (cont’d) • Converge to the correct answer, but do so slowly. • It reacts rapidly to good news, but leisurely to bad news. • The count-to-infinity problem
Problem of DVR • Does not take line bandwidth into account. • Take too long to converge.
Link State Routing • Learning about the neighbors • Sending a special HELLO packet on each point-to-point line • Measuring line cost to each of its neighbors • Round-trip time • Traffic load • Line bandwidth
Link State Routing (cont’d) • Building link state packet
Link State Routing (cont’d) • Distributing the link state packets • Flooding is used to distribute the link state packet. • Each packet contains a sequence number that is incremented for each new packet sent. • Computing the new routes • Dijkstra’s algorithm can be run locally to construct the shortest path to all destinations.
Hierarchical Routing • As networks grow in size, the router routing tables grow proportionally. • Each router has responsible for its region and knows nothing about the internal structure of other router.
Hierarchical Routing (cont’d) • Penalty of increased path length • The optimal number of levels for an N router subnets is ln N.
Broadcasting Routing • The source simply send a distinct packet to each destination. • Waste bandwidth • Have to know complete list of all destinations • Flooding • Generate too many packets • Consume too much bandwidth
Broadcasting Routing (cont’d) • Multidestination routing • Each packet contains a list of destinations. • The destination set is partitioned among the output lines. • Using spanning tree • Routers must know which of its lines belong to the spanning tree in advance. • Copy an incoming packet onto all the spanning lines except the on it arrived on.
Broadcasting Routing (cont’d) • Reverse path forwarding • Router checks to see if the packet arrived on the line that is normally used for sending packets to the source of the broadcast.
Multicast Routing • Each router computes a spanning tree covering all other routers. • When a process sends a multicast packet to a group • Examining the spanning tree of this group • Removing all lines that do not lead to hosts that are members of group
Multicast Routing (cont’d) • Pruning spanning tree • Reverse path forwarding • Router with no hosts interested in a particular group sends a PRUNE message. • The subnet is recursively pruned.
Multicast Routing (cont’d) • Disadvantage of algorithm, suppose that network has n groups, each with an average of m members. • For each group, m pruned spanning trees must be stored • Total of mn trees • Core-based tree • A host wanting to multicast sends packets to the core, which does the multicast along the spanning tree.
Routing for Mobile Hosts (cont’d) • Mobile host • Migratory hosts • Roaming hosts • All hosts are assumed to have a permanent home location that never changes. • Hosts also have a permanent home address that can be used to determine their home location.
Routing for Mobile Hosts (cont’d) • Each area has a home agent which keeps track of hosts whose home is in the area, but who are currently visiting another area. • Each area has foreign agent which keeps track of all mobile hosts visiting this area.
Routing for Mobile Hosts (cont’d) • Registration procedure • Foreign agent searching • Registration • Foreign agent contacts the mobile host’s home agent. • Verification of mobile host’s home agent • Acknowledgement from the mobile host’s home agent
Routing for Mobile Hosts (cont’d) • Tunneling • Encapsulate the original packet in the payload field of an outer packet and sends the latter to the foreign agent.
Routing in Ad Hoc Networks • AODV (Ad hoc On-demand Distance Vector) • Distant relative of the Bellman-Ford distance vector algorithm • Considering the limited bandwidth and low battery life • On-demand algorithm
Routing in Ad Hoc Networks (cont’d) • AODV algorithm maintains a table at each node, keyed by destination and which neighbor to send packets in order to reach destination. • Route request packet
Routing in Ad Hoc Networks (cont’d) • When a route request packet arrives at a node • The (Source address, request ID) pair is looked up in a local history table too see if this request has already been seen and processed. • Receiver looks up the destination in its route table. • If receiver does not know a fresh route to the destination, it increments the Hop count field and rebroadcast the REQUEST packet.
Routing in Ad Hoc Networks (cont’d) • Destination constructs a ROUTE REPLY packet which follows the reverse path to source. • Each intermediate node enters this packet into local routing table when • No route to destination is known. • Sequence number for destination in REPLY is greater than the value in the routing table. • Sequence number is equal but the new route is shorter.
Routing in Ad Hoc Networks (cont’d) • Problem of mobility • Route maintenance • Periodically, each node broadcasts a Hello message. • If no response is returned, router prune this link. • Active neighbor
Routing in Ad Hoc Networks (cont’d) • Critical difference between AODV and DVR • Nodes do not send out periodic broadcasts containing their entire routing table.
Node Lookup in Peer-to-Peer Networks • One of p2p routing algorithm—Chord • Each user node has an IP address that can be hashed to an m-bit number call node identifier. • Successor (k) is the node identifier of the first actual node following k around the circle clockwise.
Node Lookup in Peer-to-Peer Networks (cont’d) • Finger table • Start field = k +2i (modulo 2m) • If key falls between k and successort (k), then the node holding information about key is successor (k). • Otherwise, the entry whose start field is the closest predecessor of key is tried.
Node Lookup in Peer-to-Peer Networks (cont’d) • Node r joining • New node r asks successor (r) for its predecessor. • Insert r in between successor and predecessor. • Successor should hand over those keys in the range predecessor (r)-r, which now belong to r. • Every node runs a background process that periodically recomputes each finger by calling successor.