# CN Unit V - Routing Principles

Views:

Category: Education

## Presentation Description

Introduction to IP routing, Classification of routing algorithms, distance vector, link state, hierarchical, adhoc Net, MACA, MACAW. Routing protocols-RIP, OSPF, BGP, IGRP.

## Presentation Transcript

### Unit V: Routing Algorithm:

Unit V: Routing Algorithm 4- 1 Reference: Kurose, Ross “Computer Networking-a top down approach featuring the internet” and “ Data Communications and Networking By Behrouz A.Forouzan Slides p repared by: Mr. Vaibhav Dabhade for TE Computer Engineering

### Routing Algorithm classification:

Routing Algorithm classification 4- 2 Global or decentralized information? Global: all routers have complete topology, link cost info “link state” algorithms Decentralized: router knows physically-connected neighbors, link costs to neighbors iterative process of computation, exchange of info with neighbors “distance vector” algorithms Static or dynamic? Static: routes change slowly over time Dynamic: routes change more quickly periodic update in response to link cost changes

### Chapter 4: Network Layer:

Chapter 4: Network Layer 4- 3 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing

A Link-State Routing Algorithm 4- 4 Dijkstra’s algorithm net topology, link costs known to all nodes accomplished via “link state broadcast” all nodes have same info computes least cost paths from one node (‘source”) to all other nodes iterative: after k iterations, know least cost path to k dest.’s Notation: c( x,y ): link cost from node x to y; = ∞ if not direct neighbors D(v): current value of cost of path from source to dest . v p(v): predecessor node along path from source to v N ' : set of nodes whose least cost path definitively known

### Dijsktra’s Algorithm:

Dijsktra’s Algorithm 4- 5 1 Initialization: 2 N ' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 6 else D(v) = ∞ 7 8 Loop 9 find w not in N ' such that D(w) is a minimum 10 add w to N ' 11 update D(v) for all v adjacent to w and not in N ' : 12 D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */ 15 until all nodes in N '

### Dijkstra’s algorithm: example:

Dijkstra’s algorithm: example 4- 6 Step 0 1 2 3 4 5 N ' u ux uxy uxyv uxyvw uxyvwz D(v),p(v) 2,u 2,u 2,u D(w),p(w) 5,u 4,x 3,y 3,y D(x),p(x) 1,u D(y),p(y) ∞ 2,x D(z),p(z) ∞ ∞ 4,y 4,y 4,y u y x w v z 2 2 1 3 1 1 2 5 3 5

### Dijkstra’s algorithm: example (2) :

Dijkstra’s algorithm: example (2) 4- 7 u y x w v z Resulting shortest-path tree from u: v x y w z (u,v) (u,x) (u,x) (u,x) (u,x) destination link Resulting forwarding table in u:

### Chapter 4: Network Layer:

Chapter 4: Network Layer 4- 8 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing

### Distance Vector Algorithm :

Distance Vector Algorithm 4- 9 Bellman-Ford Equation (dynamic programming) Define d x (y) := cost of least-cost path from x to y Then d x (y) = min {c(x,v) + d v (y) } where min is taken over all neighbors v of x v

### Bellman-Ford example :

Bellman-Ford example 4- 10 u y x w v z 2 2 1 3 1 1 2 5 3 5 Clearly, d v (z) = 5, d x (z) = 3, d w (z) = 3 d u (z) = min { c( u,v ) + d v (z), c( u,x ) + d x (z), c( u,w ) + d w (z) } = min {2 + 5, 1 + 3, 5 + 3} = 4 Node that achieves minimum is next hop in shortest path ➜ forwarding table B-F equation says:

### Distance Vector Algorithm :

Distance Vector Algorithm 4- 11 D x (y) = estimate of least cost from x to y Distance vector: D x = [D x (y): y є N ] Node x knows cost to each neighbor v: c(x,v) Node x maintains D x = [D x (y): y є N ] Node x also maintains its neighbors’ distance vectors For each neighbor v, x maintains D v = [D v (y): y є N ]

### Distance vector algorithm:

Distance vector algorithm 4- 12 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: D x (y) ← min v {c(x,v) + D v (y)} for each node y ∊ N

### Distance Vector Algorithm:

Distance Vector Algorithm 4- 13 Iterative, asynchronous: each local iteration caused by: local link cost change DV update message from neighbor Distributed: each node notifies neighbors only when its DV changes neighbors then notify their neighbors if necessary wait for (change in local link cost of msg from neighbor) recompute estimates if DV to any dest has changed, notify neighbors Each node:

### PowerPoint Presentation:

4- 14 x y z x y z 0 2 7 ∞ ∞ ∞ ∞ ∞ ∞ from cost to from from x y z x y z 0 2 3 from cost to x y z x y z 0 2 3 from cost to x y z x y z ∞ ∞ ∞ ∞ ∞ cost to x y z x y z 0 2 7 from cost to x y z x y z 0 2 3 from cost to x y z x y z 0 2 3 from cost to x y z x y z 0 2 7 from cost to x y z x y z ∞ ∞ ∞ 7 1 0 cost to ∞ 2 0 1 ∞ ∞ ∞ 2 0 1 7 1 0 2 0 1 7 1 0 2 0 1 3 1 0 2 0 1 3 1 0 2 0 1 3 1 0 2 0 1 3 1 0 time x z 1 2 7 y node x table node y table node z table D x (y) = min{c(x,y) + D y (y), c(x,z) + D z (y)} = min{2+0 , 7+1} = 2 D x (z) = min{ c(x,y) + D y (z), c(x,z) + D z (z) } = min{2+1 , 7+0} = 3

### Distance Vector: link cost changes:

Distance Vector: link cost changes 4- 15 Link cost changes: node detects local link cost change updates routing info, recalculates distance vector if DV changes, notify neighbors “good news travels fast” x z 1 4 50 y 1 At time t 0 , y detects the link-cost change, updates its DV, and informs its neighbors. At time t 1 , z receives the update from y and updates its table. It computes a new least cost to x and sends its neighbors its DV. At time t 2 , y receives z ’s update and updates its distance table. y ’s least costs do not change and hence y does not send any message to z .

### Chapter 4: Network Layer:

Chapter 4: Network Layer 4- 16 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing

### Hierarchical Routing:

Hierarchical Routing 4- 17 scale: with 200 million destinations: can’t store all dest’s in routing tables! routing table exchange would swamp links! administrative autonomy internet = network of networks each network admin may want to control routing in its own network Our routing study thus far - idealization all routers identical network “flat” … not true in practice

### Hierarchical Routing:

Hierarchical Routing 4- 18 aggregate routers into regions, “autonomous systems” (AS) routers in same AS run same routing protocol “intra-AS” routing protocol routers in different AS can run different intra-AS routing protocol Gateway router Direct link to router in another AS

### Interconnected ASes:

Interconnected ASes 4- 19 Forwarding table is configured by both intra- and inter-AS routing algorithm Intra-AS sets entries for internal dests Inter-AS & Intra-As sets entries for external dests 3b 1d 3a 1c 2a AS3 AS1 AS2 1a 2c 2b 1b Intra-AS Routing algorithm Inter-AS Routing algorithm Forwarding table 3c

Inter-AS tasks 4- 20 Suppose router in AS1 receives datagram for which dest is outside of AS1 Router should forward packet towards one of the gateway routers, but which one? AS1 needs: to learn which dests are reachable through AS2 and which through AS3 to propagate this reach-ability info to all routers in AS1 Job of inter-AS routing! 3b 1d 3a 1c 2a AS3 AS1 AS2 1a 2c 2b 1b 3c

### Example: Setting forwarding table in router 1d:

Example: Setting forwarding table in router 1d 4- 21 Suppose AS1 learns from the inter-AS protocol that subnet x is reachable from AS3 (gateway 1c) but not from AS2. Inter-AS protocol propagates reachability info to all internal routers. Router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1c. Puts in forwarding table entry (x,I) .

### Example: Choosing among multiple ASes:

Example: Choosing among multiple ASes 4- 22 Now suppose AS1 learns from the inter-AS protocol that subnet x is reachable from AS3 and from AS2. To configure forwarding table, router 1d must determine towards which gateway it should forward packets for dest x . This is also the job on inter-AS routing protocol! Hot potato routing: send packet towards closest of two routers. Learn from inter-AS protocol that subnet x is reachable via multiple gateways Use routing info from intra-AS protocol to determine costs of least-cost paths to each of the gateways Hot potato routing: Choose the gateway that has the smallest least cost Determine from forwarding table the interface I that leads to least-cost gateway. Enter (x,I) in forwarding table

### Chapter 4: Network Layer:

Chapter 4: Network Layer 4- 23 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing

### Intra-AS Routing:

Intra-AS Routing 4- 24 Also known as Interior Gateway Protocols (IGP) Most common Intra-AS routing protocols: RIP: Routing Information Protocol OSPF: Open Shortest Path First IGRP: Interior Gateway Routing Protocol (Cisco proprietary)

### Chapter 4: Network Layer:

Chapter 4: Network Layer 4- 25 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing

### RIP ( Routing Information Protocol):

RIP ( Routing Information Protocol) 4- 26 Included in BSD-UNIX Distribution in 1982 Distance metric: # of hops (max = 15 hops) Distance vector algorithm D C B A u v w x y z destination hops u 1 v 2 w 2 x 3 y 3 z 2 From router A to subsets:

### RIP: Example :

RIP: Example 4- 28 Destination Network Next Router Num. of hops to dest. w A 2 y B 2 z B 7 x -- 1 …. …. .... w x y z A C D B Routing table in D

### RIP: Example :

RIP: Example 4- 29 Destination Network Next Router Num. of hops to dest . w A 2 y B 2 z B A 7 5 x -- 1 …. …. .... Routing table in D w x y z A C D B Dest Next hops w - 1 x - 1 z C 4 …. … ... Advertisement from A to D

### RIP Table processing:

RIP Table processing 4- 31 RIP routing tables managed by application-level process called route-d (daemon) advertisements sent in UDP packets, periodically repeated physical link network (IP) Transprt (UDP) routed physical link network (IP) Transprt (UDP) routed forwarding table forwarding table

### Chapter 4: Network Layer:

Chapter 4: Network Layer 4- 32 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing

### OSPF (Open Shortest Path First):

OSPF (Open Shortest Path First) 4- 33 “open”: publicly available Uses Link State algorithm Topology map at each node Route computation using Dijkstra’s algorithm OSPF advertisement carries one entry per neighbor router Advertisements disseminated to entire AS (via flooding) Carried in OSPF messages directly over IP (rather than TCP or UDP)

### OSPF “advanced” features (not in RIP):

OSPF “advanced” features (not in RIP) 4- 34 Security: all OSPF messages authenticated (to prevent malicious intrusion) Multi ple same-cost path s allowed (only one path in RIP) Integrated uni- and multicast support: Multicast OSPF (MOSPF) uses same topology data base as OSPF Hierarchical OSPF in large domains.

### Hierarchical OSPF:

Hierarchical OSPF 4- 35

### Hierarchical OSPF:

Hierarchical OSPF 4- 36 Two-level hierarchy: local area, backbone. Link-state advertisements only in area each nodes has detailed area topology; only know direction (shortest path) to nets in other areas. Area border routers: “summarize” distances to nets in own area, advertise to other Area Border routers. Backbone routers: run OSPF routing limited to backbone. Boundary routers: connect to other AS’s.

### Chapter 4: Network Layer:

Chapter 4: Network Layer 4- 37 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing

### Internet inter-AS routing: BGP:

Internet inter-AS routing: BGP 4- 38 BGP (Border Gateway Protocol): BGP provides each AS a means to: Obtain subnet reachability information from neighboring ASs. Propagate the reachability information to all routers internal to the AS. Determine “good” routes to subnets based on reachability information and policy. Allows a subnet to advertise its existence to rest of the Internet: “I am here”

### BGP basics:

BGP basics 4- 39 Pairs of routers (BGP peers) exchange routing info over semi-permanent TCP conctns: BGP sessions Note that BGP sessions do not correspond to physical links. When AS2 advertises a prefix to AS1, AS2 is promising it will forward any datagrams destined to that prefix towards the prefix. AS2 can aggregate prefixes in its advertisement 3b 1d 3a 1c 2a AS3 AS1 AS2 1a 2c 2b 1b 3c eBGP session iBGP session

### Distributing reachability info:

Distributing reachability info 4- 40 With eBGP session between 3a and 1c, AS3 sends prefix reachability info to AS1. 1c can then use iBGP do distribute this new prefix reach info to all routers in AS1 1b can then re-advertise the new reach info to AS2 over the 1b-to-2a eBGP session When router learns about a new prefix, it creates an entry for the prefix in its forwarding table. 3b 1d 3a 1c 2a AS3 AS1 AS2 1a 2c 2b 1b 3c eBGP session iBGP session

### Path attributes & BGP routes:

Path attributes & BGP routes 4- 41 When advertising a prefix, advert includes BGP attributes. prefix + attributes = “route” Two important attributes: AS-PATH: contains the ASs through which the advert for the prefix passed: AS 67 AS 17 NEXT-HOP: Indicates the specific internal-AS router to next-hop AS. (There may be multiple links from current AS to next-hop-AS.) When gateway router receives route advert, uses import policy to accept/decline.

### BGP route selection:

BGP route selection 4- 42 Router may learn about more than 1 route to some prefix. Router must select route. Elimination rules: Local preference value attribute: policy decision Shortest AS-PATH Closest NEXT-HOP router: Additional criteria

### BGP messages:

BGP messages 4- 43 BGP messages exchanged using TCP. BGP messages: OPEN: opens TCP connection to peer and authenticates sender UPDATE: advertises new path (or withdraws old) KEEPALIVE keeps connection alive in absence of UPDATES; also ACKs OPEN request NOTIFICATION: reports errors in previous msg; also used to close connection

### BGP routing policy:

BGP routing policy 4- 44 A,B,C are provider networks X,W,Y are customer (of provider networks) X is dual-homed: attached to two networks X does not want to route from B via X to C .. so X will not advertise to B a route to C

### BGP routing policy (2):

BGP routing policy (2) 4- 45 A advertises to B the path AW B advertises to X the path BAW Should B advertise to C the path BAW? No way! B gets no “revenue” for routing CBAW since neither W nor C are B’s customers B wants to force C to route to w via A B wants to route only to/from its customers!

### Why different Intra- and Inter-AS routing ? :

Why different Intra- and Inter-AS routing ? 4- 46 Policy: Inter-AS: admin wants control over how its traffic routed, who routes through its net. Intra-AS: single admin, so no policy decisions needed Scale: hierarchical routing saves table size, reduced update traffic Performance : Intra-AS: can focus on performance Inter-AS: policy may dominate over performance

### Chapter 4: Network Layer:

Chapter 4: Network Layer 4- 47 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing

Broadcast Routing 4- 48 Deliver packets from srce to all other nodes Source duplication is inefficient: R1 R2 R3 R4 source duplication R1 R2 R3 R4 in-network duplication duplicate creation/transmission duplicate duplicate Source duplication: how does source determine recipient addresses

### In-network duplication:

In-network duplication 4- 49 Flooding: when node receives brdcst pckt, sends copy to all neighbors Problems: cycles & broadcast storm Controlled flooding: node only brdcsts pkt if it hasn’t brdcst same packet before Node keeps track of pckt ids already brdcsted Or reverse path forwarding (RPF): only forward pckt if it arrived on shortest path between node and source Spanning tree No redundant packets received by any node

### Spanning Tree:

Spanning Tree 4- 50 First construct a spanning tree Nodes forward copies only along spanning tree A B G D E c F A B G D E c F (a) Broadcast initiated at A (b) Broadcast initiated at D

### Spanning Tree: Creation:

Spanning Tree: Creation 4- 51 Center node Each node sends unicast join message to center node Message forwarded until it arrives at a node already belonging to spanning tree A B G D E c F 1 2 3 4 5 Stepwise construction of spanning tree A B G D E c F (b) Constructed spanning tree

### Multicast Routing: Problem Statement:

Multicast Routing: Problem Statement Goal: find a tree (or trees) connecting routers having local mcast group members tree: not all paths between routers used source-based: different tree from each sender to rcvrs shared-tree: same tree used by all group members Shared tree Source-based trees 4- 52

### Approaches for building mcast trees:

Approaches for building mcast trees Approaches: source-based tree: one tree per source shortest path trees reverse path forwarding group-shared tree: group uses one tree minimal spanning (Steiner) center-based trees …we first look at basic approaches, then specific protocols adopting these approaches 4- 53

### Shortest Path Tree:

Shortest Path Tree mcast forwarding tree: tree of shortest path routes from source to all receivers Dijkstra’s algorithm R1 R2 R3 R4 R5 R6 R7 2 1 6 3 4 5 i router with attached group member router with no attached group member link used for forwarding, i indicates order link added by algorithm LEGEND S: source 4- 54

### Reverse Path Forwarding:

Reverse Path Forwarding if (mcast datagram received on incoming link on shortest path back to center) then flood datagram onto all outgoing links else ignore datagram rely on router’s knowledge of unicast shortest path from it to sender each router has simple forwarding behavior: 4- 55

### Reverse Path Forwarding: example:

Reverse Path Forwarding: example result is a source-specific reverse SPT may be a bad choice with asymmetric links R1 R2 R3 R4 R5 R6 R7 router with attached group member router with no attached group member datagram will be forwarded LEGEND S: source datagram will not be forwarded 4- 56

### Reverse Path Forwarding: pruning:

Reverse Path Forwarding: pruning forwarding tree contains subtrees with no mcast group members no need to forward datagrams down subtree “prune” msgs sent upstream by router with no downstream group members R1 R2 R3 R4 R5 R6 R7 router with attached group member router with no attached group member prune message LEGEND S: source links with multicast forwarding P P P 4- 57

### Shared-Tree: Steiner Tree:

Shared-Tree: Steiner Tree Steiner Tree: minimum cost tree connecting all routers with attached group members problem is NP-complete excellent heuristics exists not used in practice: computational complexity information about entire network needed monolithic: rerun whenever a router needs to join/leave 4- 58

### Center-based trees:

Center-based trees single delivery tree shared by all one router identified as “center” of tree to join: edge router sends unicast join-msg addressed to center router join-msg “processed” by intermediate routers and forwarded towards center join-msg either hits existing tree branch for this center, or arrives at center path taken by join-msg becomes new branch of tree for this router 4- 59

### Center-based trees: an example:

Center-based trees: an example Suppose R6 chosen as center: R1 R2 R3 R4 R5 R6 R7 router with attached group member router with no attached group member path order in which join messages generated LEGEND 2 1 3 1 4- 60

### Internet Multicasting Routing: DVMRP:

Internet Multicasting Routing: DVMRP DVMRP: distance vector multicast routing protocol, RFC1075 flood and prune: reverse path forwarding, source-based tree RPF tree based on DVMRP’s own routing tables constructed by communicating DVMRP routers no assumptions about underlying unicast initial datagram to mcast group flooded everywhere via RPF routers not wanting group: send upstream prune msgs 4- 61

### DVMRP: continued…:

DVMRP: continued… soft state: DVMRP router periodically (1 min.) “forgets” branches are pruned: mcast data again flows down unpruned branch downstream router: reprune or else continue to receive data routers can quickly regraft to tree following IGMP join at leaf odds and ends commonly implemented in commercial routers Mbone routing done using DVMRP 4- 62

### Tunneling:

Tunneling Q: How to connect “islands” of multicast routers in a “sea” of unicast routers? mcast datagram encapsulated inside “normal” (non-multicast-addressed) datagram normal IP datagram sent thru “tunnel” via regular IP unicast to receiving mcast router receiving mcast router unencapsulates to get mcast datagram physical topology logical topology 4- 63

### PIM: Protocol Independent Multicast:

PIM: Protocol Independent Multicast not dependent on any specific underlying unicast routing algorithm (works with all) two different multicast distribution scenarios : Dense : group members densely packed, in “close” proximity. bandwidth more plentiful Sparse: # networks with group members small wrt # interconnected networks group members “widely dispersed” bandwidth not plentiful 4- 64

### Consequences of Sparse-Dense Dichotomy: :

Consequences of Sparse-Dense Dichotomy: Dense group membership by routers assumed until routers explicitly prune data-driven construction on mcast tree (e.g., RPF) bandwidth and non-group-router processing profligate Sparse : no membership until routers explicitly join receiver- driven construction of mcast tree (e.g., center-based) bandwidth and non-group-router processing conservative 4- 65

### PIM- Dense Mode:

PIM- Dense Mode flood-and-prune RPF , similar to DVMRP but underlying unicast protocol provides RPF info for incoming datagram less complicated (less efficient) downstream flood than DVMRP reduces reliance on underlying routing algorithm has protocol mechanism for router to detect it is a leaf-node router 4- 66

### PIM - Sparse Mode:

PIM - Sparse Mode center-based approach router sends join msg to rendezvous point (RP) intermediate routers update state and forward join after joining via RP, router can switch to source-specific tree increased performance: less concentration, shorter paths R1 R2 R3 R4 R5 R6 R7 join join join all data multicast from rendezvous point rendezvous point 4- 67

### PIM - Sparse Mode:

PIM - Sparse Mode sender(s): unicast data to RP, which distributes down RP-rooted tree RP can extend mcast tree upstream to source RP can send stop msg if no attached receivers “no one is listening!” R1 R2 R3 R4 R5 R6 R7 join join join all data multicast from rendezvous point rendezvous point 4- 68