Lecture 9 Network Layer (cont’d)

27
Lecture 9 Network Layer (cont’d) Network Layer 1-1

Transcript of Lecture 9 Network Layer (cont’d)

Lecture 9

Network Layer (cont’d)

Network Layer 1-1

Agenda

Routing Tables

Unicast and Multicast Routing Protocols

Routing Algorithms

Link State and Distance Vector

Routing Information and Open Shortest Path First

Protocols

Network Layer 1-2

Network Layer 5-3

Introduction to the Network Layer (Recall)

transport segment from sending to receiving host

on sending side encapsulates segments into datagrams

on rcving side, delivers segments to transport layer

network layer protocols in every host, router

router examines header fields in all IP datagrams passing through it

application transport network data link physical

application transport network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

Routing Tables A host or a router has a routing table with an entry for

each destination, or a combination of destinations

Routing tables: static (updated manually) or dynamic (updated automatically periodically)

Routing methods Next-Hop Method Versus Route Method

Network Layer 1-4

Routing Tables

Routing methods Network-Specific Method Versus Host-Specific Method

Network Layer 1-5

Network Layer 4-6

1

2 3

0111

value in arriving

packet’s header

routing algorithm

local forwarding table

header value output link

0100

0101

0111

1001

3

2

2

1

Interplay between Routing Algorithms and Forwarding Tables

the job of routing algorithm is to determine good paths from senders to receivers, through a network of routers

Typically, a good path is one that has the least cost

Routing Protocols Routing protocols have been created in response

to the demand for dynamic routing tables

A routing protocol is a combination of rules and procedures that lets routers in the Internet inform each other of routing changes

share whatever they know about the Internet or their neighborhood

Unicast Routing Protocols Forwarding data packets from a source to a destination

on a network

Multicast Routing Protocols Forwarding data packets from a source to multiple

destinations Network Layer 1-7

Routing Protocols

Network Layer 1-8

AS: Autonomous System

Network Layer 4-9

u

y x

w v

z 2

2

1 3

1

1

2

5 3

5

Graph: G = (N,E)

N = set of routers = { u, v, w, x, y, z }

E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }

Routing Problem Formulation (Graph abstraction) Link’s cost may

reflect: - Link’s physical

length - The link speed - The monetary

cost associated with a link

Network Layer 4-10

Graph abstraction: costs

u

y x

w v

z 2

2

1 3

1

1

2

5 3

5

• c(x,x’) = cost of link (x,x’) = cost of link (x’,x) - e.g., c(w,z) = c(z,w) = 5

Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)

Question: What’s the least-cost (or shortest) path between u and z ?

Routing algorithm: algorithm that finds least-cost path

Note: shortest path is the source-destination path with the smallest number of links

Network Layer 4-11

Routing Algorithm Classification

Global or decentralized information?

Global:

all routers have complete topology, link cost info (proactive algorithm)

“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 Suitable for proactive

routing protocols

Updates might not be req.

Dynamic:

routes change more quickly

periodic update

in response to link cost changes

Network Layer 4-12

A Link-State Routing Algorithm net topology and link costs known to all nodes (global info.)

accomplished via “link state broadcast”

all nodes have same info

Example: Open short path first (OSPF) routing protocol uses link-state routing algorithm such as Dijkstra’s algorithm

Dijkstra’s algorithm computes least cost paths from one node (‘source”) to all

other nodes

gives forwarding table for that node

iterative: after k iterations, know least cost path to k destinations

Algorithm complexity: n nodes n(n-1)/2 comparisons: O(n2) polynomial complexity more efficient implementations possible: O(nlog(n))

Network Layer 4-13

Dijkstra’s algorithm: example

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

Network Layer 4-14

Distance Vector Algorithm Iterative, asynchronous, and distributed algorithm

Distributed: node receives some information from one or more of its directly attached neighbors (decentralized information)

Iterative: route discovery process continues on until no more information is exchanged between neighbors

Asynchronous: does not require all of the nodes to operate in lockstep with each other

From time-to-time, each node sends its own distance vector estimate to neighbors (e.g., may be at having link cost updates)

Example: Bellman-Ford algorithm in Routing Information protocol (RIP)

Define • dx(y) := cost of least-cost path from x to y

• Then: dx(y) = min {c(x,v) + dv(y) }

where min is taken over all neighbors v of x

v

Network Layer 4-15

Comparison of Link State (LS) and Distance Vector (DV) Algorithms

Message complexity LS: with n nodes, E links,

O(nE) msgs sent

DV: exchange between neighbors only

convergence time varies

Speed of Convergence LS: O(n2) algorithm requires

O(nE) msgs

may have oscillations

DV: convergence time varies

may be routing loops

(count-to-infinity problem)

Robustness: what happens if router malfunctions?

LS: node can advertise

incorrect link cost

each node computes only its own table

DV: DV node can advertise

incorrect path cost

each node’s table used by others

• error propagate thru network

Network Layer 4-16

RIP ( Routing Information Protocol)

distance vector algorithm

included in Berkeley Software Distribution (BSD)-UNIX Distribution in 1982

distance metric: # of hops (max = 15 hops)

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 subnets:

Network Layer 4-17

RIP advertisements

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

each advertisement: contains a list of up to 25 destination subnets within AS as well as the sender’s distance to each of those subnets

If 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)

Network Layer 4-18

RIP: Example

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/Forwarding Table in Router D

Network Layer 4-19

RIP: Example

Destination Network Next Router Num. of hops to dest.

w A 2 y B 2 z B A 7 5 x -- 1 …. …. ....

w x y

z

A

C

D B

Dest Next hops w - 1 x - 1 z C 4 …. … ...

Advertisement from A to D

Routing/Forwarding table in router D

Network Layer 4-20

OSPF (Open Shortest Path First)

“open”: publicly available typically deployed in upper-tier ISPs while RIP deployed in lower-

tier ISPs and enterprise networks

uses Link State algorithm LS packet dissemination (router floods routing information to all

routers)

topology map at each node

route computation using Dijkstra’s algorithm

router broadcasts link state information whenever there is a change in a link’s state (also broadcasts a link’s state periodically)

OSPF advertisement carries one entry per neighbor router

advertisements disseminated to entire AS (via flooding) carried in OSPF messages directly over IP

Network Layer 4-21

OSPF “advanced” features (not in RIP)

Security all OSPF messages authenticated (to prevent malicious

intrusion)

Using authentication algorithms

Multiple same-cost paths multiple same-cost paths allowed (only one path in RIP)

Integrated support for unicast and multicast routing Multicast OSPF (MOSPF) uses the existing OSPF link

database and adds a new type of link-state advertisement to the existing OSPF link-state broadcast mechanism

Support for hierarchy within a single routing domain An OSPF autonomous system can be configured hierarchically

into areas (more details in next slide)

Network Layer 4-22

Internet Inter-AS routing: BGP

BGP (Border Gateway Protocol) BGP provides each AS means to:

1. Obtain subnet reachability information from neighboring ASs.

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

3. Determine “good” routes to subnets based on reachability information and policy.

BGP allows subnet to advertise its existence to rest of Internet: “I am here”

Network Layer 4-23

BGP basics

pairs of routers (BGP peers) exchange routing info over semi-permanent TCP connections: BGP sessions

3b

1d

3a

1c 2a

AS3

AS1

AS2 1a

2c

2b

1b

3c eBGP session

iBGP session

Network Layer 4-24

R1

R2

R3 R4

source

duplication

R1

R2

R3 R4

in-network

duplication

duplicate

creation/transmission duplicate

duplicate

Broadcast Routing

deliver packets from source to all other nodes source duplication is inefficient:

Network Layer 4-25

In-network duplication

flooding: when node receives broadcast packet,

sends copy to all neighbors

controlled flooding: node only broadcasts packet

if it hasn’t sent same packet before

spanning tree

No redundant packets received by any node

Each node sends unicast join message to center node

Multicast Routing: Problem Statement

Goal: find a tree (or trees) connecting routers having local multicast group members tree: not all paths between routers used

source-based tree: different tree from each sender to receivers

Shared tree: same tree used by all group members

Shared tree Source-based trees

Network Layer 1-27

Lecture Summary Covered material

The Network Layer (cont’d) Routing Tables

Unicast and Multicast Routing Protocols

Routing Algorithms

• Link State and Distance Vector

Routing Information and Open Shortest Path First

Protocols

Material to be covered next lecture Introduction to the Transport Layer