450 likes | 597 Views
Forwarding vs. Routing. Forwarding vs Routing forwarding: To select an output port based on destination address and routing table routing: Process by which routing table is built Based on graph algorithms. Goal.
E N D
Forwarding vs. Routing • Forwarding vs Routing • forwarding: • To select an output port based on destination address and routing table • routing: • Process by which routing table is built • Based on graph algorithms
Goal • Determine “good” path (sequence of routers) thru network from source to destination • “good” path: • typically means minimum cost path • other definitions possible (available path)
Graph Abstraction Graph abstraction for routing algorithms: • Graph nodes are routers • Graph edges are physical links • link cost • Delay • $ cost, or • Congestion level
Factors • Factors • Static factor • Topology (does not change frequently) • Dynamic • load (link cost): changes with network traffic
Next-Hop Forwarding Table for Router R2 Destination Next Hop A interface 1 B interface 1 C interface 2 D interface 2 E computer E F computer F • Performed by router • Uses table of routes • Tables gives next hop E R1 R2 R3 A C B F D Interface 1 Interface 2
Source of Routing Table Information • Manual • Table created by hand • Useful in small networks • Useful if routes never change • Automatic routing • Software creates/updates routing table • Needed in large networks • Changes routes when failure occurs
Relationship of Routing To Graph Theory 1 2 • Node models router • Edge model connection 3 4 Table forNode 1:Table for Node 2: Table forNode 3:Table for Node 4: Dest NextHopDest NextHopDest NextHopDest NextHop 1 - 1 (2, 3) 1 (3, 1) 1 (4, 3) 2 (1, 3) 2 - 2 (3, 2) 2 (4, 2) 3 (1, 3) 3 (2, 3) 3 - 3 (4, 3) 4 (1, 3) 4 (2, 4) 4 (3, 4) 4 -
Shortest Path Computation • Algorithms from graph theory • No central authority (distributed computation) • A router (automatic routing) • Must learn route to each destination • Only communicates with directly attached neighbors
Algorithms For Computing Shortest Paths • Distance- sum of weights along the path to the destination Two Algorithms: • Distance Vector (DV) • Routers exchange information in their routing tables • Link-state • Routers exchange link status information • Both used in practice
Overview of Distance Vector Algorithm • Periodic, two-way exchange between neighbors • During exchange, router sends • List of pairs • Each pair gives (destination, distance) • Receiver • Compares each item in list to local routes • Changes routes if better path exists
Distance Vector Intuition • Let • N be neighbor that sent the routing message • V be destination in a pair • D be distance in a pair • C be D plus the cost to reach the sender • If no local route to V or local route has cost > C • install a route with next hop N and cost C • Else • ignore pair
Example of Distance Vector Routing 3 11 1 2 3 4 6 • Consider transmission of one DV message • Node 2 sends to 3, 5, and 6 • Node 6 installs cost 8 to route to 2 • Later 3 sends update to 6 • 6 changes route to make 3 the next hop for destination 2 9 3 8 2 5 5 6 7
More Detail on Distance Vector • Each node maintains a set of triples • (Destination, Cost, NextHop) • Exchange updates directly connected neighbors • periodically (on the order of several seconds) • whenever table changes (called triggeredupdate) • Each update is a list of pairs: • (Destination, Cost) • Update local table if receive a “better” route • smaller cost • came from next-hop • Refresh existing routes; delete if they time out
Example • Cost = HopCount Destination Cost NextHop A 1 A C 1 C D 2 C E 2 A F 2 A G 3 A Final Routing Table for B
Distance Vector Algorithm Given: a local routing table, a weight for each link that connects to another router, and an incoming routing message Compute: an updated routing table Method: Maintain a distancefield in each routing table entry; Initialize routing table with a single entry that has the destination equal to the local router, the next-hop unused, and the distance to zero; Repeatforever { wait for the next routing message to arrive over the network from a neighbor; Let N be the sending router; for each entry in the message { Let V be the destination in the entry and let D be the distance; Compute C as D plus the weight assigned to the link over which the message arrived; Examine and update the local routing table: if (no route exists to V) add an entry to the local routing table for destination V with next-hop N and distance C; else if (a route exists that has next-hop N) replace the distance in existing route with C; else if (a route exists with distance greater than C) change the next-hop to N and distance to C; }
Routing Loop Example that terminates (DV) • Suppose, F detects that link to G has failed • F sets distance to G to infinity and sends update to A • A sets distance to G to infinity since it uses F to reach G • A receives periodic update from C with 2-hop path to G • A sets distance to G to 3 and sends update to F • F decides it can reach G in 4 hops via A Note that the system becomes stable at end
Routing Loop Example • Suppose, link from A to E fails • A advertises distance of infinity to E, but B and C advertise a distance of 2 to E • Depending on the exact timing of events, the following might happen: • Upon hearing that E can be reached in 2 hops from C, B decides it can reach E in 3 hops; advertises this to A • A decides it can reach E in 4 hops; advertises this to C • C decides that it can reach E in 5 hops; and so on. • This cycle stops when the distances to E reach a very large number considered as infinity • Known as count-to-infinity problem
Loop-Breaking Heuristics • Solution 1 • Use a small number as an approximation of infinity (Example: Set infinity to 16) • Will limit the time to count to infinity • Solution 2 • When a node sends a routing update to its neighbors, it does not send those routes it learned from each neighbor back to that neighbor • Example: If B has the route (E, 2, A) in its table, then it knows it must have learned this route from A, and so whenever B sends a routing update to A, it does not include the route (E, 2) in that update • Known as split horizon • Solution 3 • Split horizon with poison reverse (stronger variation of split horizon) • Example: B actually sends that route back to A, but it puts negative information in the route to ensure that A will not eventually use B to get to E. • Last two solutions only work for routing loops that involve two nodes
RIP: Routing Information Protocol • Uses straightforward implementation of distance-vector routing algorithm • It supports multiple address families • Most widely used routing protocols in IP networks • Distributed with BSD version of Unix • A router running RIP: • sends its advertisement every 30 seconds • sends an update message whenever an update from another router causes it to change its routing table • Usage limited to small networks - those with no paths longer than 15 hops
Link-State Routing (LS Routing) • Overcomes instabilities in DV • Pairs of routers periodically: • Test link between them • Broadcast link status message i.e., send to all nodes (not just neighbors) information about directly connected links (not entire routing table); Also known as flooding • Router • Receives status messages on links • Computes new routes • Uses Dijkstra's algorithm
Example of Link-State Information 3 11 1 2 3 4 6 9 3 8 2 • Assume nodes 2 and 3 • Test link between 2 and 3 • Broadcast information • Each node • Receives information • Re-computes routes as needed 5 5 6 7
Link State Packet (LSP) • Link State Packet (LSP) • id of the node that created the LSP • cost of link to each directly connected neighbor • sequence number (SEQNO) • time-to-live (TTL) for this packet
Reliable flooding • Store most recent LSP from each node • A smaller sequence number would imply an older LSP and would be discarded • Forward LSP to all nodes but one that sent it • It helps to bring an end to the flooding of an LSP • Generate new LSP periodically • increment SEQNO • Start SEQNO at 0 when reboot • Decrement TTL of each stored LSP • discard when TTL=0 • Transmission of LSPs is made reliable using acks and retransmissions just as in the link-layer protocol
Dijkstra's Shortest Path Algorithm • Input • Graph with weighted edges • Node, n • Output • Set of shortest paths from n to each node • Cost of each path • Called Shortest Path First (SPF) algorithm
Algorithm Intuition • Start with self as source node • Move outward • At each step • Find node u such that it • Has not been considered • Is "closest" to source • Compute • Distance from u to each neighbor v • If distance shorter, make path from u go through v
Result of Dijkstra’s Algorithm 3 11 1 2 3 4 6 9 3 8 2 • Example routes from node 6 • To 3, next hop = 3, cost = 2 • To 2, next hop = 3, cost = 5 • To 5, next hop = 3, cost = 11 • To 4, next hop = 7, cost = 8 5 5 6 7
Dijkstra’s Algorithm Given:a graph with a nonnegative weight assigned to each edge and a designated source node Compute:the shortest distance from the source node to each other node and a next-hop routing table Method: Initialize set S to contain all nodes except the source node: Initialize array D so that D[v] is the weight of the edge from the source to v if such an edge exists, and infinity otherwise; Initialize entries of R so that R[v] is assigned v if an edge exists from the source to v, and zero otherwise; while (set S is not empty) { choose a node u from S such that D[u] is minimum; if (D[u] is infinity) { no path exists to nodes in S; quit; } delete u from set S; for each node v such that (u,v) is an edge { if (v is still in S) { c = D[u] + weight(u,v); if (c < D[v]) { R[v] = u; D[v] = c; } } } }
OSPF: Open Shortest Path First Protocol • Most widely used link-state routing protocol • “Open” refers to nonproprietary standard introduced by IETF • Additional features over basic link-state algorithm • Authentication of routing messages • Uses a simple 8-byte password for authentication • Can deter malicious users and prevent problems due to misconfiguration • Additional hierarchy • Allows a domain to be partitioned into areas so that a router within a domain does not necessarily need to know how to reach every network. Only it needs to know to get to the right area • Load balancing • OSPF allows multiple routes to the same place to be assigned the same cost and will cause traffic to be distributed evenly over those routes.
Hierarchical OSPF • Two-level hierarchy: local area and backbone. • Link-state advertisements do not leave respective areas. • Nodes in each area have detailed area topology; they only know direction (shortest path) to networks in other areas. • Area Border routers “summarize” distances to networks in the area and advertise them to other Area Border routers. • Backbone routers run an OSPF routing algorithm limited to the backbone. • Boundary routers connect to other ASs (autonomous systems).
Routing for Mobile Hosts • A router called home agent running on home network of the mobile host works as a proxy • Receives and forwards packets for the mobile host • All agents periodically announces their presence (broadcast) • When mobile host leaves its home network • it registers with foreign agent in foreign network and provides the address of its home agent to foreign agent • foreign agent communicates with home agent for all packet delivery to mobile host Sending host Home agent Foreign agent (10.0.0.3) (12.0.0.6) Internetwork Home network Mobile host (network 10) (10.0.0.9)
How to Make Routing Scale • Flat versus Hierarchical Addresses • Inefficient use of Hierarchical Address Space • A network with two hosts needs two class C addresses (2/255 = 0.78% efficient) • A network with 256 hosts needs 256 class B addresses (256/65535 = 0.39% efficient) • Still Too Many Networks • routing tables do not scale • route propagation protocols do not scale • Solution: • Classless Interdomain Routing (CIDR)
CIDR • IP classes disappear at least for inter-domain routing purpose • A scalable solution for routing • Network numbers are <length, value> pairs • length represents number of bits in network prefix • value is an actual IP address • Slash notation is used instead of mask • a.b.c.d/n (Ex; 165.95.11.101/28) • Also called supernetting
Routing in the Internet • The Global Internet consists of Autonomous Systems (AS) interconnected with each other • Types of AS • Stub AS: small corporation (only carry local traffic) • Multihomed AS: large corporation (no transit) • Transit AS: provider (carry both transit and local traffic) • Two-level routing: • Intra-AS: administrator is responsible for choice • Inter-AS: unique standard
NSFNET backbone Stanford ISU BARRNET MidNet … regional regional Westnet regional Berkeley P ARC UNL KU UNM NCAR UA Internet Structure Recent Past (Tree structure in 1990)
Large corporation “ ” Consumer ISP Peering point Backbone service provider Peering point Consumer ” ISP “ “ Consumer ISP ” Large corporation Small corporation Internet Structure Today’s Multibackbone Internet
Route Propagation • Know a smarter router • hosts know local router • local routers know site routers • site routers know core router • core routers know everything • Autonomous System (AS) • corresponds to an administrative domain • examples: University, company, backbone network • assign each AS a 16-bit number • Two-level route propagation hierarchy • interior gateway protocol (each AS selects its own) for intradomain routing • exterior gateway protocol (Internet-wide standard) for interdomain routing
Popular Interior Gateway Protocols • RIP: Route Information Protocol • developed for XNS • distributed with Unix • distance-vector algorithm • based on hop-count • OSPF: Open Shortest Path First • recent Internet standard • uses link-state algorithm • supports load balancing • supports authentication • IGRP: Interior Gateway Routing Protocol (Cisco propr.) • Similar to RIP
EGP: Exterior Gateway Protocol • Overview • designed for tree-structured Internet • concerned with reachability, not optimal routes • Protocol messages • neighbor acquisition: one router requests that another be its peer; peers exchange reachability information • neighbor reachability: • one router periodically tests if the another is still reachable; exchange HELLO/ACK messages; • routing updates: • peers periodically exchange their routing tables (distance-vector)
BGP-4: Border Gateway Protocol • AS Types • stub AS: has a single connection to one other AS • carries local traffic only • multihomed AS: has connections to more than one AS • refuses to carry transit traffic • transit AS: has connections to more than one AS • carries both transit and local traffic • Each AS has: • one or more border routers • one BGP speaker that advertises: • local networks • other reachable networks (transit AS only) • gives path information
128.96 Customer P 192.4.153 (AS 4) Regional provider A (AS 2) Customer Q 192.4.32 (AS 5) 192.4.3 Backbone network (AS 1) Customer R 192.12.69 (AS 6) Regional provider B (AS 3) Customer S 192.4.54 (AS 7) 192.4.23 BGP Example • Speaker for AS2 advertises reachability to P and Q • network 128.96, 192.4.153, 192.4.32, and 192.4.3, can be reached directly from AS2 • Speaker for backbone advertises • networks 128.96, 192.4.153, 192.4.32, and 192.4.3 can be reached along the path (AS1, AS2). • Speaker can cancel previously advertised paths
Why different Intra- and Inter-AS routing ? • Policy: Inter is concerned with policies (which provider we must select/avoid, etc). Intra is contained in a single organization, so, no policy decisions necessary • Scale: Inter provides an extra level of routing table size and routing update traffic reduction above the Intra layer • Performance: Intra is focused on performance metrics; needs to keep costs low. In Inter it is difficult to propagate performance metrics efficiently (latency, privacy etc). Besides, policy related information is more meaningful. We need BOTH!