Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network...

136
Network Layer 4-1 Chapter 4: Network Layer Chapter goals: understand principles behind network layer services: routing (path selection) dealing with scale how a router works advanced topics: Multicast routing, IPv6, mobility instantiation and implementation in the Internet

Transcript of Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network...

Page 1: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-1

Chapter 4: Network Layer

Chapter goals: understand principles behind network

layer services: routing (path selection) dealing with scale how a router works advanced topics: Multicast routing,

IPv6, mobility instantiation and implementation in the

Internet

Page 2: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-2

Chapter 4 roadmap

4.1 Introduction and Network Service Models4.2 Routing Principles4.3 Hierarchical Routing4.4 The Internet (IP) Protocol4.5 Routing in the Internet4.6 What’s Inside a Router4.7 IPv64.8 Multicast Routing4.9 Mobility

Page 3: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-3

Network layer functions

transport packets from sending to receiving hosts

network layer protocols in every host, router

three important functions: path determination: route

taken by packets from source to dest. Routing algorithms

forwarding: move packets from router’s input to appropriate router output

call setup: some network architectures require router call setup along path before data flows

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

Page 4: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-4

Network service model

Q: What service model for “channel” transporting packets from sender to receiver?

guaranteed bandwidth? preservation of inter-

packet timing (no jitter)? loss-free delivery? in-order delivery? congestion feedback to

sender?

? ??virtual circuit

or datagram?

The most important abstraction provided

by network layer:

serv

ice a

bst

ract

ion

Page 5: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-5

Virtual circuits

call setup/teardown for each call before/after data flow

each packet carries VC identifier (not destination host address)

every router on source-dest path maintains “state” for each passing connection transport-layer connection only involved two end

systems link, router resources (bandwidth, buffers)

may be allocated to VC to get circuit-like performance

Page 6: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-6

Virtual circuits: signaling protocols

used to setup, teardown VC used in ATM, frame-relay, X.25 not used in today’s Internet

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

1. Initiate call 2. incoming call

3. Accept call4. Call connected5. Data flow begins 6. Receive data

Page 7: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-7

Datagram networks: the Internet model

no call setup at network layer routers: no state about end-to-end connections

no network-level concept of “connection” packets forwarded using destination host address

packets between same source-dest pair may take different paths

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

1. Send data 2. Receive data

Page 8: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-8

Network layer service models:

NetworkArchitecture

Internet

ATM

ATM

ATM

ATM

ServiceModel

best effort

CBR

VBR

ABR

UBR

Bandwidth

none

constantrateguaranteedrateguaranteed minimumnone

Loss

no

yes

yes

no

no

Order

no

yes

yes

yes

yes

Timing

no

yes

yes

no

no

Congestionfeedback

no (inferredvia loss)nocongestionnocongestionyes

no

Guarantees ?

Internet model being extended: Intserv, Diffserv Chapter 6

Page 9: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-9

Comparison of datagram and virtual circuit

Issue Datagram Virtual circuit

Circuit setup Not needed Required

Addressing Each packet contains the full destination address

Each packet contains a short VC identifier

State information Router doesn’t hold state information

Router holds VC state information in a table

Routing Each packet is routed independently

All packets follow the same route

QoS support No Yes

Location of complexity At end systems Inside network

Page 10: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-10

Chapter 4 roadmap

4.1 Introduction and Network Service Models4.2 Routing Principles

Link state routing Distance vector routing

4.3 Hierarchical Routing4.4 The Internet (IP) Protocol4.5 Routing in the Internet4.6 What’s Inside a Router4.7 IPv64.8 Multicast Routing4.9 Mobility

Page 11: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-11

Routing

Graph abstraction for routing algorithms:

graph nodes are routers graph edges are physical

links link cost: physical

distance, link speed, delay, $ cost, or congestion level

Goal: determine “good” path

(sequence of routers) thru network from source to

dest.

Routing protocol

A

ED

CB

F

2

2

13

1

1

2

53

5

“good” path: minimum cost path

H1 H2

Page 12: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-12

Routing Algorithm classification

Global or decentralized?Global: all routers have complete

topology, link cost info “link state” algorithmDecentralized: router knows physically-

connected neighbors, link costs to neighbors

iterative process of computation, exchange of info with neighbors

“distance vector” algorithm

Static or dynamic?Static: routes change slowly

over time human intervention

Dynamic: routes change more

quickly periodic update in response to topology

or link cost changes

Page 13: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-13

A Link-State Routing Algorithm

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 gives routing table for

that node iterative: after k

iterations, know least cost path to k destinations

Notation: c(i,j): link cost from node

i to j. cost is infinite if not direct neighbors

D(v): cost of current least-cost path from source to dest. V

p(v): previous node (neighbor of v) along the current least-cost path from source to v

N: set of nodes whose least cost path from the source is definitively known

Page 14: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-14

Dijsktra’s Algorithm

1 Initialization: 2 N = {A} 3 for all nodes v 4 if v adjacent to A 5 then D(v) = c(A,v); p(v) = A6 else D(v) = infinity 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 least-cost path cost to w plus cost from w to v */ 15 p(v)=w if D(w) + c(w,v) is smaller than D(v)16 until all nodes in N

Page 15: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-15

Dijkstra’s algorithm: example

Step012345

start NA

ADADE

ADEBADEBC

ADEBCF

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

A

ED

CB

F

2

2

13

1

1

2

53

5 Dest. Next hop

B B

C D

D D

E D

F D

Page 16: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-16

Dijkstra’s algorithm, discussion

Algorithm complexity: n nodes (not counting the source) each iteration: need to check all nodes, w, not in N n*(n+1)/2 comparisons: O(n2) more efficient implementations possible: O(nlogn)

Oscillations possible: e.g., link cost = load carried on link

A

D

C

B1 1+e

e0

e

1 1

0 0

A

D

C

B2+e 0

001+e1

A

D

C

B0 2+e

1+e10 0

A

D

C

B2+e 0

001+e1

initially… recompute

routing… recompute … recompute

Page 17: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-17

Distance Vector Routing Algorithm

distributed: each node

communicates only with directly-attached neighbors

iterative: continues until no

nodes exchange info. self-terminating: no

“signal” to stop

asynchronous: nodes need not

operate in lock step with each other!

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

attached neighbor 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

=

=

Page 18: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-18

Distance Table: example

A

E D

CB7

8

1

2

1

2

D ()

A

B

C

D

A

1

7

6

4

B

14

8

9

11

D

5

5

4

2

Ecost to destination via

dest

inat

ion

D (C,D)E

c(E,D) + min {D (C,w)}D

w== 2+2 = 4

D (A,D)E

c(E,D) + min {D (A,w)}D

w== 2+3 = 5

D (A,B)E

c(E,B) + min {D (A,w)}B

w== 8+6 = 14

loop!

loop!

distance table in E when the DV algorithm has converged

Page 19: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-19

Distance table gives routing table

D ()

A

B

C

D

A

1

7

6

4

B

14

8

9

11

D

5

5

4

2

Ecost to destination via

dest

inat

ion

A

B

C

D

A, 1

D, 5

D, 4

D, 2

next hop, cost

dest

inat

ion

Distance table Routing table

Page 20: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-20

Distance Vector Routing: overview

Distributed: each node notifies

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

their neighbors if necessary

Iterative, asynchronous: each local iteration caused by:

local link cost change message from neighbor:

least cost path change from neighbor

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

recompute distance table

if least cost path to any dest

has changed, notify neighbors

Each node:

Page 21: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-21

Distance Vector Algorithm:

1 Initialization: 2 for all adjacent nodes v: 3 D (*,v) = infinity /* the * operator means "for all rows" */ 4 D (v,v) = c(X,v) 5 for every destination y 6 send min D (y,w) to each neighbor /* w over all X's neighbors */

XX

Xw

At each node, X:

Page 22: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-22

Distance Vector Algorithm (cont.):

8 loop 9 wait (until I see a link cost change to neighbor V 10 or until I receive update from neighbor V) 11 12 if (c(X,V) changes by d) 13 /* change cost to all dest's via neighbor v by d */ 14 /* note: d could be positive or negative */ 15 for all destinations y: D (y,V) = D (y,V) + d 16 17 else if (update received from V wrt destination Y) 18 /* shortest path from V to some Y has changed */ 19 /* V has sent a new value for its minWDV(Y,w) */ 20 /* call this received new value is "newval" */ 21 for the single destination Y: D (Y,V) = c(X,V) + newval 22 23 if we have a new min D (Y,w)for any destination Y 24 send new value of min D (Y,w) to all neighbors 25 26 forever

XX

XX

X

w

w

Page 23: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-23

Distance Vector Algorithm: example

X Z12

7

Y

Time

Page 24: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-24

Distance Vector Algorithm: example

X Z12

7

Y

D (Y,Z)X

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

= 7+1 = 8

Z

D (Z,Y)X

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

= 2+1 = 3

Y

Page 25: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-25

Distance Vector: link cost changes

Link cost changes: node detects local link cost change updates distance table (line 15) if cost change in least cost path,

notify neighbors (lines 23,24)X Z

14

50

Y1

algorithmterminates“good

news travelsfast”

Page 26: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-26

Distance Vector: link cost changes

Link cost changes: bad news travels slow -

“count to infinity” problem!X Z

14

50

Y60

algorithmcontinues

on!

Page 27: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-27

Distance Vector: 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) will this completely solve count to infinity

problem? X Z

14

50

Y60

algorithmterminates

Page 28: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-28

Comparison of LS and DV algorithms

Message complexity LS: with n nodes, E links,

O(nE) msgs sent DV: exchange between

neighbors only

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 propagates through network

Page 29: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-29

Chapter 4 roadmap

4.1 Introduction and Network Service Models4.2 Routing Principles4.3 Hierarchical Routing4.4 The Internet (IP) Protocol4.5 Routing in the Internet4.6 What’s Inside a Router4.7 IPv64.8 Multicast Routing4.9 Mobility

Page 30: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-30

Hierarchical Routing

scale: with millions destinations:

can’t store all dest’s in routing tables!

routing info 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

Page 31: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-31

Hierarchical Routing

aggregate routers into regions or “autonomous systems” (ASs)

routers in same AS run same routing protocol “intra-AS” routing

protocol routers in different ASs

can run different intra-AS routing protocols

special routers in AS run intra-AS routing

protocol with all other routers in AS

also responsible for routing to destinations outside AS run inter-AS routing

protocol with other gateway routers

gateway routers

Page 32: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-32

Intra-AS and Inter-AS routing

Gateways:•perform intra-AS routing with other routers in their AS•perform inter-AS routing among themselves

inter-AS, intra-AS routing in

gateway A.c

network layer

link layer

physical layer

a

b

b

aaC

A

Bd

A.a

A.c

C.bB.a

cb

c

Page 33: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-33

Intra-AS and Inter-AS routing

Host h2

a

b

b

aaC

A

Bd c

A.a

A.c

C.bB.a

cb

Hosth1

Intra-AS routingwithin AS A

Inter-AS routingbetween A and B

Intra-AS routingwithin AS B

We’ll examine specific inter-AS and intra-AS Internet routing protocols shortly

Page 34: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-34

Chapter 4 roadmap

4.1 Introduction and Network Service Models4.2 Routing Principles4.3 Hierarchical Routing4.4 The Internet (IP) Protocol

4.4.1 IPv4 addressing 4.4.2 Moving a datagram from source to destination 4.4.3 Datagram format 4.4.4 IP fragmentation 4.4.5 ICMP: Internet Control Message Protocol 4.4.6 DHCP: Dynamic Host Configuration Protocol

4.5 Routing in the Internet4.6 What’s Inside a Router4.7 IPv64.8 Multicast Routing4.9 Mobility

Page 35: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-35

The Internet Network layer

forwardingtable

Host, router network layer functions:

Routing protocols•path selection•RIP, OSPF, BGP

IP protocol•addressing conventions•datagram format•datagram handling conventions

ICMP protocol•error reporting•info reporting

Transport layer: TCP, UDP

Link layer

physical layer

Networklayer

Page 36: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-36

IP Addressing: introduction

IP address: 32-bit identifier for host, router interface

interface: boundary between host/router and physical link routers typically have

multiple interfaces host may have multiple

interfaces IP addresses associated

with each interface

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 11

Page 37: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-37

IP Addressing

IP address: network part (high

order bits) host part (low order

bits) What’s a network ? (from

IP addressing perspective) device interfaces with

same network part of IP address

can physically reach each other without intervening routers

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

network consisting of 3 IP networks(first 24 bits are network address)

223.1.1.0/24223.1.2.0/24

223.1.3.0/24

Page 38: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-38

IP Addressing

How to find the networks? Detach each interface

from router, host create islands of

isolated networks

223.1.1.1

223.1.1.3

223.1.1.4

223.1.2.2223.1.2.1

223.1.2.6

223.1.3.2223.1.3.1

223.1.3.27

223.1.1.2

223.1.7.0

223.1.7.1223.1.8.0223.1.8.1

223.1.9.1

223.1.9.2

Interconnected system consisting

of six networks

223.1.1.0/24

223.1.3.0/24223.1.2.0/24

223.1.9.0/24

223.1.8.0/24

223.1.7.0/24

Page 39: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-39

IP Addresses

0network host

10 network host

110 network host

1110 multicast address

A

B

C

D

class1.0.0.0 to127.255.255.255

128.0.0.0 to191.255.255.255

192.0.0.0 to223.255.255.255

224.0.0.0 to239.255.255.255

32 bits

given notion of “network”, let’s re-examine IP addresses:

“class-full” addressing:

Page 40: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-40

IP addressing: CIDR

Classful addressing: inefficient use of address space, address space

exhaustion e.g., class B net allocated enough addresses for 65K

hosts, even if only 2K hosts in that network

CIDR: Classless InterDomain Routing network portion of address of arbitrary length address format: a.b.c.d/x, where x is # bits in network

portion of address

11001000 00010111 00010000 00000000

networkpart

hostpart

200.23.16.0/23

Page 41: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-41

IP addresses: how to get one?

Q: How does network get network part of IP address?

A: gets portion of its ISP’s address space

ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20

Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23 ... ….. …. ….

Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23

Page 42: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-42

Hierarchical addressing: route aggregation

“Send me anythingwith addresses beginning 200.23.16.0/20”

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

Fly-By-Night-ISP

Organization 0

Organization 7Internet

Organization 1

ISPs-R-Us“Send me anythingwith addresses beginning 199.31.0.0/16”

200.23.20.0/23Organization 2

...

...

Hierarchical addressing allows efficient advertisement of routing information: use a single network prefix to advertise multiple networks

Page 43: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-43

Hierarchical addressing: more specific routes

ISPs-R-Us has a more specific route to Organization 1: longest prefix matching

“Send me anythingwith addresses beginning 200.23.16.0/20”

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

Fly-By-Night-ISP

Organization 0

Organization 7Internet

Organization 1

ISPs-R-Us“Send me anythingwith addresses beginning 199.31.0.0/16or 200.23.18.0/23”

200.23.20.0/23Organization 2

...

...

Page 44: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-44

IP addresses: how to get one?

Q: How does host get IP address?

hard-coded by system admin in a file DHCP: Dynamic Host Configuration Protocol:

dynamically get address from a server “plug-and-play”

Page 45: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-45

IP addressing: the last word

Q: How does an ISP get block of addresses?A: ICANN: Internet Corporation for Assigned

Names and Numbers allocates IP addresses manages DNS root servers assigns domain names, resolves disputes

Page 46: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-46

Getting a datagram from source to dest.

IP datagram:

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

miscfields

sourceIP addr

destIP addr data

datagram remains unchanged, as it travels from source to destination

address fields of interest here

Dest. Net. next router Nhops

223.1.1.0/24 1

223.1.2.0/24 223.1.1.4 2

223.1.3.0/24 223.1.1.4 2

forwarding table in A

Page 47: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-47

Getting a datagram from source to dest.

Starting at A, send IP datagram addressed to B:

look up net. address of B in forwarding table

find B is on same net. as A link layer will send datagram

directly to B inside link-layer frame B and A are directly connected

Dest. Net. next router Nhops

223.1.1.0/24 1

223.1.2.0/24 223.1.1.4 2

223.1.3.0/24 223.1.1.4 2

miscfields223.1.1.1223.1.1.3data

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

forwarding table in A

Page 48: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-48

Getting a datagram from source to dest.

Starting at A, dest. E: look up network address of E

in forwarding table E on different network

A, E not directly attached routing table: next hop router

to E is 223.1.1.4 link layer sends datagram to

router interface 223.1.1.4 inside link-layer frame

datagram arrives at 223.1.1.4 continued…..

miscfields223.1.1.1223.1.2.2 data

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

forwarding table in ADest. Net. next router Nhops

223.1.1.0/24 1

223.1.2.0/24 223.1.1.4 2

223.1.3.0/24 223.1.1.4 2

Page 49: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-49

Getting a datagram from source to dest.

Arriving at 223.1.1.4, destined for 223.1.2.2

look up network address of E in router’s forwarding table

E on same network as router’s interface 223.1.2.9 router, E directly attached

link layer sends datagram to 223.1.2.2 inside link-layer frame via interface 223.1.2.9

datagram arrives at 223.1.2.2!!!

miscfields223.1.1.1223.1.2.2 data Dest. Net router Nhops interface

223.1.1.0/24 - 1 223.1.1.4 223.1.2.0/24 - 1 223.1.2.9

223.1.3.0/24 - 1 223.1.3.27

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

forwarding table in router

Page 50: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-50

IP datagram format (RFC791)

ver length

32 bits

data (variable length,typically a TCP

or UDP segment)

16-bit identifier

header checksum

time tolive

32 bit source IP address

IP protocol versionnumber

header length (bytes)

max numberremaining hops

(decremented at each router)

forfragmentation/reassembly

total datagramlength (bytes)

upper layer protocolto deliver payload to

head.len

type ofservice

“type” of data flgsfragment

offsetprotocol

32 bit destination IP address

Options (if any) E.g. timestamp,record routetaken, specifylist of routers to visit.

how much overhead with TCP?

20 bytes of TCP 20 bytes of IP

recomputed at each router

Page 51: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-51

IP Fragmentation & Reassembly

network links have MTU (maximum transfer unit) – maximum amount of data a link-layer frame can carry. different link types,

different MTUs large IP datagram divided

(“fragmented”) within net one datagram becomes

several datagrams (fragments)

IP header bits used to identify, order related fragments

fragmentation: in: one large datagramout: 3 smaller datagrams

reassembly

Page 52: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-52

IP Fragmentation & Reassembly

Identification, flag, and fragment offset fields: Each datagram has a unique “identification” When fragmenting, a router fills “identifier”, “flag”, “length”

and “offset” fields appropriately All fragments carry the same datagram id of the original The last fragment’s flag bit set to 0, all other fragments

have flag bit set to 1 Fragment offset tells where the first byte of the fragment is

in the original datagram

Page 53: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-53

IP Fragmentation: An Example

ID=x

offset=0

flag=0

length=4000

ID=x

offset=0

flag=1

length=1500

ID=x

offset=1480

flag=1

length=1500

ID=x

offset=2960

flag=0

length=1040

One large datagram becomesthree smaller datagrams

4000 byte datagram (3980 bytes of IP payload)

MTU = 1500 bytes Datagram is divided

into 3 fragments: the first two fragments each contains 1480 bytes of data and the third fragment contains 1020 bytes of data

Page 54: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-54

IP Reassembly

Datagram reassembly is done at the destination host (why not at a router?) Use datagram id to put pieces together If all piece received, pass the datagram to upper layer

protocol If some fragments do not arrive to the destination, the

datagram is discarded Fragmentation can be eliminated by using an MSS of

536 bytes: all data link protocols have MTUs of at least 576 bytes

Page 55: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-55

ICMP: Internet Control Message Protocol

RFC 792 used by hosts, routers, and

gateways to communication network-level information

error reporting: unreachable host, network, port, protocol

echo request/reply (used by ping)

ICMP message: type, code, plus first 8 bytes of IP datagram causing error

network-layer “above” IP: ICMP msgs carried in IP

datagrams

Type Code description0 0 echo reply (ping)3 0 dest. network unreachable3 1 dest host unreachable3 2 dest protocol unreachable3 3 dest port unreachable3 6 dest network unknown3 7 dest host unknown4 0 source quench (congestion control - not used)8 0 echo request (ping)11 0 TTL expired12 0 bad IP header

Page 56: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-56

Chapter 4 roadmap

4.1 Introduction and Network Service Models4.2 Routing Principles4.3 Hierarchical Routing4.4 The Internet (IP) Protocol4.5 Routing in the Internet

4.5.1 Intra-AS routing: RIP and OSPF 4.5.2 Inter-AS routing: BGP

4.6 What’s Inside a Router?4.7 IPv64.8 Multicast Routing4.9 Mobility

Page 57: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-57

Routing in the Internet

The Global Internet consists of Autonomous Systems (AS) interconnected with each other: Stub AS: small corporation, one connection to other

AS’s Multihomed stub AS: large corporation, multiple

connections to other AS’s, no transit traffic Transit AS: provider, hooking many AS’s together

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

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

Page 58: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-58

Internet AS Hierarchy

Inter-AS border routers

Intra-AS interior routers

Page 59: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-59

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

Page 60: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-60

RIP ( Routing Information Protocol)

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

infinity = 16

Distance vectors exchanged among neighbors every 30 sec using Response Message (also called advertisement) Each advertisement contains a list of up to 25

destination nets within AS, and sender’s distance to these nets

Triggered updates: router sends update messages immediately whenever it changes the distance to a destination net

Page 61: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-61

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 table in D

Page 62: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-62

RIP: Example

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 hops w 1 x 1 z 4 …. ...

Advertisementfrom A to D

Page 63: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-63

RIP: Link Failure and Recovery

If no advertisement heard after 180 sec --> neighbor considered unreachable routes via neighbor invalidated new advertisements sent to neighbors neighbors in turn send out new advertisements (if tables

changed) link failure info quickly propagates to entire net poisoned reverse used to prevent ping-pong loops

Page 64: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-64

RIP Table processing

RIP executed by application-level process called route-d (daemon)

advertisements sent in UDP packets, port 520

physical

link

network forwarding (IP) table

Transprt (UDP)

routed

physical

link

network (IP)

Transprt (UDP)

routed

forwardingtable

Page 65: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-65

RIP Table Example

To see routing table, type netstat -rn popeye routing table:

Destination Gateway Genmask Flags MSS Window irtt Iface129.186.3.0 0.0.0.0 255.255.255.0 U 40 0 0 eth0127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo0.0.0.0 129.186.3.254 0.0.0.0 UG 40 0 0 eth0

popeye connected to one network (129.186.3.0/24) via interface eth0

127.0.0.0-loopback address protocol software process the datagram without sending it

into the network (for debugging) default route: datagrams not destined for 129.186.3.0/24 will

be forwarded to the router with IP address 129.186.3.254

Page 66: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-66

OSPF (Open Shortest Path First)

Uses Link State algorithm Link costs configured by network administrator Link state dissemination via flooding

• Link state advertisement carries one entry per neighbor router

Topology map at each node Route computation using Dijkstra’s algorithm

Advertisements disseminated to entire AS When there is a change in a link’s state Periodically: once very 30 minutes Carried in OSPF messages directly over IP (rather than

TCP or UDP)

Page 67: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-67

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)

distribute traffic over all paths equally Integrated unicast and multicast support:

Multicast OSPF (MOSPF) uses same topology database as OSPF

Hierarchical OSPF in large domains.

Page 68: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-68

Hierarchical OSPF

Two-level hierarchy: local area, backbone area An AS is configured into areas, each area runs its

own OSPF link-state routing algorithm One area in AS is configured to be the backbone

area, job is to route traffic between other areas in the AS

Four types of OSPF routers: Internal routers: in non-backbone areas and only

perform intra-AS routing Area border routers: belong to both an local area and

the backbone, route packets to outside the area Backbone routers: perform routing within the backbone

but are not area border routers Boundary routers: connect to other ASs, exchange

routing information with boundary routers in other ASs

Page 69: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-69

Hierarchical OSPF

Page 70: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-70

Inter-AS routing in the Internet: BGP

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

AS2 (OSPF

intra-AS routing)

AS1 (RI P intra-AS

routing) BGP

AS3 (OSPF intra-AS

routing)

BGP

R1 R2

R3

R4

R5

BGP (Border Gateway Protocol): the de facto standard

Page 71: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-71

Internet inter-AS routing: BGP

Path Vector protocol: similar to Distance Vector protocol each BGP router tells neighbors (peers) entire path

(i.e., sequence of AS’s) to destination• E.g., Gateway X may send its path to dest. Z to

neighbors:

Path (X,Z) = X,Y1,Y2,Y3,…,Z

BGP routes to networks (ASs), not individual hosts

Page 72: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-72

Internet inter-AS routing: BGP

Suppose: gateway X sends its path to dest. Z to peer gateway W

W may or may not select path offered by X policy (don’t route via competitors AS), loop

prevention reasons.

If W selects path advertised by X, then:Path (W,Z) = W, Path (X,Z)

Note: X can control incoming traffic by controlling its route advertisements to peers: e.g., don’t want to route traffic to Z -> don’t

advertise any routes to Z

Page 73: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-73

BGP: controlling who routes to you

Figure 4.5-BGPnew: a simple BGP scenario

A

B

C

W X

Y

legend:

customer network:

provider network

A,B,C are provider networks X,W,Y are customer (of provider networks) and are stub

networks X is dual-homed: attached to two networks

X does not want to forward traffic between B and C .. so X advertises to B and C that it has no paths to any

other destinations except itself

Page 74: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-74

BGP: controlling who routes to you

Figure 4.5-BGPnew: a simple BGP scenario

A

B

C

W X

Y

legend:

customer network:

provider network

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!

Page 75: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-75

BGP operation

What does a BGP router do? Receiving and filtering route advertisements

from directly attached neighbor(s). Route selection: to route to destination X,

which path (of several advertised) will be taken? local preference, e.g., routing via neighbor A always

preferred over routing via neighbor B shortest path: cross the smallest number of ASs

Sending route advertisements to neighbors

Page 76: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-76

BGP messages

BGP messages exchanged using TCP, port 179. BGP messages:

OPEN: establish contact with a peer and authenticates sender

UPDATE: advertises new path (or withdraws old path) KEEPALIVE: let a peer know that the sender is alive in

absence of UPDATES; also ACKs OPEN message NOTIFICATION: reports errors in message; also used to

close BGP session

Page 77: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-77

Why different Intra-AS 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

neededPerformance: Inter-AS: policy may dominate over performance Intra-AS: can focus on performanceScale: Hierarchical routing saves table size, reduced

routing update traffic

Page 78: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-78

Chapter 4 roadmap

4.1 Introduction and Network Service Models4.2 Routing Principles4.3 Hierarchical Routing4.4 The Internet (IP) Protocol4.5 Routing in the Internet4.6 What’s Inside a Router?4.7 IPv64.8 Multicast Routing4.9 Mobility

Page 79: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-79

IPv6

RFC 2460 Prime motivation: 32-bit address space

completely allocated by 2008. IP address is increased to 128 bits

Additional motivation: header format helps speed up processing/forwarding header changes to facilitate QoS new “anycast” address: allow a datagram to be

delivered to any one of a group of hosts (e.g. route to “best” of several replicated servers)

Page 80: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-80

IPv6 Header

Priority: identify priorities of datagramsFlow Label: identify datagrams in same “flow”

•A flow is a sequence of packets sent from a particular source to a particular destination for which the source desires special handling by the intervening routers

Next header: identify the type of header immediately following the IPv6 header. Use the same values as the IPv4 Protocol field

fixed-length 40 byte header

Page 81: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-81

Other Changes from IPv4

Fragmentation/Reassembly: not allowed at routers, can be performed only by source/destination, speed up IP forwarding

Header checksum: removed entirely to reduce processing time at each hop

Options: allowed, but outside of header, indicated by “Next Header” field

ICMPv6: new version of ICMP additional message types, e.g. “Packet Too Big”,

“unrecognized IPv6 options” multicast group management functions

Page 82: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-82

Transition From IPv4 To IPv6

Not all routers can be upgraded simultaneously No “flag days” How will the network operate with mixed IPv4 and IPv6

routers?

Two proposed approaches: Dual Stack: IPv6 routers have dual stack (v6, v4), can

“translate” between formats• IPv6/IPv4 nodes have both IPv6 and IPv4 addresses

Tunneling: IPv6 carried as payload in IPv4 datagram among IPv4 routers

Page 83: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-83

Dual Stack Approach

A B E F

IPv6 IPv6 IPv6 IPv6

C D

IPv4 IPv4

Flow: XSrc: ADest: F

data

Flow: ??Src: ADest: F

data

Src:ADest: F

data

A-to-B:IPv6

Src:ADest: F

data

B-to-C:IPv4

B-to-C:IPv4

B-to-C:IPv6

Page 84: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-84

TunnelingA B E F

IPv6 IPv6 IPv6 IPv6

tunnelLogical view:

Physical view:A B E F

IPv6 IPv6 IPv6 IPv6

C D

IPv4 IPv4

Flow: XSrc: ADest: F

data

Flow: XSrc: ADest: F

data

Flow: XSrc: ADest: F

data

Src:BDest: E

Flow: XSrc: ADest: F

data

Src:BDest: E

A-to-B:IPv6

E-to-F:IPv6

B-to-C:IPv6 inside

IPv4

B-to-C:IPv6 inside

IPv4

Page 85: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-85

Chapter 4 roadmap

4.1 Introduction and Network Service Models4.2 Routing Principles4.3 Hierarchical Routing4.4 The Internet (IP) Protocol4.5 Routing in the Internet4.6 What’s Inside a Router?4.7 IPv64.8 Multicast Routing4.9 Mobility

Page 86: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-86

Multicast: one sender to many receivers

Multicast: act of sending a datagram to multiple receivers with single “transmit” operation

Question: how to achieve multicast

Multicast via unicast source sends N unicast

datagrams, one addressed to each of N receivers

multicast receiver (red)

not a multicast receiver (grey)

routersforward unicastdatagrams

Page 87: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-87

Multicast: one sender to many receivers

Question: how to achieve multicast

Application-layer multicast

receivers involved in multicast copy and forward unicast datagrams among themselves

Page 88: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-88

Multicast: one sender to many receivers

Question: how to achieve multicast

Network multicast Router actively participate

in multicast, making copies of packets as needed and forwarding towards multicast receivers

Only a single copy of a datagram will ever traverse a link

Multicastrouters (red) duplicate and forward multicast datagrams

Page 89: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-89

Multicast Groups

How to identify the receivers of a multicast datagram?

Let datagram carry the IP addresses of all the recipients Only workable with a small number of recipients Sender needs to know the addresses of all receivers Not a good solution!

Internet solution: use multicast group A multicast group identifies a set of receivers and has a

single identifier Packet sent to a multicast group are received by all

members in the group

Page 90: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-90

Internet Multicast Service Model

Multicast group in the Internet has its own Class D multicast address IP addresses 224.0.0.0 to 239.255.255.255 reserved

for multicast (IP addresses begin with 1110)

128.119.40.186

128.59.16.12

128.34.108.63

128.34.108.60

multicast group

226.17.30.197

Page 91: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-91

Internet Multicast Service Model

Host group semantics:o anyone can join/leave a multicast groupo anyone can send to a multicast groupo no network-layer identification of hosts that have joined

a multicast group Questions to answer:

How are hosts join/leave a group? A: Internet Group Management Protocol (IGMP) How do the routers deliver a multicast datagram to all

group members? A: multicast routing protocols

Page 92: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-92

IP multicasting: two-step process

local: host informs local router of desire to join a multicast group: IGMP

wide area: local router interacts with other routers to receive multicast datagrams many multicast routing protocols (e.g., DVMRP,

MOSPF, PIM)

IGMPIGMP

IGMP

wide-areamulticast

routing

Page 93: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-93

Internet Group Management Protocol (IGMP)

RFC 2236 Operate between a host and its directly

attached router Provide the means for:

A host to inform its attached router that it wants to join/leave a multicast group

A router to detect if a LAN has any members for a particular multicast group

Page 94: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-94

IGMP Messages

Three message types: membership query, membership report, leave group

General membership query Sent by a router to all nodes on the LAN Query multicast groups joined by attached hosts Multicast group address field set to 0

Specific membership query Sent by a router to all nodes on the LAN Query if a specific multicast group is joined by attached hosts Multicast group address field set to the multicast group address being

queried

Type

Max. Resp.

Time

Checksum

Multicast group address

Page 95: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-95

IGMP Messages (cont’d)

Membership report message Sent by host to all nodes on the LAN in response to a

membership query message or when first joins a multicast group

Contains the address of a group the host has joined A router only cares about whether one or more hosts

belong to a given group want to hear from only one of the hosts that belongs to each group Each membership query message includes a “maximum

response time” field A host waits a random time between 0 and maximum

response time before sending a membership report message Feedback suppression: if the host observes a membership

report message from some other host for the multicast group, discard its own pending membership report message

Page 96: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-96

IGMP Messages (cont’d) Leave group message:

sent by host to report leaving a group leave group message is optional

• Router periodically sends a membership query message

• A router infers that no hosts are joined to a group when no host responds to the query message

• Soft state protocol: state is removed via a timeout event if it is not explicitly refreshed

IGMP messages are encapsulated within an IP datagram

There is no control over who sends to the group and who joins the group

Page 97: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Multicast Routing: Problem Statement

Goal: Given a multicast group, find a tree connecting routers having local multicast group members shared tree: a single tree used by all group members source-based tree: different tree for each sender

Shared tree Source-based trees

Page 98: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Approaches for building mcast trees

group-shared tree: group uses one tree minimal cost (Steiner) tree center-based tree

source-based tree: one tree per source shortest path tree reverse path forwarding

…we first look at basic approaches, then specific protocols adopting these approaches

Page 99: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Group-Shared Tree: Steiner Tree All multicast packets are

routed along the same tree, regardless of the sender

Steiner Tree: minimum cost tree connecting all routers with attached group members problem is NP-complete good heuristics exist

not used in practice: information about all links needed rerun whenever link costs change not able to use unicast routing

info

Router having attached group members

Router having no attached group members

4

1

11

2

22

3

Page 100: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Group-Shared Tree: Center-based tree

single delivery tree shared by all one router identified as center of

tree to join:

router with attached group members sends unicast join message addressed to the center

join message “processed” by intermediate routers and forwarded towards center

join message either hits existing tree branch for this center, or arrives at center

path taken by join message becomes new branch of tree for this router

R1

R2

R3

R4

R5

R6 R7

2

3

1

router with attachedgroup member

router with no attachedgroup member

path order in which join messages generated

1

center

Page 101: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-101

Multicast Routing Using a Source-Based Tree

Construct a multicast routing tree for each source in the multicast group

Router maintains state for each (group, sender) pair

Shortest path tree: union of the shortest paths from source to each receiver Obtained by Dijkstra’s

algorithm

Router having attached group members

Router having no attached group members

A

B

D

E

C

F

Page 102: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-102

Steiner Tree v.s Shortest Path Tree

4

1

11

2

22

34

1

11

2

22

3

A A (source)

Steiner tree: minimize the sum of the link costs in the tree

Shortest path tree: minimize the cost from source to each receiver

Page 103: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-103

Compute Shortest Path Tree

Use link state algorithm: each router needs to know the state of each link in the network

Can we compute the tree without link state information?

A: use reverse path forwarding algorithm

Page 104: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-104

Reverse Path Forwarding (RPF)

Forward packet from source S to all interfaces (except the incoming one) iff the packet arrived on the link that is on its shortest path to S A router need only know

the next hop on its shortest path to the sender

result is a source-specific reverse shortest path tree

A

B

D

E

C

F

Packet that will be forwarded

Packet not forwarded beyond receiving router

G

Page 105: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-105

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

• Router tells parent in the tree to stop forwarding

• Prune message propagate upstream

A

B

D

E

C

FG

Prune message

Page 106: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-106

Rejoining

If a router sends a prune message upstream, what should happen if it later needs to join the group? Send a graft message to upstream router Or, allow pruned branches to time-out and be

added again to the tree

Page 107: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-107

Issues in Wide-Area Multicast

Hosts may join and leave a multicast group dynamicallyneed to dynamically update routing tree

State information for a multicast connection must be established and maintained in routers Group-shared tree: per group state Source-based tree: per (group, source) state

Page 108: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Internet Multicasting Routing: DVMRP

DVMRP: distance vector multicast routing protocol, RFC1075

flood and prune: source-based tree, reverse path forwarding each router uses a distance vector algorithm to

compute the next hop on its shortest path to each source

initial datagram to mcast group flooded everywhere via RPF

routers not wanting multicast datagram: send upstream prune messages

routers store state for each (source, group) pair

Page 109: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

DVMRP: continued…

soft state: DVMRP router periodically “forgets” branches are pruned: multicast data again flows down unpruned branch router: reprune or else continue to receive data

routers can quickly regraft to tree using graft message

odds and ends commonly implemented in commercial routers MBONE (Multicast Backbone) routing done using DVMRP

Page 110: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Tunneling some Internet routers are not multicast-capable Internet MBONE: a virtual network of multicast-capable routers on top of

a physical network containing a mix of unicast and multicast routers

mcast datagram encapsulated inside unicast datagram unicast IP datagram sent thru “tunnel” via regular IP unicast to

receiving mcast router receiving mcast router extracts mcast datagram

physical topology logical topology

AB

C

A B

C

Page 111: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

PIM: Protocol Independent Multicast

not dependent on any particular underlying unicast routing protocol (works with all)

two different multicast distribution scenarios:

Dense mode: group members

densely located, many routers need to be involved in routing multicast datagrams

Sparse mode: # routers with attached

group members small wrt total # routers

Page 112: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Consequences of Sparse-Dense Dichotomy

Dense mode group membership by

routers assumed until routers explicitly prune

data-driven construction of mcast tree (e.g., RPF)

Sparse mode routers not involved in

multicast distribution until explicitly join a group

receiver- driven construction of mcast tree (e.g., center-based)

Page 113: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

PIM - Dense Mode

flood-and-prune reverse path forwarding similar to DVMRP, but can interoperate with

any underlying unicast routing protocol

Page 114: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

PIM - Sparse Mode

center-based approach router sends JOIN msg to

rendezvous point (RP) to join the tree intermediate routers update

state and forward JOIN message toward RP

PRUNE message is sent when a router leaves a group

R1

R2

R3

R4

R5

R6R7

join

join

join

rendezvouspoint

Page 115: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

PIM - Sparse Mode

sender unicast data to RP, which multicasts down RP-rooted tree

RP can send STOP message to source if no routers are jointed to the tree “no one is listening!”

after joining RP, router can switch to source-specific tree

R1

R2

R3

R4

R5

R6R7

join

join

join

all data multicastfrom rendezvouspoint

rendezvouspoint

Page 116: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-116

Switch from group-shared tree to a source-specific tree

In group-shared tree, E sends to RP, then RP sends to A

when data rate from E exceeds a threshold A sends join message directly

to E A does not send prune

message towards RP so it can continue to receive from other sources

increased performance: less traffic concentration, shorter paths

source

receiverRP

Before switch

After switch

A B C

E

D

Page 117: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-117

MOSPF: Multicast Open Shortest Path First

Multicast extension to OSPF Routers flood group membership information

with Link State Advertisements Each router independently computes source-

specific, shortest-path trees for each multicast group

Page 118: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-118

Evaluating a Multicast Routing Protocol

Scalability: the amount of state required in the routers Group-shared tree: per

group state Source-based tree: per

group, per source state Excess traffic received?

Yes: DVMRP, PIM Dense Mode

No: MOSPF, PIM Sparse Mode

Traffic Concentration Group-shared tree tends

to concentrate traffic on a smaller number of links

Source-based trees tend to distribute multicast traffic more evenly

Optimality of forwarding paths Minimum cost multicast

tree not used in practice Shortest path trees and

center based trees are used

Page 119: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-119

Chapter 4 roadmap

4.1 Introduction and Network Service Models4.2 Routing Principles4.3 Hierarchical Routing4.4 The Internet (IP) Protocol4.5 Routing in the Internet4.6 What’s Inside a Router?4.7 IPv64.8 Multicast Routing4.9 Mobility

Page 120: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-120

What is mobility?

spectrum of mobility, from the network-layer perspective:

no mobility high mobility

mobile user, usingsame access point

mobile user, passing through multiple wireless access networks while maintaining ongoing connections to remote applications

mobile user, moving between access networks, shutting down while moving between networks,connecting to network using DHCP

Page 121: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-121

Mobility: Vocabulary

home network: permanent “home” of mobile node(e.g., 128.119.40.0/24)

Permanent address: address in home network, can always be used to reach mobilee.g., 128.119.40.186

home agent: entity that will perform mobility management functions on behalf of mobile, when mobile is remote

wide area network

correspondent

Page 122: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-122

Mobility: more vocabulary

Care-of-address: address in foreign network.(e.g., 79.129.13.2)

wide area network

foreign (visited) network: network in which mobile node currently resides (e.g., 79.129.13.0/24)

Permanent address: remains constant (e.g., 128.119.40.186)

Foreign agent: entity in foreign network that performs mobility management functions on behalf of mobile node.

correspondent: wants to communicate with mobile node

Page 123: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-123

Mobility: approaches Let routing handle it: router in the foreign network

advertises to all other routers that the mobile is resident in its network via usual routing information exchange. routing tables direct datagrams to the foreign

network no changes to end-systems

Let end-systems handle it: indirect routing: communication from

correspondent to mobile goes through home agent, then forwarded to remote

direct routing: correspondent gets care-of address of mobile, sends directly to mobile

Page 124: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-124

Mobility: approaches

Let routing handle it: routers advertise permanent address of mobile-nodes-in-residence via usual routing table exchange. routing tables direct datagrams to the foreign

network no changes to end-systems

let end-systems handle it: indirect routing: communication from

correspondent to mobile goes through home agent, then forwarded to remote

direct routing: correspondent gets care-of address of mobile, sends directly to mobile

not scalable

to millions of mobiles

Page 125: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-125

Mobility: registration

Jobs of a foreign agent: Create care-of address for the mobile Inform the home agent that the mobile is resident in its

network and has the given COA

foreign agent functions may be done by mobile itself

wide area network

home network

visited network

1

mobile contacts foreign agent on entering visited network

2

foreign agent contacts home agent: “this mobile is resident in my network”

Page 126: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-126

Mobility via Indirect Routing

wide area network

homenetwork

visitednetwork

3

2

41

correspondent addresses packets using permanent address of mobile

home agent intercepts packets, forwards to foreign agent using mobile’s COA

foreign agent receives packets, forwards to mobile

mobile replies directly to correspondent

Page 127: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-127

Forwarding datagrams to remote mobile

Permanent address: 128.119.40.186

Care-of address: 79.129.13.2

dest: 128.119.40.186

packet sent by correspondent

dest: 79.129.13.2 dest: 128.119.40.186

packet sent by home agent to foreign agent: a packet within a packet

dest: 128.119.40.186

foreign-agent-to-mobile packet

Page 128: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-128

Indirect Routing: moving between networks

suppose mobile user moves from one foreign network to another registers with new foreign agent new foreign agent registers with home agent home agent updates care-of-address for mobile packets continue to be forwarded to mobile (but with

new care-of-address)

Mobility, changing foreign networks transparent: on going connections can be maintained!

Page 129: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-129

Indirect Routing: comments

Mobile uses two addresses: permanent address: used by correspondent (hence

mobile location is transparent to correspondent) care-of-address: used by home agent to forward

datagrams to mobile triangle routing problem: correspondent-home-network-

mobile inefficient when correspondent, mobile are in same

network

Page 130: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-130

Mobility via Direct Routing

wide area network

homenetwork

foreignnetwork

4

25

1correspondent requests, receives COA of mobile

correspondent tunnels to foreign agent

foreign agent receives encapsulated gatagrams, forwards to mobile

mobile replies directly to correspondent

3

Page 131: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-131

Mobility via Direct Routing: comments

overcome triangle routing problem non-transparent to correspondent: correspondent must

get care-of-address from home agent What happens if mobile moves from one foreign network

to another? Notify the correspondent of the changing COA Or, new foreign agent provides the old foreign agent with

mobile’s new COA; old foreign agent forwards datagram using new COA

Page 132: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-132

Mobile IP

The Internet architecture and protocols for supporting mobility, RFC 3344

has many features we’ve seen: home agents, foreign agents, care-of-addresses,

encapsulation (packet-within-a-packet)

three components to standard: agent discovery registration with home agent indirect routing of datagrams

Page 133: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-133

Mobile IP: agent discovery

agent advertisement: foreign/home agents advertise services by periodically broadcasting ICMP messages

RBHFMGV bits reserved

type = 16

type = 9 code = 0 = 9

checksum = 9

router address

standard ICMP fields

mobility agent advertisement

extension

length sequence #

registration lifetime

0 or more care-of-addresses

0 8 16 24

R bit: registration required

H,F bits: home and/or foreign agent

The longest lifetime that the agent is willing to accept in any Registration Request.

mobile node selects one as its COA

Page 134: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-134

Mobile IP: agent discovery

agent solicitation: mobile broadcast an agent solicitation message

without waiting for an agent advertisement an agent receiving the solicitation will send an

agent advertisement to the mobile node

Page 135: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-135

Mobile IP: registration with home agent example

visited network: 79.129.13/24 home agent

HA: 128.119.40.7 foreign agent

COA: 79.129.13.2 COA: 79.129.13.2

….

ICMP agent adv. Mobile agent

MA: 128.119.40.186

registration req.

COA: 79.129.13.2 HA: 128.119.40.7 MA: 128.119.40.186 Lifetime: 9999 identification:714 ….

registration req.

COA: 79.129.13.2 HA: 128.119.40.7 MA: 128.119.40.186 Lifetime: 9999 identification: 714 encapsulation format ….

registration reply

HA: 128.119.40.7 MA: 128.119.40.186 Lifetime: 4999 Identification: 714 encapsulation format ….

registration reply

HA: 128.119.40.7 MA: 128.119.40.186 Lifetime: 4999 Identification: 714 ….

time

Page 136: Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.

Network Layer 4-136

Network Layer: summary

What we’ve covered: Network layer services: datagram and virtual

circuit Routing principles: link state and distance vector Hierarchical routing: intra-AS and inter-AS IP Protocol: v4 and v6 Internet routing protocols: RIP, OSPF, BGP Multicast

general approaches: group-shared tree and source-based tree

protocols: IGMP, DVMRP, PIM, MOSPF Mobility: indirect routing and direct routing