routing & forwarding: routing: network layer part ii logical view

16
1 Routing: Network Layer Part II Routing Algorithms: Link state vs. Distance Vector Routing in the Internet Intra-AS vs. Inter-AS routing Intra-AS: RIP and OSPF Csci 232 – Computer Networks Routing and Network Layer Part II 1 Inter-AS: BGP and Policy Routing MPLS Readings: Textbook: Chapter 4: Sections 4.2-4.3, 4.5-4.6 Routing & Forwarding: Logical View of a Router A E D C B F 2 2 1 3 1 1 2 5 3 5 Csci 232 – Computer Networks Routing and Network Layer Part II 2 1 1. Remove a packet from an input queue 2. Check for sanity, decrement TTL field 4. Place packet on correct output queue IP Forwarding Process Csci 232 – Computer Networks 3 Forwarding Process IP Forwarding Table Router 3. Match packet’s destination to a table entry If queues get full, just drop packets! If queues get full, just drop packets! Destination Next Hop Interface Net A Net B N CH 3 Router 1 Direct R 2 INT 7 INT 3 INT 4 IP Forwarding Table Csci 232 – Computer Networks 4 Net C, Host 3 Router 2 Router 1 INT 7 INT 3 A destination is usually a network. May also be a host, or a “gateway of last resort” (default) The next hop is either a directly connected network or a router on a directly connected network A physical interface Net C Statically Dynamically Routers exchange network reachability information using ROUTING PROTOCOLS . Routers use this to compute best routes Administrator manually configures forwarding table entries + More control + Can rapidly adapt to changes i t kt l How Are Forwarding Tables Populated to Implement Routing? Csci 232 – Computer Networks 5 In practice : a mix of these. Static routing mostly at the “edge” + Not restricted to destination-based forwarding - Doesn’t scale - Slow to adapt to network failures in network topology + Can be made to scale well - Complex distributed algorithms - Consume CPU, Bandwidth, Memory - Debugging can be difficult - Current protocols are destination-based Dynamic Routing: Intra- vs. Inter-AS AS 1 BGP OSPF Csci 232 – Computer Networks Routing and Network Layer Part II 6 AS 2 EGP = Exterior Gateway Protocol IGP = Interior Gateway Protocol Metric based: OSPF, IS-IS, RIP, EIGRP (cisco) Policy based: BGP The Routing Domain of BGP is the entire Internet EIGRP

Upload: others

Post on 03-Feb-2022

17 views

Category:

Documents


0 download

TRANSCRIPT

1

Routing: Network Layer Part II• Routing Algorithms:

– Link state vs. Distance Vector• Routing in the Internet

– Intra-AS vs. Inter-AS routing– Intra-AS: RIP and OSPF

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

– Inter-AS: BGP and Policy Routing

• MPLSReadings: Textbook: Chapter 4:

Sections 4.2-4.3, 4.5-4.6

Routing & Forwarding:Logical View of a Router

A

ED

CB

F2

21

3

1

12

53

5

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

1

1. Remove a packetfrom an input

queue

2. Check for sanity, decrement TTL

field

4. Place packet oncorrect output

queue

IP Forwarding Process

Csci 232 – Computer Networks 3

Forwarding Process

IP Forwarding Table Router

3. Match packet’s destination toa table entry

If queuesget full, just

drop packets!

If queuesget full, just

drop packets!

Destination Next Hop Interface

Net ANet BN C H 3

Router 1DirectR 2

INT 7

INT 3INT 4

IP Forwarding Table

Csci 232 – Computer Networks 4

Net C, Host 3 Router 2Router 1 INT 7

INT 3

A destination is usuallya network. May also be a host, or a “gateway of last resort” (default)

The next hop is either a directly connected network or a router on a directly connected network

A physical interface

Net C

Statically Dynamically

Routers exchange network reachability information using ROUTING PROTOCOLS. Routers use this to compute best routes

Administrator manually configuresforwarding table entries

+ More control+ Can rapidly adapt to changes

i t k t l

How Are Forwarding Tables Populated to Implement Routing?

Csci 232 – Computer Networks 5

In practice : a mix of these.Static routing mostly at the “edge”

+ Not restricted to destination-based forwarding

- Doesn’t scale- Slow to adapt to

network failures

in network topology+ Can be made to scale well- Complex distributed algorithms- Consume CPU, Bandwidth, Memory- Debugging can be difficult- Current protocols are destination-based

Dynamic Routing: Intra- vs. Inter-AS

AS 1 BGP

OSPF

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

AS 2EGP = Exterior Gateway Protocol

IGP = Interior Gateway Protocol

Metric based: OSPF, IS-IS, RIP, EIGRP (cisco)

Policy based: BGP

The Routing Domain of BGP is the entire Internet

EIGRP

2

Internet AS Hierarchy

border (exterior gateway) routers

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

interior routers

Intra-AS vs. Inter-AS Routing

Host h2

ab

aaC

B

A.aA.c

C.bB.a

cb

Inter-ASroutingbetween A and B

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

b

a

A

Bd c

Hosth1

Intra-AS routingwithin AS A

Intra-AS routingwithin AS B

Intra-AS and Inter-AS Routing“Gateways”:

•perform inter-AS routing amongst themselves•perform intra-AS routing with

a

b

b

aaC

A

Bd

A.aA.c

C.bB.a

cb

c

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

physical layer

other routers in their AS

inter-AS, intra-AS routing in

gateway A.c

network layerlink layer

BGPOSPF Process

OSPF Routing tables

RIP Process

RIP Routing tables

BGP Process

BGP Routing tables

Where Does Forwarding Table Come From?

Csci 232 – Computer Networks 10

Forwarding Table

OSPFDomain

RIPDomain Forwarding Table Manager

Routing• Goal: determine a “good” path through

the network from source to destination– Good means usually the shortest path

• Network modeled as a graph5

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

– Routers nodes– Link edges

• Edge cost: delay, congestion level,… A

ED

CB

F

2

2

13

1

1

2

53

5

Basic Routing Problem• Assume

– A network with N nodes, where each edge is associated a cost

– A node knows only its neighbors and the cost to reach them

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

• How does each node learn how to reach every other node along the shortest path?

A

ED

CB

F

2

2

13

1

1

2

53

5

3

Routing: Issues

• How are routing tables determined?• Who determines table entries?• What info is used in determining table

entries?

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

entries?• When do routing table entries change?• Where is routing info stored?• How to control routing table size?Answer these questions, we are done!

Routing Paradigms• Hop-by-hop Routing

– Each packet contains destination address– Each router chooses next-hop to destination

• routing decision made at each (intermediate) hop!• packets to same destination may take different paths!

– Example: IP’s default datagram routing

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

Example: IP s default datagram routing• Source Routing

– Sender selects the path to destination precisely– Routers forward packet to next-hop as specified

• Problem: if specified path no longer valid due to link failure!– Example:

• IP’s loose/strict source route option • virtual circuit setup phase in ATM (or MPLS)

Routing Algorithms/ProtocolsIssues Need to Be Addressed:• Route selection may depend on different criteria

– Performance: choose route with the smallest delay– Policy: choose a route that doesn’t cross .gov network

• Adapt to changes in network topology or condition

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

• Adapt to changes in network topology or condition– Self-healing: little or no human intervention

• Scalability– Must be able to support a large number of hosts, routers

Centralized vs. Distributed Routing Algorithms

Centralized:• A centralized route server collects routing information and

network topology, makes route selection decisions, then distributes them to routers

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

Distributed:• Routers cooperate using a distributed protocol

– to create mutually consistent routing tables• Two standard distributed routing algorithms

– Link State (LS) routing – Distance Vector (DV) routing

Link State vs Distance Vector• Both assume that

– The address of each neighbor is known– The cost of reaching each neighbor is known

• Both find global information

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

g– By exchanging routing info among neighbors

• Differ in the information exchanged and route computation– LS: tells every other node its distances to neighbors– DV: tells neighbors its distance to every other node

Link State Algorithm

• Basic idea: Distribute link state packet to all routers– Topology of the network

Cost of each link in the network

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

• Cost of each link in the network

• Each router independently computes optimal paths– From itself to every destination– Routes are guaranteed to be loop free if

• Each router sees the same cost for each link• Uses the same algorithm to compute the best path

4

Link State: Control Traffic• Each node floods its local information to every

other node in the network• Each node ends up knowing the entire network

topology use Dijkstra to compute the shortest path to every other node

Host A Host D

Host C

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

Host BHost E

N1 N2

N3

N4

N5

N7N6

Link State: Node State

Host A Host D

Host C

N1 N2

A

BE

DC

A

BE

DC A

BE

DC

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

Host BHost E

N1 N2

N3

N4

N5

N7N6

A

BE

DC

A

BE

DC

A

BE

DC

A

BE

DC

Topology Dissemination

• Each router creates a set of link state packets (LSPs)– Describing its links to neighbors– LSP contains

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

• Router id, neighbor’s id, and cost to its neighbor

• Copies of LSPs are distributed to all routers– Using controlled flooding

• Each router maintains a topology database– Database containing all LSPs

CB2 5

3

5

Topology Database: Example

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

A

ED

F2

13

1

1

2

link state database

Constructing Routing Table:Dijkstra’s Algorithm

• Given the network topology– How to compute the shortest path to each destination?

• Some notation

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

– X: source node– N: set of nodes to which shortest paths are known so far

• N is initially empty– D(V): the cost of the known shortest path from source X

to V– C(U,V): cost of link U to V

• C(U,V) = if not neighbors

Algorithm (at Node X)

• Initialization– N = {X}– For all nodes V

• If V adjacent to X D(V) = C(X V) else D(V) =

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

If V adjacent to X, D(V) = C(X,V) else D(V) =

• Loop– Find U not in N such that D(U) is the smallest– Add U into set N– Update D(V) for all V not in N

• D(V) = min{D(V), D(U) + C(U,V)}– Until all nodes in N

5

Example: Dijkstra’s AlgorithmStep

01234

start NA

D(B),p(B)2,A

D(C),p(C)5,A

D(D),p(D)1,A

D(E),p(E) D(F),p(F)

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

5

A

ED

CB

F

2

2

13

1

1

2

53

5 1 Initialization:2 N = {A};3 for all nodes v4 if v adjacent to A5 then D(v) = c(A,v); 6 else D(v) = ;…

Example: Dijkstra’s AlgorithmStep

01234

start NA

AD

D(B),p(B)2,A

D(C),p(C)5,A4,D

D(D),p(D)1,A

D(E),p(E)

2,D

D(F),p(F)

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

5

A

ED

CB

F

2

2

13

1

1

2

53

5…8 Loop9 find w not in N s.t. 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 until all nodes in N;

Example: Dijkstra’s AlgorithmStep

01234

start NA

ADADE

D(B),p(B)2,A

D(C),p(C)5,A4,D3,E

D(D),p(D)1,A

D(E),p(E)

2,D

D(F),p(F)

4,E

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

5

A

ED

CB

F

2

2

13

1

1

2

53

5…8 Loop9 find w not in N s.t. 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 until all nodes in N;

Example: Dijkstra’s AlgorithmStep

01234

start NA

ADADE

ADEB

D(B),p(B)2,A

D(C),p(C)5,A4,D3,E

D(D),p(D)1,A

D(E),p(E)

2,D

D(F),p(F)

4,E

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

5

A

ED

CB

F

2

2

13

1

1

2

53

5…8 Loop9 find w not in N s.t. 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 until all nodes in N;

Example: Dijkstra’s AlgorithmStep

01234

start NA

ADADE

ADEBADEBC

D(B),p(B)2,A

D(C),p(C)5,A4,D3,E

D(D),p(D)1,A

D(E),p(E)

2,D

D(F),p(F)

4,E

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

5

A

ED

CB

F

2

2

13

1

1

2

53

5…8 Loop9 find w not in N s.t. 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 until all nodes in N;

Example: Dijkstra’s AlgorithmStep

01234

start NA

ADADE

ADEBADEBC

D(B),p(B)2,A

D(C),p(C)5,A4,D3,E

D(D),p(D)1,A

D(E),p(E)

2,D

D(F),p(F)

4,E

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

5 ADEBCF

A

ED

CB

F

2

2

13

1

1

2

53

5…8 Loop9 find w not in N s.t. 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 until all nodes in N;

6

Dijkstra’s Algorithm: In a NutshellStep

01234

start NA

ADADE

ADEBADEBC

D(B),p(B)2,A2,A2,A

D(C),p(C)5,A4,D3,E3,E

D(D),p(D)1,A

D(E),p(E)infinity

2,D

D(F),p(F)infinityinfinity

4,E4,E4,E

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

5 ADEBCF

A

ED

CB

F2

21

3

1

1

2

53

5

CB2 5

3

5

Routing Table Computation

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

A

ED

F

2

2

13

1

1

2

5dest next

B BC DD DE DF D

Distance Vector Routing• A router tells neighbors its distance to every

router– Communication between neighbors only

• Based on Bellman-Ford algorithm– Computes “shortest paths”

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

• Each router maintains a distance table– A row for each possible destination– A column for each neighbor

• DX(Y,Z) : distance from X to Y via Z• Exchanges distance vector (the table) with

neighbors– Distance vector: current least cost to each destination

Distance Vector: Control Traffic• When the routing table of a node changes, the node

sends its table to its neighbors• A node updates its table with information received

from its neighbors

Host A Host D

Host C

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

Host BHost E

N1 N2

N3

N4

N5

N7N6

Distance Table: Example

A

CB6

8

1

2

D ()

A

A

1

B

14

D

11

Ecost to destination via

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

E D

81

2

2B

C

D

7

8

10

8

9

11

5

4

2

Distance Table to Routing Table

D ()

A

B

A

1

7

B

14

8

D

5

5

Ecost to destination via

A

B

A,1

D 5

Outgoing link to use, cost

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

B

C

D

7

6

4

8

9

11

5

4

2

B

C

D

D,5

D,4

D,2

Distance table Routing table

7

Distance Vector Routing Algorithmiterative:• continues until no

nodes exchange info.• self-terminating: no

“signal” to stopasynchronous:

Distance Table data structure• each node has its own• row for each possible destination• column for each directly-attached

neighbor to node• example: in node X for dest Y via

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

asynchronous:• nodes need not

exchange info/iterate in lock step!

distributed:• each node talks only

with directly-attached neighbors

• example: in node X, for dest. Y via neighbor Z:

D (Y,Z)X

distance from X toY, via Z as next hop

c(X,Z) + min {D (Y,w)}Z

w

=

=

Distance Vector Routing: OverviewIterative, asynchronous:

each iteration caused by: • local link cost change • message from neighbor: its

least cost path change from neighbor

wait for (change in local link cost or msg from neighbor)

Each node:

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

Distributed:• each node notifies

neighbors only when its least cost path to any destination changes– neighbors then notify

their neighbors if necessary

recompute distance table

if least cost path to any

dest has changed, notifyneighbors

Distance Vector Algorithm: Example

X Z12

7

Y

D (Y,Z)X

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

Z

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

= 7+1 = 8

D (Z,Y)X

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

= 2+1 = 3

Y

Distance Vector Algorithm: Example

X Z12

7

Y

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

Convergence of DV Routing• router detects local link cost change • updates distance table• if cost change in least cost path, notify

neighbors X Z14

50

Y1

algorithm

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

algorithmterminates

“goodnews travelsfast”

Problems with DV RoutingLink cost changes:• good news travels fast • bad news travels slow

– “count to infinity” problem!X Z

14

50

Y60

algorithmi

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

continueson!

8

Count-to-Infinity Problem

X Y Z1 1

2

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

“Fixes” to Count-to-Infinity Problem

• Split horizon– A router never advertises the cost of a

destination to a neighbor• If this neighbor is the next hop to that destination

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

• 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

Split Horizon with 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) X Z14

50

Y60

algorithm

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

algorithmterminates

Count-to-Infinity Problem Revisited

X Y Z

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

W

Link State vs Distance Vector

• Tells everyone about neighbors

• Controlled flooding to exchange link state

• Dijkstra’s algorithm

• Tells neighbors about everyone

• Exchanges distance vectors with neighbors

• Bellman-Ford

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

• Dijkstra s algorithm• Each router computes

its own table• May have oscillations• Open Shortest Path

First (OSPF)

algorithm• Each router’s table is

used by others• May have routing loops• Routing Information

Protocol (RIP)

Link State vs. Distance Vector (cont’d)Message complexity• LS: O(n2*e) messages

– n: number of nodes – e: number of edges

• DV: O(d*n*k) messages– d: node’s degree– k: number of rounds

Robustness: what happens if router malfunctions?

• LS: – node can advertise

incorrect link cost– each node computes only

its own table

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

um f uTime complexity• LS: O(n*log n) • DV: O(n)Convergence time• LS: O(1)• DV: O(k)

its own table• DV:

– node can advertise incorrect path cost

– each node’s table used by others; error propagate through network

9

Routing in the Real World

d i i t ti t

Our routing study thus far - idealization • all routers identical• network “flat”

How to do routing in the Internet• scalability and policy issues

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

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

Routing in the Internet• The Global Internet consists of Autonomous Systems

(AS) interconnected with each other hierarchically:– Stub AS: small corporation: one connection to other AS’s– Multihomed AS: large corporation (no transit): multiple

connections to other AS’s– Transit AS: provider, hooking many AS’s together

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

p , g m y g

• Two-level routing: – Intra-AS: administrator responsible for choice of

routing algorithm within network– Inter-AS: unique standard for inter-AS routing: BGP

Internet Architecture

International linesNAP

Internic

Internet: “networks of networks”!

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

LANs

ISP ISPcompany university

national network

regionalnetwork

on-line services

companyaccess via

modem

Internet AS Hierarchy

Inter-AS border (exterior gateway) routers

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

Intra-AS interior (gateway) routers

Intra-AS vs. Inter-AS Routing

Host h2

ab

aaC

B

A.aA.c

C.bB.a

cb

Inter-ASroutingbetween A and B

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

b

a

A

Bd c

Hosth1

Intra-AS routingwithin AS A

Intra-AS routingwithin AS B

Why Different Intra- and Inter-AS Routing?

Policy:• Inter-AS: admin wants control over how its traffic

routed, who routes through its net. • Intra-AS: single admin, so no policy decisions neededScale:

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

Scale:• hierarchical routing saves table size, update trafficPerformance:• Intra-AS: can focus on performance• Inter-AS: policy may dominate over performance

10

Intra-AS and Inter-AS Routing“Gateways”:

•perform inter-AS routing amongst themselves•perform intra-AS routers with

a

b

b

aaC

A

Bd

A.aA.c

C.bB.a

cb

c

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

physical layer

other routers in their AS

inter-AS, intra-AS routing in

gateway A.c

network layerlink layer

Intra-AS Routing• Also known as Interior Gateway Protocols (IGP)• Most common Intra-AS routing protocols:

– RIP: Routing Information Protocol

OSPF: Open Shortest Path First

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

– OSPF: Open Shortest Path First– IS-IS: Intermediate System to Intermediate

System (OSI Standard)– EIGRP: Extended Interior Gateway Routing

Protocol (Cisco proprietary)

RIP ( Routing Information Protocol)

• Distance vector algorithm• Included in BSD-UNIX Distribution in 1982• Distance metric: # of hops (max = 15 hops)

Number of hops from source router A to various subnets:

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

DC

BA

u vw

x

yz

destination hopsu 1v 2w 2x 3y 3z 2

RIP advertisements

• Distance vectors: exchanged among neighbors every 30 sec via Response Message (also called advertisement)

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

• Each advertisement: list of up to 25 destination nets within AS

RIP: Example

w x y

z

A

C

D B

Csci 232 – Computer Networks Routing and Network Layer Part II 59

Destination Network Next Router Num. of hops to dest.w A 2y B 2z B 7x -- 1…. …. ....

C

Routing table in D

RIP: Example

w x y

z

A D B

Dest Next hopsw - -x - -z C 4…. … ...

Advertisementfrom A to D

Csci 232 – Computer Networks Routing and Network Layer Part II 60

Destination Network Next Router Num. of hops to dest.w A 2y B 2z B A 7 5x -- 1…. …. ....

Routing table in D

C

11

RIP: Link Failure and RecoveryIf no advertisement heard after 180 sec -->

neighbor/link declared dead– routes via neighbor invalidated– new advertisements sent to neighbors– neighbors in turn send out new advertisements (if tables

changed)

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

changed)– link failure info quickly propagates to entire net– poison reverse used to prevent ping-pong loops (infinite

distance = 16 hops)

RIP Table processing

• RIP routing tables managed by application-levelprocess called route-d (daemon)

• advertisements sent in UDP packets, periodically repeated

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

repeated

physicallink

network forwarding(IP) table

Transprt(UDP)

routed

physicallink

network(IP)

Transprt(UDP)

routed

forwardingtable

OSPF (Open Shortest Path First)• “open”: publicly available• Uses Link State algorithm

– LS packet dissemination– Topology map at each node– Route computation using Dijkstra’s algorithm

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

• 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)• Security: all OSPF messages authenticated (to

prevent malicious intrusion) • Multiple same-cost paths allowed (only one path in

RIP)F h li k lti l t t i f diff t

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

• For each link, multiple cost metrics for different TOS (e.g., satellite link cost set “low” for best effort; high for real time)

• Integrated uni- and multicast support: – Multicast OSPF (MOSPF) uses same topology data base as

OSPF• Hierarchical OSPF in large domains.

Hierarchical OSPF

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

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

A b d t “ i ” di t t t

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

• 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.

12

Inter-AS Routing in the Internet: BGP

AS2 (OSPF

AS1 (RIP intra AS

AS3 (OSPF intra-AS

routing)

BGP

R3

R4

R5

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

Figure 4.5.2-new2: BGP use for inter-domain routing

(OSPF intra-AS routing)

(RIP intra-AS routing) BGP

R1 R2

Internet inter-AS routing: BGP

• BGP (Border Gateway Protocol): the de facto standard

• BGP provides each AS a means to:1 Obtain subnet reachability information from neighboring

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

1. Obtain subnet reachability information from neighboring ASs.

2. Propagate the reachability information to all routers internal to the AS.

3. 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• 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

Csci 232 – Computer Networks Routing and Network Layer Part II 69

3b

1d

3a

1c2aAS3

AS1

AS21a

2c

2b

1b

3c

eBGP session

iBGP session

Distributing reachability info• With eBGP session between 3a and 1c, AS3 sends prefix

reachability info to AS1.• 1c can then use iBGP to 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.

Csci 232 – Computer Networks Routing and Network Layer Part II 70

3b

1d

3a

1c2aAS3

AS1

AS21a

2c

2b

1b

3c

eBGP session

iBGP session

Path attributes & BGP routes

• When advertising a prefix, advert includes BGP attributes. – prefix + attributes = “route”

• Two important attributes:

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

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

• Router may learn about more than 1 route to some prefix. Router must select route.

• Elimination rules:

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

1. Local preference value attribute: policy decision2. Shortest AS-PATH 3. Closest NEXT-HOP router: hot potato routing4. Additional criteria

13

BGP messages• BGP messages exchanged using TCP.• BGP messages:

– OPEN: opens TCP connection to peer and authenticates sender

– UPDATE: advertises new path (or withdraws old)

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

– 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

A

B

C

W X

Y

legend:

customer network:

provider network

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

Figure 4.5-BGPnew: a simple BGP scenario • 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)

A

B

C

W X

Y

legend:

customer network:

provider network

Csci 232 – Computer Networks Routing and Network Layer Part II 75

Figure 4.5-BGPnew: a simple BGP scenario • 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 ?Policy:• Inter-AS: admin wants control over how its traffic

routed, who routes through its net. • Intra-AS: single admin, so no policy decisions neededScale:

Csci 232 – Computer Networks Routing and Network Layer Part II 76

Scale:• hierarchical routing saves table size, reduced update

trafficPerformance:• Intra-AS: can focus on performance• Inter-AS: policy may dominate over performance

Multi-Protocol Label Switching (MPLS)• initial goal: speed up IP forwarding by using fixed

length label (instead of IP address) to do forwarding – borrowing ideas from Virtual Circuit (VC) approach– but IP datagram still keeps IP address!

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

PPP or Ethernet header

IP header remainder of link-layer frameMPLS header

label Exp S TTL

20 3 1 5

MPLS Capable Routers• a.k.a. label-switched router• forwards packets to outgoing interface based

only on label value (don’t inspect IP address)– MPLS forwarding table distinct from IP forwarding tables

• signaling protocol needed to set up forwarding

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

signaling protocol needed to set up forwarding– RSVP-TE, LDP– 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

14

0R6

in out outlabel label dest interface

10 6 A 112 9 D 0

in out outlabel label dest interface

10 A 012 D 0

8 A 1

MPLS Forwarding Tables

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

R1R2

D

R3R4R5

0

100

Ain out out

label label dest interface

6 - A 0

1

in out outlabel label dest interface

8 6 A 0

0

Why Mobile IP?• Need a protocol which allows network

connectivity across host movement• Protocol to enable mobility must not

require massive changes to router

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

require massive changes to router software, etc.

• Must be compatible with large installed base of IPv4 networks/hosts

• Confine changes to mobile hosts and a few support hosts which enable mobility

Internet Protocol (IP)• Network layer, "best-effort" packet delivery• Supports UDP and TCP (transport layer protocols)• IP host addresses consist of two parts

– network id + host id• By design IP host address is tied to home network

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

• By design, IP host address is tied to home network address– Hosts are assumed to be wired, immobile– Intermediate routers look only at network address– Mobility without a change in IP address results in

un-route-able packets

IP Routing Breaks Under Mobility

137.30.2.*

.50 .52 .53

router

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

Why this hierarchical approach? Answer: Scalability!Millions of network addresses, billions of hosts!

router

139.20.3.*

.200

Mobile IP: Basics• Proposed by IETF (Internet Engineering Task

Force)– Standards development body for the Internet

• Mobile IP allows a mobile host to move about without changing its permanent IP address

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

without changing its permanent IP address• Each mobile host has a home agent on its home

network• Mobile host establishes a care-of address when

it's away from home

Mobile IP: Basics, Cont.• Correspondent host is a host that wants to send

packets to the mobile host• Correspondent host sends packets to the mobile

host’s IP permanent address• These packets are routed to the mobile host’s

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

These packets are routed to the mobile host s home network

• Home agent forwards IP packets for mobile host to current care-of address

• Mobile host sends packets directly to correspondent, using permanent home IP as source IP

15

Mobile IP: Basics, Cont.

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

home agentcorrespondent host

Mobile IP: Care-of Addresses

• 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

b l h

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

to mobile 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 registeredwith home agent

IP-in-IP Tunneling• Packet to be forwarded is encapsulated

in a new IP packet• In the new header:

– Destination = care-of-address

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

IP header

– Source = address of home agent– Protocol number = IP-in-IP

IP headerdata IP header

data

At the Other End...

• Depending on type of care-of address:– Foreign agent or– Mobile host

strips ut r IP h d r f tunn l d

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

• … strips outer IP header of tunneled packet, which is then fed to the mobile host

• Aside: Any thoughts on advantages of foreign agent vs. co-located (foreign IP) address?

Routing InefficiencyMobile host and correspondent hostmight even be on the samenetwork!!

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

home agentcorrespondent host

Route Optimizations• Possible Solution:

– Home agent sends current care-of address to correspondent host

– Correspondent host caches care-of address– Future packets tunneled directly to care-of address

B !

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

• 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

16

Possible Route Optimization

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

Network Layer Part II Summary• 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?

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

– 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!)