& Forwarding: Routing: Network Layer Part II Logical View of a

• Routing Algorithms: 5 – Link state vs. Distance Vector B 3 C • Routing in the 2 5 A 2 – Intra-AS vs. Inter-AS routing 3 1 F 1 2 – Intra-AS: RIP and OSPF D E 1 – Inter-AS: BGP and Policy Routing •MPLS Readings: Textbook: Chapter 4: Sections 4.2-4.3, 4.5-4.6

Csci 232 – Computer Networks Routing and Network Layer Part II 1 Csci 232 – Computer Networks Routing and Network Layer Part II 2

IP Forwarding Process IP Forwarding Table 1. Remove a packet 2. Check for sanity, 4. Place packet on from an input decrement TTL correct output queue field queue Destination Next Hop Interface

Net A Router 1 INT 7 Net B Direct INT 4 Forwarding Process NCH3Net C, Host 3 R2Router 2 INT 3 Net C Router 1 INT 7 3. Match packet’s If queues If queues destination to get full, just get full, just a table entry drop packets! drop packets! A destination is usually The next hop is either a a network. May also be directly connected network A physical interface IP Forwarding Table a host, or a “gateway or a router on a directly of last resort” (default) Router connected network

Csci 232 – Computer Networks 3 Csci 232 – Computer Networks 4

How Are Forwarding Tables Populated to Implement Routing? Dynamic Routing: Intra- vs. Inter-AS Statically Dynamically

Administrator Routers exchange network reachability OSPF manually configures information using ROUTING PROTOCOLS. forwarding table entries Routers use this to compute best routes + Can rapidly adapt to changes BGP + More control AS 1 itktlin network topology + Not restricted to IGP = Interior Gateway Protocol + Can be made to scale well destination-based - Complex distributed algorithms forwarding Metric based: OSPF, IS-IS, RIP, - Consume CPU, Bandwidth, Memory - Doesn’t scale EIGRP (cisco) EIGRP - Debugging can be difficult - Slow to adapt to - Current protocols are destination-based EGP = Exterior Gateway Protocol AS 2 network failures Policy based: BGP In practice : a mix of these. Static routing mostly at the “edge” The Routing Domain of BGP is the entire Internet

Csci 232 – Computer Networks 5 Csci 232 – Computer Networks Routing and Network Layer Part II 6

1 Internet AS Hierarchy Intra-AS vs. Inter-AS Routing

border (exterior gateway) routers Inter-AS C.b routing between B.a A.a A and B Host b A.c c h2 a a C b a B Host d Intra-AS routing h1 c A b within AS B Intra-AS routing within AS A

interior routers

Csci 232 – Computer Networks Routing and Network Layer Part II 7 Csci 232 – Computer Networks Routing and Network Layer Part II 8

Intra-AS and Inter-AS Routing Where Does Forwarding Table Come From? C.b RIP Process BGP Process B.a “Gateways”: •perform inter- A.a RIP Routing tables BGP Routing tables AS routing b c a A.c a amongst C b BGP a B themselves OSPF Process •perform intra- d c A b AS routing with OSPF Routing tables other routers in their AS network layer inter-AS, intra-AS link layer RIP routing in Domain OSPF Forwarding Table Manager gateway A.c physical layer Domain

Forwarding Table

Csci 232 – Computer Networks Routing and Network Layer Part II 9 Csci 232 – Computer Networks 10

Routing Basic Routing Problem • Goal: determine a “good” path through • Assume the network from source to destination – A network with N nodes, where each – Good means usually the shortest path edge is associated a cost –A node knows only its neighbors and the • Network modeled as a graph 5 cost to reach them –Routers  nodes 3 • How does each node learn how  B C –Link edges 2 5 5 • Edge cost: delay, congestion level,… to reach every other node A 2 1 F 3 3 B C along the shortest path? 5 1 2 2 D E 1 A 2 1 F 3 1 2 D E 1

Csci 232 – Computer Networks Routing and Network Layer Part II 11 Csci 232 – Computer Networks Routing and Network Layer Part II 12

2 Routing: Issues Routing Paradigms •Hop-by-hop Routing • How are routing tables determined? – Each packet contains destination address • Who determines table entries? – Each router chooses next-hop to destination • routing decision made at each (intermediate) hop! • What info is used in determining table • packets to same destination may take different paths! entries? – Example: IP’s default datagram routing •Source Routing • When do entries change? – Sender selects the path to destination precisely • Where is routing info stored? – Routers forward packet to next-hop as specified • Problem: if specified path no longer valid due to link failure! • How to control routing table size? –Example: • IP’s loose/strict source route option Answer these questions, we are done! • virtual circuit setup phase in ATM (or MPLS)

Csci 232 – Computer Networks Routing and Network Layer Part II 13 Csci 232 – Computer Networks Routing and Network Layer Part II 14

Routing Algorithms/Protocols Centralized vs. Distributed Routing Algorithms Issues Need to Be Addressed: • Route selection may depend on different criteria Centralized: – Performance: choose route with the smallest delay • A centralized route server collects routing information and – Policy: choose a route that doesn’t cross .gov network network topology, makes route selection decisions, then distributes them to routers • Adapt to changes in network topology or condition Distributed: – Self-healing: little or no human intervention •Routers cooperate using a distributed protocol • Scalability –to create mutually consistent routing tables – Must be able to support a large number of hosts, routers •Two standard distributed routing algorithms – Link State (LS) routing – Distance Vector (DV) routing

Csci 232 – Computer Networks Routing and Network Layer Part II 15 Csci 232 – Computer Networks Routing and Network Layer Part II 16

Link State vs Distance Vector Link State Algorithm

• Both assume that • Basic idea: Distribute link state packet to – The address of each neighbor is known –The cost of reaching each neighbor is known all routers •Both find global information – Topology of the network • Cost of each link in the network – By exchanging routing info among neighbors • Each router independently computes • Differ in the information exchanged and optimal paths route computation – From itself to every destination – LS: tells every other node its distances to neighbors – Routes are guaranteed to be loop free if – DV: tells neighbors its distance to every other node • Each router sees the same cost for each link • Uses the same algorithm to compute the best path

Csci 232 – Computer Networks Routing and Network Layer Part II 17 Csci 232 – Computer Networks Routing and Network Layer Part II 18

3 Link State: Control Traffic Link State: Node State • Each node floods its local information to every other node in the network

C C • Each node ends up knowing the entire network A A D Host C C D topology  use Dijkstra to compute the shortest A D path to every other node Host A Host D B B E E Host C B E Host A Host D N2 N1 C A D N1 N2 N3 C A D B N3 E C N5 A D N5 B C E A D Host B B Host B N4 Host E N4 Host E B E N6 N7 N6 N7

Csci 232 – Computer Networks Routing and Network Layer Part II 19 Csci 232 – Computer Networks Routing and Network Layer Part II 20

Topology Dissemination Topology Database: Example

• Each router creates a set of link state 5 packets (LSPs) 3 – Describing its links to neighbors B C 5 – LSP contains 2 • Router id, neighbor’s id, and cost to its neighbor A 2 1 F 3 • Copies of LSPs are distributed to all 1 2 routers D E 1 –Using controlled flooding • Each router maintains a topology database link state database – Database containing all LSPs

Csci 232 – Computer Networks Routing and Network Layer Part II 21 Csci 232 – Computer Networks Routing and Network Layer Part II 22

Constructing Routing Table: Algorithm (at Node X) Dijkstra’s Algorithm

• Given the network topology • Initialization – How to compute the shortest path to each destination? –N = {X} • Some notation – For all nodes V • If V adjacent to X, D(V) = C(X,V) else D(V) =  – X: source node – N: set of nodes to which shortest paths are known so far • Loop • N is initially empty –Find U not in N such that D(U) is the smallest – D(V): the cost of the known shortest path from source X – Add U into set N to V – Update D(V) for all V not in N – C(U,V): cost of link U to V •D(V) = min{D(V), D(U) + C(U,V)} • C(U,V) =  if not neighbors – Until all nodes in N

Csci 232 – Computer Networks Routing and Network Layer Part II 23 Csci 232 – Computer Networks Routing and Network Layer Part II 24

4 Example: Dijkstra’s Algorithm Example: Dijkstra’s Algorithm Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F) Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F) 0 A 2,A 5,A 1,A   0 A 2,A 5,A 1,A   1 1 AD 4,D 2,D  2 2 3 3 4 4 5 5 … 5 1 Initialization: 5 2 N = {A}; 8 Loop 9 find w not in N s.t. D(w) is a minimum; B 3 C 3 for all nodes v B 3 C 2 5 2 5 10 add w to N; 4 if v adjacent to A 11 update D(v) for all v adjacent A 2 1 F A 2 1 F 3 5 then D(v) = c(A,v); 3 to w and not in N: 1 2 6 else D(v) =  ; 1 2 12 D(v) = min( D(v), D(w) + c(w,v) ); D E D E 1 … 1 13 until all nodes in N;

Csci 232 – Computer Networks Routing and Network Layer Part II 25 Csci 232 – Computer Networks Routing and Network Layer Part II 26

Example: Dijkstra’s Algorithm Example: Dijkstra’s Algorithm Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F) Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F) 0 A 2,A 5,A 1,A   0 A 2,A 5,A 1,A   1 AD 4,D 2,D  1 AD 4,D 2,D  2 ADE 3,E 4,E 2 ADE 3,E 4,E 3 3 ADEB 4 4 5 5 … … 5 8 Loop 5 8 Loop 9 find w not in N s.t. D(w) is a minimum; 9 find w not in N s.t. D(w) is a minimum; B 3 C B 3 C 2 5 10 add w to N; 2 5 10 add w to N; 11 update D(v) for all v adjacent 11 update D(v) for all v adjacent A 2 1 F A 2 1 F 3 to w and not in N: 3 to w and not in N: 1 2 12 D(v) = min( D(v), D(w) + c(w,v) ); 1 2 12 D(v) = min( D(v), D(w) + c(w,v) ); D E D E 1 13 until all nodes in N; 1 13 until all nodes in N;

Csci 232 – Computer Networks Routing and Network Layer Part II 27 Csci 232 – Computer Networks Routing and Network Layer Part II 28

Example: Dijkstra’s Algorithm Example: Dijkstra’s Algorithm Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F) Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F) 0 A 2,A 5,A 1,A   0 A 2,A 5,A 1,A   1 AD 4,D 2,D  1 AD 4,D 2,D  2 ADE 3,E 4,E 2 ADE 3,E 4,E 3 ADEB 3 ADEB 4 ADEBC 4 ADEBC 5 5 ADEBCF … … 5 8 Loop 5 8 Loop 3 9 find w not in N s.t. D(w) is a minimum; 3 9 find w not in N s.t. D(w) is a minimum; B C B C 2 5 10 add w to N; 2 5 10 add w to N; 11 update D(v) for all v adjacent 11 update D(v) for all v adjacent A 2 1 F A 2 1 F 3 to w and not in N: 3 to w and not in N: 1 2 12 D(v) = min( D(v), D(w) + c(w,v) ); 1 2 12 D(v) = min( D(v), D(w) + c(w,v) ); D E D E 1 13 until all nodes in N; 1 13 until all nodes in N;

Csci 232 – Computer Networks Routing and Network Layer Part II 29 Csci 232 – Computer Networks Routing and Network Layer Part II 30

5 Dijkstra’s Algorithm: In a Nutshell Routing Table Computation Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F) 0 A 2,A 5,A 1,A infinity infinity 1 AD 2,A 4,D 2,D infinity 5 2 ADE 2,A 3,E 4,E 3 ADEB 3,E 4,E 3 4 ADEBC 4,E B C 5 5 ADEBCF dest next 2 BB 5 CD A 2 1 F DD 3 B 3 C ED 1 2 5 2 FD D E A 2 1 1 3 F 1 D E 2 1

Csci 232 – Computer Networks Routing and Network Layer Part II 31 Csci 232 – Computer Networks Routing and Network Layer Part II 32

Distance Vector: Control Traffic Distance Vector Routing • When the routing table of a node changes, the node • A router tells neighbors its distance to every sends its table to its neighbors router • A node updates its table with information received from its neighbors – Communication between neighbors only • Based on Bellman-Ford algorithm Host C – Computes “shortest paths” Host A Host D • Each router maintains a distance table – A row for each possible destination N1 N2 – A column for each neighbor N3 X •D(Y,Z) : distance from X to Y via Z N5 • Exchanges distance vector (the table) with Host B neighbors N4 Host E – Distance vector: current least cost to each destination N6 N7

Csci 232 – Computer Networks Routing and Network Layer Part II 33 Csci 232 – Computer Networks Routing and Network Layer Part II 34

Distance Table: Example Distance Table to Routing Table

cost to destination via cost to destination via E Outgoing link E D () A B D to use, cost D () A B D 1 A A,1 B C A 1 14 5 6 A 1 14 11 A 8 2 B D5D,5 B 7 8 5 1 B 7 8 5 E D C D,4 2 C 6 9 4 C 8 9 4 D D,2 D 4 11 2 D 10 11 2 Distance table Routing table

Csci 232 – Computer Networks Routing and Network Layer Part II 35 Csci 232 – Computer Networks Routing and Network Layer Part II 36

6 Distance Vector Routing Algorithm Distance Vector Routing: Overview

iterative: Iterative, asynchronous: Each node: Distance Table data structure • continues until no each iteration caused by: nodes exchange info. • each node has its own • local link cost change wait for (change in local • row for each possible destination • self-terminating: no • message from neighbor: its link cost or msg from • column for each directly-attached “signal” to stop least cost path change neighbor) neighbor to node from neighbor asynchronous: • example: in node X, for dest. Y via neighbor Z: Distributed: • nodes need not recompute distance table exchange info/iterate • each node notifies in lock step! neighbors only when its least cost path to any distributed: distance from X to destination changes if least cost path to any X = Y, via Z as next hop •each node talks only D (Y,Z) – neighbors then notify dest has changed, notify with directly-attached Z neighbors = c(X,Z) + min {D (Y,w)} their neighbors if neighbors w necessary

Csci 232 – Computer Networks Routing and Network Layer Part II 37 Csci 232 – Computer Networks Routing and Network Layer Part II 38

Distance Vector Algorithm: Example Distance Vector Algorithm: Example

Y Y 2 1 2 1 X Z X Z c(X,Z) + min {D (Y,w)} X Z 7 D (Y,Z) = w 7 = 7+1 = 8

X Y c(X,Y) + min {D (Z,w)} D (Z,Y) = w = 2+1 = 3

Csci 232 – Computer Networks Routing and Network Layer Part II 39 Csci 232 – Computer Networks Routing and Network Layer Part II 40

Convergence of DV Routing Problems with DV Routing

• router detects local link cost change Link cost changes: 1 60 • updates distance table Y • good news travels fast Y 4 1 4 1 • if cost change in least cost path, notify • bad news travels slow X Z X Z neighbors 50 –“count to infinity” problem! 50

algorithm algorithm continues terminates on! “good news travels fast”

Csci 232 – Computer Networks Routing and Network Layer Part II 41 Csci 232 – Computer Networks Routing and Network Layer Part II 42

7 Count-to-Infinity Problem “Fixes” to Count-to-Infinity Problem

11 • Split horizon X Y Z – A router never advertises the cost of a destination to a neighbor 2 • If this neighbor is the next hop to that destination • Split horizon with poisonous reverse – If X routes traffic to Z via Y, then • X tells Y that its distance to Z is infinity – Instead of not telling anything at all – Accelerates convergence

Csci 232 – Computer Networks Routing and Network Layer Part II 43 Csci 232 – Computer Networks Routing and Network Layer Part II 44

Split Horizon with Poisoned Reverse Count-to-Infinity Problem

60 Revisited If Z routes through Y to get to X : Y 4 1 • Z tells Y its (Z’s) distance to X is X infinite (so Y won’t route to X via Z) Z 50 X Y Z

algorithm terminates W

Csci 232 – Computer Networks Routing and Network Layer Part II 45 Csci 232 – Computer Networks Routing and Network Layer Part II 46

Link State vs. Distance Vector (cont’d) Link State vs Distance Vector Message complexity Robustness: what happens 2 • Tells everyone about • Tells neighbors about •LS: O(n*e) messages if router malfunctions? everyone – n: number of nodes neighbors •LS: • Exchanges distance – e: number of edges • Controlled flooding to • DV: O(d*n*k) messages – node can advertise vectors with neighbors incorrect link cost exchange link state – d: node’s degree • Bellman-Ford –each node computes only • Dijkstra’s algorithm –k: number of ro unds its own table algorithm Time complexity • Each router computes •DV: • Each router’s table is • LS: O(n*log n) its own table – node can advertise used by others •DV: O(n) incorrect path cost • May have oscillations • May have routing loops Convergence time – each node’s table used by others; error propagate • Open Shortest Path • Routing Information •LS: O(1) through network Protocol (RIP) First (OSPF) •DV: O(k)

Csci 232 – Computer Networks Routing and Network Layer Part II 47 Csci 232 – Computer Networks Routing and Network Layer Part II 48

8 Routing in the Real World Routing in the Internet Our routing study thus far - idealization • all routers identical • The Global Internet consists of Autonomous Systems (AS) interconnected with each other hierarchically: • network “flat” – Stub AS: small corporation: one connection to other AS’s How to do routing in the Internet – Multihomed AS: large corporation (no transit): multiple • scalability and policy issues connections to other AS’s –Transit AS: pp,gmygrovider, hooking many AS’s together scale: with 200 million adiittidministrative autonomy • internet = network of destinations: • Two-level routing: • can’t store all dest’s in networks routing tables! • each network admin may – Intra-AS: administrator responsible for choice of • routing table exchange want to control routing in its routing algorithm within network would swamp links! own network – Inter-AS: unique standard for inter-AS routing: BGP

Csci 232 – Computer Networks Routing and Network Layer Part II 49 Csci 232 – Computer Networks Routing and Network Layer Part II 50

Internet Architecture Internet AS Hierarchy Internet: “networks of networks”! Inter-AS border (exterior gateway) routers

International NAP lines Internic

regional national on-line network network services

ISPcompany university ISP access via company modem LANs

Intra-AS interior (gateway) routers

Csci 232 – Computer Networks Routing and Network Layer Part II 51 Csci 232 – Computer Networks Routing and Network Layer Part II 52

Intra-AS vs. Inter-AS Routing Why Different Intra- and Inter-AS Routing?

Inter-AS Policy: C.b routing between B.a • Inter-AS: admin wants control over how its traffic A.a A and B Host routed, who routes through its net. b A.c c h2 a a • Intra-AS: single admin, so no policy decisions needed C b a B Host Scale: d Intra-AS routing h1 c • hierarchical routing saves table size, update traffic A b within AS B Intra-AS routing Performance: within AS A • Intra-AS: can focus on performance • Inter-AS: policy may dominate over performance

Csci 232 – Computer Networks Routing and Network Layer Part II 53 Csci 232 – Computer Networks Routing and Network Layer Part II 54

9 Intra-AS and Inter-AS Routing Intra-AS Routing C.b B.a “Gateways”: •perform inter- A.a • Also known as Interior Gateway Protocols (IGP) AS routing b c • Most common Intra-AS routing protocols: a A.c a amongst C b a B themselves •perform intra- – RIP: Routing Information Protocol d c A b AS routers with other routers in – OSPF: their AS – IS-IS: Intermediate System to Intermediate network layer System (OSI Standard) inter-AS, intra-AS link layer routing in – EIGRP: Extended Interior Gateway Routing gateway A.c physical layer Protocol (Cisco proprietary)

Csci 232 – Computer Networks Routing and Network Layer Part II 55 Csci 232 – Computer Networks Routing and Network Layer Part II 56

RIP ( Routing Information Protocol) RIP advertisements • Distance vector algorithm • Included in BSD-UNIX Distribution in 1982 • Distance vectors: exchanged among • Distance metric: # of hops (max = 15 hops) neighbors every 30 sec via Response Number of hops from source router A to various subnets: Message (also called advertisement) • Each advertisement: list of up to 25 destination hops u v u 1 destination nets within AS A B w v 2 w 2 x 3 x y 3 z C D z 2 y

Csci 232 – Computer Networks Routing and Network Layer Part II 57 Csci 232 – Computer Networks Routing and Network Layer Part II 58

RIP: Example RIP: Example Dest Next hops w -- Advertisement z x -- from A to D z C 4 w …. … ... xy z A D B w xy C A D B Destination Network Next Router Num. of hops to dest. w A2 C Destination Network Next Router Num. of hops to dest. y B2 w A2 z B7 y B2 x -- 1 z B A 7 5 …. …. .... x -- 1 Routing table in D …. …. .... Csci 232 – Computer Networks Routing and Network Layer Part II 59 Csci 232 – Computer Networks Routing and Network Layer Part II 60 Routing table in D

10 RIP: Link Failure and Recovery RIP Table processing If no advertisement heard after 180 sec --> neighbor/link declared dead – routes via neighbor invalidated • RIP routing tables managed by application-level – new advertisements sent to neighbors process called route-d (daemon) – neighbors in turn send out new advertisements (if tables • advertisements sent in UDP packets, periodically changed) repeated routed routed – link failure info quickly propagates to entire net – poison reverse used to prevent ping-pong loops (infinite Transprt Transprt distance = 16 hops) (UDP) (UDP) network forwarding forwarding network (IP) table table (IP) link link physical physical

Csci 232 – Computer Networks Routing and Network Layer Part II 61 Csci 232 – Computer Networks Routing and Network Layer Part II 62

OSPF (Open Shortest Path First) OSPF “advanced” features (not in RIP) • “open”: publicly available •Security:all OSPF messages authenticated (to • Uses Link State algorithm prevent malicious intrusion) – LS packet dissemination – Topology map at each node •Multiple same-cost paths allowed (only one path in – Route computation using Dijkstra’s algorithm RIP) • For each link , multi p le cos t me tr ics for differen t • OSPF advertisement carries one entry per neighbor TOS (e.g., satellite link cost set “low” for best effort; router high for real time) • Advertisements disseminated to entire AS (via • Integrated uni- and multicast support: flooding) – Multicast OSPF (MOSPF) uses same topology data base as – Carried in OSPF messages directly over IP (rather than TCP or UDP OSPF • Hierarchical OSPF in large domains.

Csci 232 – Computer Networks Routing and Network Layer Part II 63 Csci 232 – Computer Networks Routing and Network Layer Part II 64

Hierarchical OSPF Hierarchical OSPF • 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. – Communications between areas via backbone • Area bdborder rou ters: “i”“summarize” ditdistances 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.

Csci 232 – Computer Networks Routing and Network Layer Part II 65 Csci 232 – Computer Networks Routing and Network Layer Part II 66

11 Inter-AS Routing in the Internet: BGP Internet inter-AS routing: BGP

R4 R5 BGP • BGP (): the de R3 AS3 facto standard (OSPF intra-AS AS1 AS2 routing) • BGP provides each AS a means to: (RIP intra-AS (OSPF 1. Obtain subnet reachability information from neighboring routing) BGP intra-AS ASs. routing) 2. Propagate the reachability information to all routers R1 R2 internal to the AS. 3. Determine “good” routes to subnets based on reachability information and policy. Figure 4.5.2-new2: BGP use for inter-domain routing • Allows a subnet to advertise its existence to rest of the Internet: “I am here”

Csci 232 – Computer Networks Routing and Network Layer Part II 67 Csci 232 – Computer Networks Routing and Network Layer Part II 68

BGP basics Distributing reachability info

• Pairs of routers (BGP peers) exchange routing info over semi- • With eBGP session between 3a and 1c, AS3 sends prefix permanent TCP conctns: BGP sessions reachability info to AS1. • Note that BGP sessions do not correspond to physical links. • 1c can then use iBGP to distribute this new prefix reach info • When AS2 advertises a prefix to AS1, AS2 is promising it will to all routers in AS1 forward any datagrams destined to that prefix towards the • 1b can then re-advertise the new reach info to AS2 over the prefix. 1b-to-2a eBGP session – AS2 can aggregate prefixes in its advertisement • When router learns about a new prefix, it creates an entry for the prefix in its forwarding table.

3c 3c 3a 2c 3a 2c 3b 2a 3b 2a AS3 2b AS3 1c 2b AS2 1c AS2 1a 1b 1a 1b AS1 1d AS1 1d eBGP session eBGP session iBGP session Csci 232 – Computer Networks Routing and Network Layer Part II 69 Csci 232 – Computer Networks Routing and Network Layer Part IIiBGP session 70

Path attributes & BGP routes BGP route selection

• When advertising a prefix, advert includes BGP • Router may learn about more than 1 route attributes. to some prefix. Router must select route. – prefix + attributes = “route” • Two important attributes: • Elimination rules: –AS-PATH:contains the ASs through which the advert for the 1. Local preference value attribute: policy decision prefix passed: AS 67 AS 17 2. Shortest AS-PATH –NEXT-HOP:Indicates the specific internal-AS router to next- 3. Closest NEXT-HOP router: hot potato routing hop AS. (There may be multiple links from current AS to next- 4. Additional criteria hop-AS.) • When gateway router receives route advert, uses import policy to accept/decline.

Csci 232 – Computer Networks Routing and Network Layer Part II 71 Csci 232 – Computer Networks Routing and Network Layer Part II 72

12 BGP messages BGP routing policy legend: provider • BGP messages exchanged using TCP. B network X • BGP messages: W A customer –OPEN:opens TCP connection to peer and authenticates C network: sender –UPDATE:advertises new path (or withdraws old) Y

– KEEPALIVE keeps connection alive in absence of UPDATES; Figure 4.5-BGPnew: a simple BGP scenario also ACKs OPEN request • A,B,C are provider networks – NOTIFICATION: reports errors in previous msg; also used • X,W,Y are customer (of provider networks) to close connection •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

Csci 232 – Computer Networks Routing and Network Layer Part II 73 Csci 232 – Computer Networks Routing and Network Layer Part II 74

BGP routing policy (2) Why different Intra- and Inter-AS routing ? legend: provider B network Policy: X • Inter-AS: admin wants control over how its traffic W A customer routed, who routes through its net. C network: • Intra-AS: single admin, so no policy decisions needed Y Scale: Figure 4.5-BGPnew: a simple BGP scenario • A advertises to B the path AW • hierarchical routing saves table size, reduced update • B advertises to X the path BAW traffic • Should B advertise to C the path BAW? Performance: – No way! B gets no “revenue” for routing CBAW since neither W nor • Intra-AS: can focus on performance C are B’s customers • Inter-AS: policy may dominate over performance – B wants to force C to route to w via A – B wants to route only to/from its customers! Csci 232 – Computer Networks Routing and Network Layer Part II 75 Csci 232 – Computer Networks Routing and Network Layer Part II 76

Multi-Protocol Label Switching (MPLS) MPLS Capable Routers • initial goal: speed up IP forwarding by using fixed • a.k.a. label-switched router length label (instead of IP address) to do • forwards packets to outgoing interface based forwarding – borrowing ideas from Virtual Circuit (VC) approach only on label value (don’t inspect IP address) – but IP datagram still keeps IP address! – MPLS forwarding table distinct from IP forwarding tables • signaling protocol needed to set up forwarding PPP or –RSVP-TE, LDP MPLS header IP header remainder of link-layer frame header – forwarding possible along paths that IP alone would not allow (e.g., least cost path routing) !! – use MPLS for traffic engineering • must co-exist with IP-only routers label Exp S TTL

20 3 1 5

Csci 232 – Computer Networks Routing and Network Layer Part II 77 Csci 232 – Computer Networks Routing and Network Layer Part II 78

13 MPLS Forwarding Tables

in out out Why Mobile IP? label label dest interface 10 A 0 in out out 12 D 0 label label dest interface • Need a protocol which allows network 8 A 1 10 6 A 1 connectivity across host movement 12 9 D 0 • Protocol to enable mobility must not R6 0 0 D require massive changes to router 1 1 R4 R3 software, etc. R5 0 0 A • Must be compatible with large installed R2 in outR1 out base of IPv4 networks/hosts in out out label label dest interface label label dest interface 6 - A 0 • Confine changes to mobile hosts and a 8 6 A 0 few support hosts which enable mobility

Csci 232 – Computer Networks Routing and Network Layer Part II 79 Csci 232 – Computer Networks Routing and Network Layer Part II 80

Internet Protocol (IP) IP Routing Breaks Under Mobility

• Network layer, "best-effort" packet delivery .50 .52 .53 • Supports UDP and TCP (transport layer protocols) router • IP host addresses consist of two parts – network id + host id 137.30.2.* • By design, IP host address is tied to home network address .200 – Hosts are assumed to be wired, immobile – Intermediate routers look only at network address router – Mobility without a change in IP address results in un-route-able packets 139.20.3.* Why this hierarchical approach? Answer: Scalability! Millions of network addresses, billions of hosts!

Csci 232 – Computer Networks Routing and Network Layer Part II 81 Csci 232 – Computer Networks Routing and Network Layer Part II 82

Mobile IP: Basics Mobile IP: Basics, Cont. • Proposed by IETF (Internet Engineering Task • Correspondent host is a host that wants to send Force) packets to the mobile host – Standards development body for the Internet • Correspondent host sends packets to the mobile • Mobile IP allows a mobile host to move about host’s IP permanent address without changing its permanent IP address • These packets are routed to the mobile host’s • Each mobile host has a home agent on its home home network network • Home agent forwards IP packets for mobile host • Mobile host establishes a care-of address when to current care-of address it's away from home • Mobile host sends packets directly to correspondent, using permanent home IP as source IP

Csci 232 – Computer Networks Routing and Network Layer Part II 83 Csci 232 – Computer Networks Routing and Network Layer Part II 84

14 Mobile IP: Care-of Addresses Mobile IP: Basics, Cont. • Whenever a mobile host connects to a remote network, two choices: – care-of can be the address of a foreign agent on the remote network • foreign agent delivers packets forwarded from home agent to mobblile host – care-of can be a temporary, foreign IP address obtained through, e.g., DHCP • home agent tunnels packets directly to the temporary IP address • Regardless, care-of address must be registered with home agent correspondent host home agent

Csci 232 – Computer Networks Routing and Network Layer Part II 85 Csci 232 – Computer Networks Routing and Network Layer Part II 86

IP-in-IP Tunneling At the Other End... • Packet to be forwarded is encapsulated in a new IP packet • Depending on type of care-of address: – Foreign agent or • In the new header: –Mobile host – Destination = care-of-address – Source = address of home agent •… strips out e r IP hea de r o f tunne le d – Protocol number = IP-in-IP packet, which is then fed to the mobile host IP header IP header • Aside: Any thoughts on advantages of IP header data foreign agent vs. co-located (foreign IP) data address?

Csci 232 – Computer Networks Routing and Network Layer Part II 87 Csci 232 – Computer Networks Routing and Network Layer Part II 88

Routing Inefficiency Route Optimizations • Possible Solution: Mobile host and correspondent host – Home agent sends current care-of address to correspondent might even be on the same host network!! – Correspondent host caches care-of address – Future packets tunneled directly to care-of address • B!But! – An instance of the cache consistency problem arises... – Cached care-of address becomes stale when the mobile host moves – Potential security issues with providing care-of address to correspondent

correspondent host home agent

Csci 232 – Computer Networks Routing and Network Layer Part II 89 Csci 232 – Computer Networks Routing and Network Layer Part II 90

15 Network Layer Part II Summary

Possible Route Optimization • Network Layer Routing – Basic Issues – Distributed Routing Algorithms: LS vs. DV – Link State (LS): How does it work? – Distance Vector (DV): How does it work? Issues? – Mobile IP: how does it work? Issues? –MPLS • Routing in the Internet – Intra-AS vs. Inter-AS routing – Intra-AS: RIP and OSPF – Inter-AS: BGP and Policy Routing • Things we didn’t cover: VPN, IP Multicast, IPv6 (but please read by yourself!)

Csci 232 – Computer Networks Routing and Network Layer Part II 91 Csci 232 – Computer Networks Routing and Network Layer Part II 92

16