560 likes | 651 Views
CS 352 Internet Technology Routing. Richard Martin Dept. of Computer Science Rutgers University. www.btechebooks4u.blogspot.com. Forwarding vs Routing. Routing is the decision which path to take Forwarding is the lookup once the decision has been made
E N D
CS 352Internet TechnologyRouting Richard Martin Dept. of Computer Science Rutgers University www.btechebooks4u.blogspot.com
Forwarding vs Routing • Routing is the decision which path to take • Forwarding is the lookup once the decision has been made • These functions are typically decoupled in real systems www.btechebooks4u.blogspot.com
Routing Algorithms • A routing algorithm decides which output link an incoming packet should be transmitted on • A routing “table” contains the mappings from the networks and host addresses to output ports on the router • The routing algorithm builds this “table” www.btechebooks4u.blogspot.com
Forwarding • A forwarding algorithm performs the lookup of address to output port • In connection-oriented service, the forwarding algorithm is performed by switches and only during connection setup • In connectionless service, the forwarding algorithm is performed by routers every time a packet arrives www.btechebooks4u.blogspot.com
Example Routing Table remus:/ug/u1/rmartin%netstat -rn Routing Table: Destination Gateway Flags Ref Use Interface -------------------- -------------------- ----- ----- ------ -------- 128.6.13.0 128.6.13.3 U 3 4259 hme0 224.0.0.0 128.6.13.3 U 3 0 hme0 default 128.6.13.21 UG 02184931 127.0.0.1 127.0.0.1 UH 0 346400 lo0 www.btechebooks4u.blogspot.com
Routing Algorithms • Two types of routing algorithms: • Non-Adaptive Routing Algorithms • Adaptive Routing Algorithms • Hierarchical Routing is used to make these algorithms scale to large networks www.btechebooks4u.blogspot.com
Non-Adaptive Routing Algorithms • Non-adaptive routing algorithms do not base their routing decisions on the current state of the network • Examples: • Flooding • Shortest Path Routing www.btechebooks4u.blogspot.com
Flooding Algorithm • Every incoming packet is sent out on every outgoing line except the one it arrived on • No routing table, no lookup! • Problem: Vast number of duplicated packets
Reducing Flooding Algorithm’s Duplicate Packets • Solution 1: Hop counter • Have a hop counter in the packet header • Routers decrement each arriving packet’s hop counter • Routers discard a packet with hop count=0 • Ideally, the hop counter should be initialized to the length of the path from the source to the destination • Hop count defines the “Horizon” of the packet, which is how far a node can “see”. www.btechebooks4u.blogspot.com
Reducing Flooding Algorithm’s Duplicate Packets (cont’d) • Solution 2: Sequence Numbers • Require the first router hop to put a sequence number in each packet it receives from its hosts • Each router maintains a table listing the sequence numbers it has seen from each first-hop router. The router can then discard packets it has already seen. www.btechebooks4u.blogspot.com
Flooding Uses • Used in small networks or limited horizon • order 100’s of nodes • Military A pplications • Large number of routers is desirable • If one router is taken out (by a bomb?) flooding will still get packets to their destinations • Distributed Databases • Simultaneous updates of multiple databases can be done with a single packet transmission • Gnutella search is an example, uses horizon www.btechebooks4u.blogspot.com
Shortest Path Routing • For a pair of communicating hosts, there is a shortest path between them • Shortness may be defined by: • Number of router/switch hops • Geographic distance • Link delay
Shortest Path What is the shortest path between A and F? 2 B 3 4 D F 1 A 2 2 1 C E 3 Edge Weight (Distance) www.btechebooks4u.blogspot.com
Computing the Shortest Path • Dijkstra’s Shortest Path Algorithm: • Step 1: Draw nodes as circles. Fill in a circle to mark it as a “permanent node.” • Step 2: Set the current node equal to the source node • Step 3: For the current node: • Mark the cumulative distance from the current node to each non-permanent adjacent node. Also mark the name of the current node. Erase this marking if the adjacent node already has a shorter cumulative distance marked • Mark the non-permanent node with the shortest listed cumulative distance as permanent and set the current node equal to it. Repeat step 3 until all nodes are marked permanent.
Selected edge Candidate edge Not visited Dijskstra’s Shortest Path AlgorithmExample 7 B C 2 3 2 3 2 A E F D 1 2 2 4 4 G H www.btechebooks4u.blogspot.com
Selected edge Candidate edge Not visited Dijskstra’s Shortest Path AlgorithmExample 7 B C 2 3 2 3 2 A E F D 1 2 2 6 4 G H
Selected edge Candidate edge Not visited Dijskstra’s Shortest Path AlgorithmExample 7 B C 2 3 2 3 2 A E F D 1 2 2 6 4 G H www.btechebooks4u.blogspot.com
Dijskstra’s Shortest Path AlgorithmExample 7 B C 2 3 2 3 2 A E F D 1 2 2 6 4 G H Selected edge Candidate edge Not visited
Selected edge Candidate edge Not visited Dijskstra’s Shortest Path AlgorithmExample 7 B C 2 3 2 3 2 A E F D 1 2 2 6 4 G H www.btechebooks4u.blogspot.com
Shortest Path Routing (cont’d) • Non-adaptive, if: • geographical distances are used as edge weights • maximum link throughputs are used as edge weights • Number of IMP hops are used as edge weights www.btechebooks4u.blogspot.com
Adaptive Routing Algorithms • Problems with non-adaptive algorithms • If traffic levels in different parts of the subnet change dramatically and often, non-adaptive routing algorithms are unable to cope with these changes • Lots of computer traffic is bursty, but non-adaptive routing algorithms are usually based on average traffic conditions • Adaptive routing algorithms can deal with these situations
Adaptive Routing Algorithms(cont’d) • Three Types: • Centralized Adaptive Routing • Isolated Adaptive Routing • Distributed Adaptive Routing www.btechebooks4u.blogspot.com
Centralized Adaptive Routing • Routing table adapts to network traffic • A routing control center is somewhere in the network • Periodically, each router forwards link status information to the control center • The center can, with Dijkstra’s shortest path algorithm, compute the best routes • Best routes are dispatched to each router www.btechebooks4u.blogspot.com
Problem with Centralized Algorithms • Vulnerability • If the control center goes down, routing becomes non-adaptive • Scalability • The control center must handle a great deal of routing information, especially for larger networks
Isolated Adaptive Routing Algorithms • Routing decisions are made only on the basis of information available locally in each router • Examples: • Hot Potato • Backward Learning www.btechebooks4u.blogspot.com
Hot Potato Routing • When a packet arrives, the router tries to get rid of it as fast as it can by putting it on the output line that has the shortest queue • Hot potato does not care where the output line leads • Not very effective www.btechebooks4u.blogspot.com
Backward Learning Routing • Packet headers include destination and source addresses. They also include a hop counter • Network nodes, initially ignorant of network topology, acquire knowledge of the network state as packets are handled www.btechebooks4u.blogspot.com
Backward Learning • Algorithm: • Routing is originally random • A packet with a hop count of one is from a directly connected node; thus, neighboring nodes are identified with their connecting links • A packet with a hop count of two is from a source two hops away, etc. • As packets arrive, the router compares the hop count for a given source address with the minimum hop count already registered; if the new one is less, it is substituted for the previous one
Distributed Routing Algorithms • Each router periodically exchanges routing information (e.g., estimated time delay, queue length, etc.) with its neighbors • Examples: • Distance Vector Routing • Link State Routing www.btechebooks4u.blogspot.com
Distance Vectors • Each router maintains lists of best-known distances to all other known routers. These lists are called “vectors.” • Each router is assumed to know the exact distance (in delay, hop count, etc.) to other routers directly connected to it. • Periodically, vectors are exchanged between adjacent routers, and each router updates its vectors. www.btechebooks4u.blogspot.com
Convergence Speed • Supposed all routers know the current state of the network • Next, a change in link-status happens • How fast the routers learn new state of the network is the “convergence” speed www.btechebooks4u.blogspot.com
Problem: Count-to-Infinity • With distance vector routing, links coming on line converge quickly but link failures converge slowly • This problem for DV routing algorithms is call “count-to-infinity”
Count-to-Infinity A B C D E 1 2 3 4 Initially 3 2 3 4 After 1 exchange 3 4 3 4 After 2 exchanges 5 4 5 4 After 3 exchanges 5 6 5 6 After 4 exchanges 7 6 7 6 After 5 exchanges etc… to infinity www.btechebooks4u.blogspot.com
Split Horizon • Insight: It’s not useful to claim reachablility for a destination to the neighbor from which the route was learned • Don’t report routes back to node from which the route was learned • E.g. If I hear from X has the shortest route to Y, don’t report to X I have a route to Y www.btechebooks4u.blogspot.com
Poison Reverse • Not reporting a route means having to wait for a timeout • Report “split-horizon” routes as infinity to break loops on the first routing exchange. www.btechebooks4u.blogspot.com
Split Horizon with Poisoned Reverse A B C D E inf. 2 3 4 B learns A is dead C reports to B that A’s metric is inf. inf. inf. 2 3 4 inf. inf. 3 4 After 1 exchange inf. inf. inf. 4 After 2 exchanges inf. inf. inf. inf. After 3 exchanges
Split Horizon Failure B A If D goes down, A and B will still count to infinity. Split-Horizon infinity messages are sent from A->C and B->C, not A<->B C D www.btechebooks4u.blogspot.com
Link State Routing • Each router measures the distance (in delay, hop count, etc.) between itself and its adjacent routers • The router builds a packet containing all these distances. The packet also contains a sequence number and an age field. • Each router distributes these packets using flooding • Each router builds map of the entire network, uses a shortest-path algorithm
Link State Routing (cont’d) • To control flooding, the sequence numbers are used by routers to discard flood packets they have already seen from a given router • The age field in the packet is an expiration date. It specifies how long the information in the packet is good for. • Once a router receives all the link state packets from the network, it can reconstruct the complete topology and compute a shortest path between itself and any other node using Dijsktra’s algorithm. www.btechebooks4u.blogspot.com
Hierarchical Routing • All routing algorithms have difficulties as the network becomes large • For large networks, the routing tables grow very quickly, and so does the number of flood packets • How can this be reduced? Hierarchical routing
Hierarchical Routing (cont’d) • Segment the network into regions • Routers in a single region know all the details about other routers in that region, but none of the details about routers in other regions • Analogy: Telephone area codes www.btechebooks4u.blogspot.com
Hierarchical Routing (cont’d) www.btechebooks4u.blogspot.com
RIP • Route Information Protocol • One of the routing algorithms used by the Internet • Based on distance vector routing • Did not scale well • suffered the count-to-infinity problem • weak security • RIP is phased out for large backbones • but still widely used for smaller networks www.btechebooks4u.blogspot.com
OSPF • Open Shortest Path First • Routing algorithm now used in the Internet • OSPF uses the Link State Routing algorithm with modifications to support: • Multiple distance metrics (geographical distance, delay, throughput) • Support for real-time traffic • Hierarchical routing • Security
OSPF (cont’d) • OSPF divides the network into several hierarchies: • Autonomous Systems (AS’s) • groups of subnets • Areas • Groups of routers within an AS • Backbone Areas • Groups of routers that connect other areas together www.btechebooks4u.blogspot.com
OSPF (cont’d) Autonomous System Backbone Area Area Area Autonomous System Area Backbone Area Area Area
OSPF (cont’d) • Routers are distinguished by the functions they perform • Internal routers • Only route packets within one area • Area border routers • Connect to areas together • Backbone routers • Reside only in the backbone area • AS boundary routers • Routers that connect to a router outside the AS www.btechebooks4u.blogspot.com
OSPF: Modified Link State Routing • Recall: • In link state routing, routers flood their routing information to all other routers in the network • In OSPF, routers only send their information to “adjacent routers”, not to all routers. • Adjacent does NOT mean nearest-neighbor in OSPF • One router in each area is marked as the “designated router” • Designated routers are considered adjacent to all other routers in the area • OSPF combines link state routing with centralized adaptive routing