TP/IP Networking Part 3: Forwarding and Routing Routing of IP Packets There are two parts to routing IP packets:. How to pass a packet from an input interface to the output interface of a router ( IP forwarding )?. How to find and setup a route ( routing algorithm )? IP Forwarding is performed by IP (in the OS kernel) The routing algorithm is run by a userlevel process
IP Forwarding routing daemon route command netstat command UP TP YS routing table IMP Redirect IMP IP Output: alculate Hop Router NO: if forwarding enabled Source Routing For me? Process IP Options IP Input Queue Network Interfaces Forwarding atagrams
Forwarding atagrams packet is typically forwarded to a large number of routers before reaching the destination host IP forwarding is done on a by basis, I.e., no one knows the complete route. The goal of forwarding is to bring the IP datagram closer to the destination Major Tenets for IP Forwarding very IP datagram contains the IP address of the destination host The network prefix of an IP address uniquely identifies a single physical network that is part of the larger Internet ll hosts and routers that have the same network prefix are connected to the same physical network and can directly communicate by sending M layer frames very physical network of the Internet has at least one router, which is also connected to at least one other physical network 3
IP Forwarding oth routers and hosts have a routing table. However, a host never passes a packet from an input interface to an output interface. For each IP packet, there is one routing table lookup.. Find matching host address. Find matching network address 3. Find default entry estination Gateway Flags Refcnt Use Interface 8.43.0.0 8.43.37.6 U 3 697 hme0 4.0.0.0 8.43.37.6 U 3 0 hme0 default 8.43.37. UG 0 08 hme0 7.0.0. 7.0.0. UH 0 44 lo0 IP Routing lgorithms The following concepts are important to understand routing in IP networks: utonomous system Interdomainvs. Intradomain routing istance vector vs. link state routing algorithms 4
utonomous Systems n autonomous system is a region of the Internet that is administered by a single entity. xamples of autonomous regions are: UV s campus network MI s backbone network Regional Internet Service Provider Routing is done differently within an autonomous system (intradomain routing) and between autonomous system (interdomain routing). utonomous Systems (S) thernet thernet utonomous System Router thernet Router Router Router thernet thernet Router utonomous System Router thernet 5
Interdomain and Intradomain Routing Intradomain Routing Routing within an S Ignores the Internet outside the S Protocols for Intradomain routing are also called Interior Gateway Protocols or IGP s. Popular protocols are RIP (simple, old) OSPF (better) Interdomain Routing Routing between S s ssumes that the Internet consists of a collection of interconnected S s Normally, there is one dedicated router in each S that handles interdomain traffic. Protocols for interdomain routing are also called xterior Gateway Protocols or GP s. Routing protocols: GP GP (more recent) omponents of a Routing lgorithm. procedure for sending and receiving reachability information about network to other routers. procedure for calculating optimal routes Routes are calculated using a shortest path algorithm: Goal: Given a network were each link is assigned a cost. Find the path with the least cost between two networks with minimum cost. 3. procedures for reacting to and advertising topology changes 6
pproaches to Shortest Path Routing There are two basic routing algorithms found on the Internet.. istance Vector Routing ach node knows the distance (=cost) to its directly connected neighbors node sends periodically a list of routing updates to its neighbors. If all nodes update their distances, the routing tables eventually converge New nodes advertise themselves to their neighbors. Link State Routing ach node knows the distance to its neighbors The distance information (=link state) is broadcast to all nodes in the network ach node calculates the routing tables independently Routing lgorithms in the Internet istance Vector Link State Routing Information Protocol (RIP) Intermediate System Intermediate System (ISIS) GatewaytoGateway Protocol (GGP) Open Shortest Path First (OSPF) xterior Gateway Protocol (GP) Interior Gateway Routing Protocol (IGRP) 7
istance Vector vs. Link State Routing With distance vector routing, each node has information only about the next : Node : to reach F go to Node : to reach F go to Node : to reach F go to Node : go directly to F istance vector routing makes poor routing decisions if directions are not completely correct (e.g., because a node is down). F If parts of the directions incorrect, the routing may be incorrect until the routing algorithms has reconverged. istance Vector vs. Link State Routing In link state routing, each node has a complete map of the topology If a node fails, each node can calculate the new route F F F ifficulty: ll nodes need to have a consistent view of the network F F F F 8
xample: istance Vector vs Link State in NY irections from my former residence in New York ity (6 W 73rd St) to the National History Museum. These are distance vector type directions: : Start out going Northwest on W 73R ST towards MSTRM V by turning left. : Turn RIGHT onto MSTRM V. 3: Turn RIGHT onto W 8ST. 4: Turn RIGHT onto NTRL PRK W. The directions are perfect if all parts of the route are operational. However, suppose W 8 St is closed! Link state routing can be compared to carrying a map. With a map the directions can be recomputed at each turn 3: Turn RIGHT onto W 83ST Jörg Liebeherr, 4: Turn 000 RIGHT onto NTRL PRK W. Link State Routing ach node must discover its neighbors measure the delay (=cost) to its neighbors broadcast a packet with this information to all other nodes compute the shortest paths to every other router The broadcast can be accomplished by flooding The shortest paths can be computer with ijkstra s algorithm ach node requires complete topology information Link state information must be flooded to all nodes Guaranteed to converge 9
Operation of a Link State Routing protocol Received LSs Link State atabase ijkstra s lgorithm IP Routing Table LSs are flooded to other interfaces ijkstra s Shortest Path lgorithm for a Graph Input: Graph (N,) with N the set of nodes and N N the set of edges d vw link cost (d vw = infinity if (v,w) ˇ, d vv = 0) s Output: n source node. cost of the leastcost path from node s to node n M = {s}; for each n ˇ M n = d sn ; while (M all nodes) do Find w ˇ M for which w = min{ j ; j ˇ M}; dd w to M; for each n ˇ M n = min w [ n, w + d wn ]; Update route; enddo 0
xample Network 5 3 3 3 5 66 44 5 xample xample: alculate the shortest paths for node. Iteration M 3 4 5 6 Init
xample Result is routing table (of node ): istance Vector ach node maintains two tables: istance Table: ost to each node via each outgoing link Routing Table: Minimum cost to each node and next node Nodes exchange messages that contain information on the cost of a route Reception of messages triggers recalculation of routing table
istance Vector lgorithm: Tables c(v,w) v w d n via to d istance Table w v (d,w) n v (d,n) to d RoutingTable via cost (next ) w v (d) = v (d,w) Note: In the figure, v (d,w)< v (d,n) and, therefore, v (d) = v (d,w) c (v,w) v (d,w) v (d)= min x v (d,x) cost of link (v,w) cost from v to d via w minimum cost from v to d Messages Nodes exchange messages to their neighbors. If node v sends a messages to node x of the form, [m, v (m)], this means I can go to node m with minimum cost v (m) vv [m, v (m)] x x This message is only of interest to neighbors of v 3
istance Vector Routing lgorithm Initialization: for each node v { N := Set of nodes that are neighbors of v } for each w N v (w,w) = c(v,w) for each node x v and x ˇ N v (x,w) = for all nodes d v Send Message [v, v (d)] to each node w N with v (d) = min x N v (d,x) vents: The ost of a link changes node receives a message ost of link changes by m m c(m,v)+ m v x y d e via to istance Table m to RoutingTable via cost (next ) e v (e,m)+ m e y v (e) d v (d,m)+ m d m v (d) 4
ost of link changes by m Operations at node v. ntries in mth column of distance table are changed by (if link goes down: = ).. For all destinations d: ompute min x v (m,x): (a) If no changes to previous value of min x v (d,xw): o nothing (b) If v (d, m) = min x v (d,x) hange entry in dth row of routing table to (m, v (d, m)), and send messages [d, v (d, m)] to all neighbors Node v receives a message [d, w (d)] w [d, w (d)] v istance Table via w to to RoutingTable via cost (next ) d v (d,w) d w v (d) 5
Node v receives a message [d, w (d)] Operations at node v. If d = v then ignore the message. If d v then v (d, w) = w (d) + c(w,v) ompute min x v (d,x) : If no changes, then do nothing If v (d,w)=min x v (d,x), then change entry in dth row of routing table to (d, v (d,w)) and send message [d, v (d,w)] to all neighbors. xample ssume that Node comes up at time t=0 Show how the entries for destination are updated at all other nodes 5 3 3 3 5 66 44 5 6
xample Node istance via 3 4 Routing via cost Node 3 istance via 4 5 6 Routing via cost 5 3 3 3 5 via 3 5 via cost 4 5 6 Node 4 Node 6 Node 5 istance Routing via 3 4 6 via cost istance via 5 6 Routing via cost iscussion of istance Vector Routing ntries of routing tables can change while a packet is being transmitted. This can lead to a single datagram visiting the same node more than once (Looping) If the period for updating the routing tables is too short, routing table entries are changed before convergence (from the previous updates) is achieved xample: The RPNT used a istance Vector algorithm with an update period of < sec. ue to the instability of routing, the RPNT switched in 979 to a link state routing algorithm 7