2.26k likes | 2.28k Views
Explore dynamic routing in networks, including concepts like convergence, routing hierarchy, and routing protocols like OSPF and BGP. Learn about routing decisions, forwarding tables, and the interplay between routing and forwarding in IP networks.
E N D
Dynamic Routing Overview
Automatically detect and adapt to topology changes Provide optimal routing Scalability Robustness Simplicity Rapid convergence Some control of routing choices E.g. which links we prefer to use Desirable Characteristics of Dynamic Routing
Interplay between routing & forwarding routing algorithm local forwarding table header value output link 0100 0101 0111 1001 3 2 2 1 value in arriving packet’s header 1 0111 2 3
IP Routing – finding the path • Path is derived from information received from the routing protocol • Several alternative paths may exist • best next hop stored in forwarding table • Decisions are updated periodically or as topology changes (event driven) • Decisions are based on: • topology, policies and metrics (hop count, filtering, delay, bandwidth, etc.)
Convergence is when all the routers have a stable view of the network When a network is not converged there is network downtime Packets don’t get to where they are supposed to go Black holes (packets “disappear”) Routing Loops (packets go back and fore between the same devices) Occurs when there is a change in status of router or the links Convergence – why do I care?
Internet Routing Hierarchy • The Internet is composed of Autonomous Systems • Each Autonomous System is an administrative entity that • Uses Interior Gateway Protocols (IGPs) to determine routing within the Autonomous System • Uses Exterior Gateway Protocols (EGPs) to interact with other Autonomous Systems
Internet Routing Architecture Autonomous System (AS) Autonomous System (AS) Autonomous System (AS) Autonomous System (AS) Autonomous System (AS) Autonomous System: A collection of IP subnets and routers under the same administrative authority. Interior Routing Protocol Exterior Routing Protocol
Four well known IGPs today RIP EIGRP OSPF ISIS Interior Gateway Protocols
One single de-facto standard: BGP Exterior Gateway Protocols
Routing’s 3 Aspects • Acquisition of information about the IP subnets that are reachable through an internet • static routing configuration information • dynamic routing information protocols (e.g., BGP4, OSPF, RIP, ISIS) • each mechanism/protocol constructs a Routing Information Base (RIB)
Routing Aspect #2 • Construction of a Forwarding Table • synthesis of a single table from all the Routing Information Bases (RIBs) • information about a destination subnet may be acquired multiple ways • a precedence is defined among the RIBs to arbitrate conflicts on the same subnet • Also called a Forwarding Information Base (FIB)
Routing #3 • Use of a Forwarding Table to forward individual packets • selection of the next-hop router and interface • hop-by-hop, each router makes an independent decision
Routing versus Forwarding • Routing = building maps and giving directions • Forwarding = moving packets between interfaces according to the “directions”
IP Forwarding • Forwarding decisions: • Destination address • class of service (fair queuing, precedence, others) • local requirements (packet filtering) Source S IP Subnet IP Subnet IP Subnet Destination IP Subnet D
Routing Tables Feed the Forwarding Table BGP 4 Routing Table Routing Information Base (RIB) Forwarding Information Base (FIB) ISIS – Link State Database Static Routes
RIB Construction • Each routing protocol builds its own Routing Information Base (RIB) • Each protocol has its own “view” of “costs” • e.g., ISIS is administrative weights • e.g., BGP4 is Autonomous System path length
FIB Construction • There is only ONE forwarding table! • An algorithm is used to choose one next-hop toward each IP destination known by any routing protocol • the set of IP destinations present in any RIB are collected • if a particular IP destination is present in only one RIB, that RIB determines the next hop forwarding path for that destination
FIB Construction • Choosing FIB entries, cont.. • if a particular IP destination is present in multiple RIBs, then a precedence is defined to select which RIB entry determines the next hop forwarding path for that destination • This process normally chooses exactly one next-hop toward a given destination • There are no standards for this; it is an implementation (vendor) decision
FIB Contents • IP subnet and mask (or length) of destinations • can be the “default” IP subnet • IP address of the “next hop” toward that IP subnet • Interface id of the subnet associated with the next hop • Optional: cost metric associated with this entry in the forwarding table
IP routing • Default route • where to send packets if there is no entry for the destination in the routing table • most machines have a single default route • often referred to as a default gateway • 0.0.0.0/0 • matches all possible destinations, but is usually not the longest match
IP route lookup:Longest match routing Most of 10.0.0.0/8 except for 10.1.0.0/16 R3 Packet: Destination IP address: 10.1.1.1 R4 R2 R1 10.1.0.0/16 Based on destination IP address R2’s IP forwarding table 10.0.0.0/8 R3 10.1.0.0/16 R4 20.0.0.0/8 R5 0.0.0.0/0 R1
IP route lookup:Longest match routing Most of 10.0.0.0/8 except for 10.1.0.0/16 R3 Packet: Destination IP address: 10.1.1.1 R4 R2 R1 10.1.0.0/16 Based on destination IP address R2’s IP forwarding table 10.0.0.0/8 R3 10.1.0.0/16 R4 20.0.0.0/8 R5 0.0.0.0/0 R1 10.1.1.1 & FF.00.00.00 vs. 10.0.0.0 & FF.00.00.00 Match! (length 8)
IP route lookup:Longest match routing Most of 10.0.0.0/8 except for 10.1.0.0/16 R3 Packet: Destination IP address: 10.1.1.1 R4 R2 R1 10.1.0.0/16 Based on destination IP address R2’s IP forwarding table 10.0.0.0/8 R3 10.1.0.0/16 R4 20.0.0.0/8 R5 0.0.0.0/0 R1 10.1.1.1 & FF.FF.00.00 vs. 10.1.0.0 & FF.FF.00.00 Match! (length 16)
IP route lookup:Longest match routing Most of 10.0.0.0/8 except for 10.1.0.0/16 R3 Packet: Destination IP address: 10.1.1.1 R4 R2 R1 10.1.0.0/16 Based on destination IP address R2’s IP forwarding table 10.0.0.0/8 R3 10.1.0.0/16 R4 20.0.0.0/8 R5 0.0.0.0/0 R1 10.1.1.1 & FF.00.00.00 vs. 20.0.0.0 & FF.00.00.00 No Match!
IP route lookup:Longest match routing Most of 10.0.0.0/8 except for 10.1.0.0/16 R3 Packet: Destination IP address: 10.1.1.1 R4 R2 R1 10.1.0.0/16 Based on destination IP address R2’s IP forwarding table 10.0.0.0/8 R3 10.1.0.0/16 R4 20.0.0.0/8 R5 0.0.0.0/0 R1 10.1.1.1 & 00.00.00.00 vs. 0.0.0.0 & 00.00.00.00 Match! (length 0)
IP route lookup:Longest match routing Most of 10.0.0.0/8 except for 10.1.0.0/16 R3 Packet: Destination IP address: 10.1.1.1 R4 R2 R1 10.1.0.0/16 Based on destination IP address R2’s IP forwarding table 10.0.0.0/8 R3 10.1.0.0/16 R4 20.0.0.0/8 R5 0.0.0.0/0 R1 This is the longest matching prefix (length 16). “R2” will send the packet to “R4”.
IP route lookup:Longest match routing • Most specific/longest match always wins!! • Many people forget this, even experienced ISP engineers • Default route is 0.0.0.0/0 • Can handle it using the normal longest match algorithm • Matches everything. Always the shortest match.
5 3 5 2 2 1 3 1 2 1 x z w u y v Graph abstraction Graph: G = (N,E) N = set of routers = { u, v, w, x, y, z } E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) } Path: Sequence of edges (routers) Remark: Graph abstr. is useful in other network contexts Example: P2P, where N is set of peers and E is set of TCP connections
5 3 5 2 2 1 3 1 2 1 x z w u y v Graph abstraction: costs • c(x,x’) = cost of link (x,x’) • e.g., c(w,z) = 5 • cost can be always 1, or • inversely related to bandwidth, • inversely related to congestion Cost of path (x1,x2,x3,…,xp) = c(x1,x2)+c(x2,x3)+…+c(xp-1,xp) Question: What’s the least-cost path between u and z ? Routing algorithm: alg. that finds “good” path (typically: least cost path)
Distance Vector and Link State • Distance Vector • Accumulates a metric hop-by-hop as the protocol messages traverse the subnets • Link State • Builds a network topology database • Computes best path routes from current node to all destinations based on the topology
Distance Vector Protocols • Each router only advertises to its neighbors, its “distance” to various IP subnets • Each router computes its next-hop routing table based on least cost determined from information received from its neighbors and the cost to those neighbors
Distance Vector Algorithm Bellman-Ford Equation Define dx(y) := cost of least-cost path from x to y Then dx(y) = min {c(x,v) + dv(y) } where min is taken over all neighbors v of x v
5 3 5 2 2 1 3 1 2 1 x z w u y v Bellman-Ford example Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3 Bellman-Ford equation says: du(z) = min { c(u,v) + dv(z), c(u,x) + dx(z), c(u,w) + dw(z) } = min {2 + 5, 1 + 3, 5 + 3} = 4 Node that yields minimum is next hop in shortest path ➜ forwarding table
Distance Vector RIB Parameters • Accumulated cost • cost is a constant administrative assignment for each subnet • assignment is typically “1” for each subnet (equivalent to hop-count) • included in routing protocol exchange • Time the update was received(for timeout)
Distance Vector RIB Parameters • The next-hop the entry was received from • sender’s id is included in routing protocol exchange • Accumulated Hop count and Maximum Hop Count • used to detect cycles • hop count included in routing protocol exchange
Distance Vector: Additions • When a router learns of new reachable subnets • at router startup • when an interface in enabled or restored to service • A routing update is broadcast to all neighbors
Distance Vector: Additions • Any router receiving the packet compares the cost it received in the new packet with that in its RIB • If the cost is smaller or the subnet is new • the new entry is used in the RIB • the new entry is broadcast to all its neighbors (except the one from which it was received)
Distance Vector: Removals • Each RIB entry is aged • a timeout defines when an entry is removed from the RIB • Periodically, each router re-advertises all the routes it knows to its neighbors • this can be done in many ways: from simple neighbor hellos to enumeration of all routes
Distance Vector: Removals • If a neighbor does not respond within a timeout, all routes learned from that neighbor are removed • Route removal may be advertised to neighbors
Distance Vector Algorithm (2) • Dx(y) = estimate of least cost from x to y • Distance vector: Dx = [Dx(y): yє N ] • Node x knows cost to each neighbor v:c(x,v) • Node x maintains Dx = [Dx(y): yє N ] • Node x also maintains its neighbors’ distance vectors • For each neighbor v, x maintains Dv = [Dv(y): yє N ]
Distance Vector Algorithm (3) Basic idea: • Each node periodically sends its own distance vector estimate to neighbors • When a node x receives new DV estimate from neighbor, it updates its own DV using B-F equation: Dx(y) ←minv{c(x,v) + Dv(y)} for each node y∊ N • Under “natural” conditions the estimates of Dx(y) converge to the actual least cost dx(y)
Iterative, asynchronous: each local iteration caused by: local link cost change DV update message from neighbor Distributed: each node notifies neighbors only when its Distance Vector changes neighbors then notify their neighbors if necessary wait for (change in local link cost of msg from neighbor) recompute estimates if Distance Vector to any dest has changed, notify neighbors Distance Vector Algorithm (4) Each node:
Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} = min{2+1 , 7+0} = 3 Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2 cost to x y z node x table x 0 2 7 cost to cost to y x y z from ∞ ∞ ∞ x y z z ∞ ∞ ∞ x 0 2 3 x 0 2 3 y from 2 0 1 y from 2 0 1 2 1 z 7 1 0 z 3 1 0 node y table cost to cost to 7 cost to x y z x y z x y z x ∞ x 0 2 7 ∞ ∞ 2 0 1 x 0 2 3 y y from z 2 0 1 y from from 2 0 1 x y z z ∞ ∞ ∞ 7 1 0 z 3 1 0 node z table cost to cost to cost to x y z x y z x y z x 0 2 7 x 0 2 3 x ∞ ∞ ∞ y y 2 0 1 from from y 2 0 1 from ∞ ∞ ∞ z z z 3 1 0 3 1 0 7 1 0 time
1 4 1 50 x z y Distance Vector (DV): link cost changes Link cost changes: • node detects local link cost change • updates routing info, recalculates distance vector • if DV changes, notify neighbors At time t0, y detects the link-cost change, updates its DV, and informs its neighbors. At time t1, z receives the update from y and updates its table. It computes a new least cost to xand sends its neighbors its DV. At time t2, y receives z’s update and updates its distance table. y’s least costs do not change and hence ydoes not send any message to z. “good news travels fast”
1 4 1 cost to cost to cost to cost to 50 x y z x y z x y z x y z x x x x from from y y 1 0 1 1 0 1 from from y y 4 0 1 4 0 1 z x y z z 5 1 0 5 1 0 z z 5 1 0 2 1 0 cost to cost to x y z x y z x x y y 1 0 1 1 0 1 from from z z 5 1 0 2 1 0 node y table 1 node ztable 2 time
x z y Distance Vector: link cost changes 60 • Link cost changes: • good news travels fast • bad news travels slow 4 1 50
60 4 1 cost to cost to cost to cost to 50 x y z x y z x y z x y z x x x x from from y y 6 0 1 6 0 1 from from y y 4 0 1 4 0 1 z x y z z 5 1 0 5 1 0 z z 7 1 0 5 1 0 cost to cost to x y z x y z x x y y 6 0 1 6 0 1 from from z z 7 1 0 5 1 0 Dy(x) = min{c(y,x) + Dx(x), c(y,z) + Dz(x)} = min{60 + 0 , 1 + 7} = 8 Dy(x) = min{c(y,x) + Dx(x), c(y,z) + Dz(x)} = min{60 + 0 , 1 + 5} = 6 node y table 6 8 node z table 7 time
60 4 1 50 x z y Distance Vector: link cost changes Link cost changes: • good news travels fast • bad news travels slow – “count to infinity” problem! • 44 iterations before algorithm stabilizes. Poisoned reverse: • If Z routes through Y to get to X : • Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z) • will this completely solve count to infinity problem?
C u v D A B w x z y RIP (Routing Information Protocol) • Distance vector algorithm • Included in BSD-UNIX Distribution in 1982 • Distance metric: # of hops (max = 15 hops) From router A to subsets: destinationhops u 1 v 2 w 2 x 3 y 3 z 2
RIP advertisements • Distance vectors: exchanged among neighbors every 30 sec via Response Message (also called advertisement) • Each advertisement: list of up to 25 destination nets within AS