Inside a Router Functionalities of Router • Router is responsible for Routing and Forwarding. • Forwarding : The way a packet is delivered to next station. • Routing : The way routing table is created to help in forwarding • Routing – Apply Routing Algorithms – Choose better path – Create forwarding table • Forwarding – Put on appropriate output interface Priyank bhojak (www.priyankbhojak.in) Router Architecture INPUT PORTS OUTPUT PORTS SWITCHING FABRIC Routing Processor Priyank bhojak (www.priyankbhojak.in) Input Port 1 2 3 1. Physical Layer Function: 2. Datalink layer function: 3. Lookup and Forwarding function: – Maintains forwarding table – Queuing a packet if switching fabric is busy Priyank bhojak (www.priyankbhojak.in) Output Port • Stores incoming packets • Transmits packets on outgoing link • Terminate outgoing physical link of output port Switching Fabric • Connects the router’s input and output ports Priyank bhojak (www.priyankbhojak.in) Routing Processor Routing Processor • Implements routing protocols • Maintains routing information and Forwarding table • Performs network management functions within router : Priyank bhojak (www.priyankbhojak.in) Network Layer Routing Algorithms Index • • • • • • • • • • • • About Routing Algorithms Types of routing Algorithms The optimality principle Shortest path routing Flooding Distance vector Routing Link state routing Broadcast routing Hierarchical Routing Multicast routing Routing for Mobile host Routing in Ad hoc Network Priyank bhojak (www.priyankbhojak.in) Routing Algorithms 1 Definition: The routing algorithm is that part of the network layer software responsible for deciding which output line an incoming packet should be transmitted on. packet 2 Properties of routing algorithm: correctness, simplicity, robustness, stability, fairness, and optimality. Priyank bhojak (www.priyankbhojak.in) • If subnet uses a datagram , Decision will be taken for Each packet. • If subnet uses virtual circuit , Routing decisions are made only when a new virtual circuit established or new session requires This is some time called as Session Routing. • Router is responsible for Routing and Forwarding. • Forwarding : The way a packet is delivered to next station. • Routing : The way routing table is created to help in forwarding Priyank bhojak (www.priyankbhojak.in) Properties of Routing Algorithm • Correctness – Correct routing only helps packet to reach at correct destination. • Simplicity – Increased complexity , also increased overhead • Robustness – Routing Algorithm must be able to cope with changes in topology and traffic. • Stability – Should be stable under all possible circumstances • Fairness – Every connected node should get fair chance of transmission. Generally achieved using FCFS • Optimality – Algorithm should be optimal in terms of throughput (Maximum) by removing possible hops, and packet transmission delay(Minimum) by reducing required bandwidth. Priyank bhojak (www.priyankbhojak.in) Types of Routing Algorithms • Non-Adaptive Routing Algorithms : – Route to be follow in going from one node to another node is computed in advance, offline and downloaded to the routers when network is booted. – Decisions are not depend on current traffic. – Also known as Static Routing. • Adaptive Routing : – Change routing decisions based on change in topology as well as change in traffic. – Adaptive algorithms get information from either adjacent router or from all the routers. – Optimization parameters are distance , Hops , and estimated transit time. – Also called as Dynamic Routing. Priyank bhojak (www.priyankbhojak.in) Sink Tree • Sink tree doesn’t contains any loops . • finite and bounded number of hops. • sink tree is not necessarily unique. • The goal of all routing algorithms is to discover and use the sink trees for all routers. Priyank bhojak (www.priyankbhojak.in) Sink Tree Priyank bhojak (www.priyankbhojak.in) Flooding • Every incoming packet is sent out on every outgoing line except the one it arrived on. • Generates vast number of duplicate packets, Some time infinite number. • Solution is “Put hop counter in each packet’s header” which is decremented at each hop. Packet with hop count zero will be discarded. • Hop counter = length of path from source to destination. • If sender does not know length than initialize the counter to worst case, the full diameter of subnet. Priyank bhojak (www.priyankbhojak.in) Priyank bhojak (www.priyankbhojak.in) • Flooding is not practical in most application but have some use… • Robustness : All lines will be covered • Optimality • Example: – In military applications, – In distributed database, – In wireless n/w • “If we ignore overhead of n/w , flooding always gives a shortest path” Priyank bhojak (www.priyankbhojak.in) Shortest path Routing • Idea : “ Build a graph of a subnet, with each node of the graph representing a router and each are of the graph representing a communication line“. • To choose a route between a given pair of routers, the algorithm just find Shortest path between them on the graph. • Measures for calculating path : – Number of hops – Geographical distance in kilometers. – Node labeling with queuing delay and transmission delay. – (Labels on arcs could be computed as a function of the distance , bandwidth, average traffic , communication cost , mean queuing delay , …). Priyank bhojak (www.priyankbhojak.in) • • • Dijkstra algorithm: Each node is labeled (in parentheses) with its distance from the source node along the best known path. Initially, no paths are known, so all nodes are labeled with infinity. As the algorithm proceeds and paths are found, • the labels may change , reflecting better paths. A label may be either tentative or permanent. • Initially, all labels are tentative. When it is discovered that a label represents the shortest possible path from the source to that node. • it is made permanent and never changed thereafter. Priyank bhojak (www.priyankbhojak.in) The shortest path from A to D is: ABEFHD Priyank bhojak (www.priyankbhojak.in) Example •1. PERFORM DJKSTRA’S ALGORITHM. •2. FIND LENGTH OF MINIMUM SPANNING TREE Priyank bhojak (www.priyankbhojak.in) Time for Innovation… • Develop an algorithm/Method to find shortest path except existing once. Priyank bhojak (www.priyankbhojak.in) Single path vs. Multi path Routing • “Number of Paths a router stores for a single destination” • Single path : – only one path for single destination. • Multi path algorithm : – Permits traffic multiplexing over multiple lines. – Provides better throughput and reliability. – Called as Load sharing Priyank bhojak (www.priyankbhojak.in) • An Autonomous System (AS) is a connected segment of a network topology that consists of a collection of subnetworks interconnected by a set of routes Inter domain and Intra domain Routing Priyank bhojak (www.priyankbhojak.in) Priyank bhojak (www.priyankbhojak.in) Distance Vector Routing • One of Famous Dynamic Routing Algorithm. • Also called as Distributed bellman-ford algo. And Ford fulkerson algorithms. • Used as RIP in internet • Here each router maintains a table giving a best known distance to each destination and line to use to get there • “I want to go Mumbai from Rajkot………than can you give me possible no. of lines I can use……………….!!!!!!” Priyank bhojak (www.priyankbhojak.in) Problem - Internet Priyank bhojak (www.priyankbhojak.in) Distance Vector Routing - Concept Priyank bhojak (www.priyankbhojak.in) Distance Vector Routing - Table Priyank bhojak (www.priyankbhojak.in) DVR – Table Distribution Priyank bhojak (www.priyankbhojak.in) Updating Routing Table - A Priyank bhojak (www.priyankbhojak.in) Final Routing Table Priyank bhojak (www.priyankbhojak.in) Example Priyank bhojak (www.priyankbhojak.in) Routing Algorithms Distance Vector Routing Distributed routing algorithm. Routers work together. 1. Each router maintains a table (vector) giving the best known distance to a destination and the line to use for sending there. Tables are updated by exchanging information with neighbors. 2. Each router knows the distance (cost) of reaching its neighbors (e.g. send echo requests). 3. Routers periodically exchange routing tables with each of their neighbors. 4. Upon receipt of an update, for each destination in its table, a router: – Compares the metric in its local table with the metric in the neighbor's table plus the cost of reaching that neighbor. – if the path via the neighbor has a lower cost, the router updates its local table to forward packets to the neighbor. Adaptive Algorithm Priyank bhojak (www.priyankbhojak.in) • Characteristics of Distance Vector routing protocols: Periodic updates • Periodic Updates sent at regular intervals (30 seconds for RIP and 90 Second for IGRP). Even if the topology has not changed in several days, Neighbors • The router is only aware of the network addresses of its own interfaces and the remote network addresses it can reach through its neighbors. It has no broader knowledge of the network topology Broadcast updates Broadcast Updates are sent to 255.255.255.255. Some distance vector routing protocols use multicast addresses instead of broadcast addresses. Entire routing table is included with routing update Entire Routing Table Updates are sent, periodically to all neighbors. Neighbors receiving these updates must process the entire update to find pertinent information and discard the rest. Priyank bhojak (www.priyankbhojak.in) Count to infinity Problem.. 1 A 1 B A's Routing Table to C via (next hop) B's Routing Table cost B C via to 2 (next hop) C cost C 1 - oo A 3 - oo now link B-C goes down C B 2 C C C - 2 oo C C C B C oo C 4 C oo 3 C 4 C oo Priyank bhojak (www.priyankbhojak.in) The count-to-infinity problem. Priyank bhojak (www.priyankbhojak.in) Count to Infinity • The reason for the count-to-infinity problem is that each node only has a “next-hop-view” • For example, in the first step, A did not realize that its route (with cost 2) to C went through node B Priyank bhojak (www.priyankbhojak.in) Solution • Solution 1: Always advertise the entire path in an update message (Path vectors) If routing tables are large, the routing messages require substantial bandwidth . BGP uses this solution • Solution 2: Never advertise the cost to a neighbor if this neighbor is the next hop on the current path (Split Horizon) – Example: A would not send the first routing update to B, since B is the next hop on A’s current route to C – Split Horizon does not solve count-to-infinity in all cases! Priyank bhojak (www.priyankbhojak.in) Link State Routing - Concept Priyank bhojak (www.priyankbhojak.in) Link State Algorithm 1. Each router is responsible for meeting its neighbors and learning their names. 2. Each router constructs a link state packet (LSP) which consists of a list of names and cost to reach each of its neighbors. 3. The LSP is transmitted to ALL other routers. Each router stores the most recently generated LSP from each other router. 4. Each router uses complete information on the network topology to compute the shortest path route to each destination node. Priyank bhojak (www.priyankbhojak.in) Link State Routing Each router must do the following: 1. Discover its neighbors, learn their network address. 2. Measure the delay or cost to each of its neighbors. 3. Construct Link State packet. (Generate LSP) 4. Send this packet to all other routers. ( Flooding Of LSP ) 5. Compute the shortest path to every other router. Priyank bhojak (www.priyankbhojak.in) Learning about the Neighbors A router knows its network interfaces ,just sends a HELLO packet on each point-to-point link, and the router at the other end must reply telling who it is with its unique network address Priyank bhojak (www.priyankbhojak.in) Measuring Line Cost • Simple, send an ECHO packet to the neighbor, measure the round-trip delay and divide it by two, and this will give a reasonable estimate of the actual delay Priyank bhojak (www.priyankbhojak.in) • Suppose that most of traffic from East-West is using line CF • Including queuing delay will make EI more attractive so when next routing table will be created most East-West traffic will now go to EI line. ……Consequently routing table may oscillate widely. • If we ignore load and consider only bandwidth than this problem will not occur and Load will be equally distributed. Priyank bhojak (www.priyankbhojak.in) Building Link State Packets (a) A subnet. subnet. (b) The link state packets for this Priyank bhojak (www.priyankbhojak.in) Distributing the Link State Packets • Flooding to distribute link state routing packet. •To keep track of flood , Each packet have unique sequence number. •Each router maintains list of (source, seq.number) pairs they saw. When a LSP arrives, it is checked against the list. • If it is new, it is forwarded on all lines except the one it arrived on; if it is a duplicate, it is discarded. • To safeguard against old data, link down etc., age is decremented once a second and every time it is forwarded by a router. When the age reaches zero, the LSP is discarded Priyank bhojak (www.priyankbhojak.in) • Problems : • 1 : If the sequence number wrap around. – Use 32 bit sequence number with one link state packet per second, it would take 137 years to wrap around. • 2 : If router ever crashes , it will lose track of its sequence number. If it starts again with 0 , the next packet will be rejected as a duplicate. • 3 : if sequence number will be corrupted. Priyank bhojak (www.priyankbhojak.in) Routing Algorithms Link State Routing In the new algorithm: 1. 2. 3. Each router maintains a database describing the topology and link delays between each router. That is, each router keeps track of the full graph of links and nodes. Each router periodically discovers it neighbors – Sends `hello' message on booting. – Measures the delays across its links (echo requests-should load be taken into account?), – Forwards that information to all other routers (link state packets). Avoids the count to infinity problem since all routers get each other router’s information. 4. Updates are propagated at high priority using flooding. – Updates contain sequence numbers, and a router forwards `new' copies of the packet. – Why use flooding? Because that way routing updates propagate even when routing tables aren't quite correct. – ACKs are sent to neighbors. 5. Each router uses an SPF algorithm to calculate shortest paths based on the current values in its database. 6. Because each router makes its calculation using the same information, better routing decisions are made. Adaptive Priyank bhojak (www.priyankbhojak.in) Algorithm OSPF: Open Shortest Path First Priyank bhojak (www.priyankbhojak.in) Figure 13-18 Areas in an autonomous system Priyank bhojak (www.priyankbhojak.in) Priyank bhojak (www.priyankbhojak.in) Hierarchical Routing • Problems in distance vector and link state: – Router have to store the information – If N/W size is more than one router can’t maintain entries for each node. • Hierarchical Routing : Routers are classified in Regions. Each routers have information about routers in same region only. • Routers save only one record about other region in their routing table. • Advantage : Efficiency of network improves. • In 2-level hierarchical routing , Each network is divided into regions and each region contain some routers. • In 3-level hierarchical routing , Each network is divided into clusters. Each clusters contains regions and region contains routers. Priyank bhojak (www.priyankbhojak.in) Hierarchical Routing Priyank bhojak (www.priyankbhojak.in) Advantage: Scaling. Each router needs less information (table space) to perform routing. Disadvantage: Sub optimal routes. The average path length increases because there may be a shorter path that bypasses the entry points, but we don't use it. Priyank bhojak (www.priyankbhojak.in) Time for Innovation • Prepare routing algorithm based on following criteria : – Link load. – Link bandwidth. – No. of packet transmitted. – Packet length – Ignore duplication – Ignore packet’s infinity in network. Priyank bhojak (www.priyankbhojak.in) Broadcast Routing • Broadcasting : Sending Packet simultaneously to all destinations – Weather report – Stock Market updates – Live radio programs • Methods : 1. 2. 3. 4. 5. Simple Method : • Problem : Bandwidth wastage as well as source need all destination address Flooding : • Problem : Consumes to much bandwidth Multidestination Routing Spanning tress Reverse path Routing Priyank bhojak (www.priyankbhojak.in) 3. Multidestination Routing • Host will generate packet containing all destination add. • When first router will receive a packet. Router will see all the destinations. • Based on that, router will decides possible output lines and generate same number of new copies of packet for each output line. • In that copies of packet router will add those destinations only which are coming on that line. • At last each packet will have only one destination. • Prob. : It will act like simple method only if all destinations are on same route. Priyank bhojak (www.priyankbhojak.in) 4.Spanning Trees • Spanning Trees : “Its subset of subnet that includes all the routers but contains no loop.” • Problem: Each router must know which of its line belong to spanning tree , Copy received broadcast packet onto all the spanning tree line except one packet arrived. Priyank bhojak (www.priyankbhojak.in) • Unlike flooding, broadcasting is done by specifying a special broadcast address on packets. Priyank bhojak (www.priyankbhojak.in) 5.Reverse path forwarding • Basic Idea : “I will broadcast packet only if I am receiving it through optimal path from source” • Assume normally when router A forwards packet to router B, it uses outgoing link that lies on sink tree rooted at B. This algorithm is remarkably simple: • When a broadcast packet arrives, router checks to see if the packet arrived on the line that is normally used for sending packets to the source of broadcast. If so, there is an excellent chance that the best route was used and this is the first copy to arrive at the router. • The router then forwards the packet onto all lines except the one it arrived on. If, however, the broadcast packet arrived on a line other than the preferred one for reaching the source, the packet is discarded as a likely duplicate Priyank bhojak (www.priyankbhojak.in) Reverse path forwarding. (a) A subnet. (b) a Sink tree. (c) The tree built by reverse path forwarding. Priyank bhojak (www.priyankbhojak.in) • For comparison (b) has source router I at the root of a sink tree. • All routers would normally send packets to the source router along the sink tree using the optimal path (e.g. I-B would follow I-F-D-C-B). • Using reverse path forwarding the path may differ from the sink tree, on receiving a broadcast packet from the source router on the usual channel, each router would forward packet on all channels except the one received under the assumption the receiving channel was optimal. • In this case was simply the reverse of the sink tree path normally used for sending to the packet source. • In diagram (c) H sends a packet to K but K expects to receive packets from M so the packet is discarded rather than forwarded. • The optimal case using the sink tree requires a maximum of 4 hops maximum (I-N-M-K-L) and 14 total packets. • Using reverse path forwarding requires a maximum of 5 hops (4 for I-N-MK-L plus 1 to B) and 23 total packets with the extra, duplicate packets sent to the leaf nodes. Priyank bhojak (www.priyankbhojak.in) Reverse path forwarding Example • A node N forwards packet if it arrived on shortest path between N and source B, C, D, E and F receives one or two redundant packets! Priyank bhojak (www.priyankbhojak.in) Multicast Routing • Sending message to some particular group is called multicast routing – Example : yahoo groups , Gmail groups…. • Routing algorithm for this is called multicast routing algorithm. • Multicasting : – Creating and destroying groups – To allow processes to join or leave the group • Router must know , which host belongs to which group. – Each router computes spanning tree for covering all other router. – When process sends multicast packet to a group , first router examines its spanning tree and prunes it and removes all other lines. • When very large network is there : low efficiency Priyank bhojak (www.priyankbhojak.in) (a) A network. (b) A spanning tree for the leftmost router. (c) A multicast tree for group 1. (d) A multicast tree for group 2. Priyank bhojak (www.priyankbhojak.in) Routing for mobile host • Mobile host : Hosts that are away from home and still want to be connected. A WAN to which LANs, MANs, and wireless cells are attached. Priyank bhojak (www.priyankbhojak.in) Registration procedure • 1. Periodically, Foreign agent broadcasts a packet announcing its existence and address. – Mobile host sees message , if none arrives quickly enough ,the mobile host can broadcast a packet saying : Are there any foreign agents around? • 2. Mobile hosts register with the foreign agent – Gives its home address , current data link layer address and some security information. • 3. Foreign agent contacts home agent and inform that “one of your host is here”. M – Message contains foreign agents network address. • 4. Home agent examines the security information, if it is happy, it tells the foreign agent to proceed. • 5. When foreign agent gets the acknowledgement from home agent , it makes and entry in its table and informs mobile host that it is now connected Priyank bhojak (www.priyankbhojak.in) Routing in Ad Hoc Networks • Possibilities when the routers are mobile: 1. Military vehicles on battlefield. – No infrastructure. 2. A navy ships at sea. – All moving all the time 3. Emergency works at earthquake . – The infrastructure destroyed. 4. A gathering of people with notebook computers. – In an area lacking 802.11. Priyank bhojak (www.priyankbhojak.in)
© Copyright 2024