Top Banner
Chapter 4 Network Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 All material copyright 1996-2012 J.F Kurose and K.W. Ross, All Rights Reserved Network Layer 4-1
172

yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Jul 23, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Chapter 4

Netw

ork Layer

Computer

Netw

orking: A Top D

own Approach

6th edition

Jim K

urose, Keith Ross

Addison-W

esley M

arch 2012

All m

aterial copyright 1996-2012 J.F K

urose and K.W

. Ross, A

ll Rights R

eserved

Netw

ork Layer 4-1

Page 2: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-2

Chapter 4: netw

ork layer

chapter goals: ! understand principles behind netw

ork layer services: " netw

ork layer service models

" forwarding versus routing

" how a router w

orks " routing (path selection) " broadcast, m

ulticast ! instantiation, im

plementation in the Internet

Page 3: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-3

4.1 introduction 4.2 virtual circuit and

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format

" IPv4 addressing

" IC

MP

" IPv6

4.5 routing algorithms

" link state

" distance vector

" hierarchical routing

4.6 routing in the Internet " 

RIP

" O

SPF " 

BGP

4.7 broadcast and multicast

routing

Chapter 4: outline

Page 4: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-4

Netw

ork layer ! routes packets from

sending to receiving host " sending side encapsulates

transport segments into IP

datagrams

" receiving side delivers segm

ents to transport layer ! netw

ork layer protocols in every host and router

! router exam

ines header fields in all IP datagram

s passing through it

application transport netw

ork data link physical

application transport netw

ork data link physical

netw

ork data link physical

netw

ork data link physical

netw

ork data link physical

network

data link physical

netw

ork data link physical

network

data link physical

netw

ork data link physical

netw

ork data link physical

netw

ork data link physical

netw

ork data link physical

netw

ork data link physical

Page 5: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-5

Tw

o key network-layer functions

! forw

arding: move packets

from router�s input to

appropriate output

! routing: determ

ine route taken by packets from

source to dest.

" routing algorithms

analogy:

! routing: process of planning trip from

source to dest

! forwarding: process of getting through single interchange

Page 6: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork 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 and forw

arding

routing algorithm determ

ines end-end-path through netw

ork

forwarding table determ

ines local forw

arding at this router

Page 7: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-7

Connection setup

! im

portant function in some netw

ork architectures: " A

TM

, frame relay, X

.25 (but not Internet) ! before datagram

s flow, tw

o end hosts and on-path routers establish virtual connection

! netw

ork vs. transport layer connection service: " netw

ork: between tw

o hosts and on-path routers " transport: betw

een two processes

Page 8: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-8

Netw

ork service model

Q: W

hat service model for �channel� transporting

datagrams from

sender to receiver?

example services for

individual datagrams:

! guaranteed delivery

! guaranteed delivery w

ith less than 40 m

sec delay

example services for a flow

of datagrams:

! in-order delivery

! guaranteed m

inimum

flow

bandwidth

! bounded variance in inter-packet spacing

Page 9: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-9

Netw

ork layer service models:

Netw

ork A

rchitecture Internet

ATM

ATM

ATM

ATM

Service

Model

best effort C

BR

V

BR

A

BR

U

BR

Bandw

idth none constant rate guaranteed rate guaranteed m

inimum

none

Loss no yes yes no no

Order

no yes yes yes yes

Timing

no yes yes no no

Congestion

feedback no (inferred via loss) no congestion no congestion yes no

Guarantees ?

Page 10: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-10

4.1 introduction 4.2 virtual circuit vs.

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format

" IPv4 addressing

" IC

MP

" IPv6

4.5 routing algorithms

" link state

" distance vector

" hierarchical routing

4.6 routing in the Internet " 

RIP

" O

SPF " 

BGP

4.7 broadcast and multicast

routing

Chapter 4: outline

Page 11: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-11

Connection, connection-less service

! datagram

network (Internet) provides netw

ork-layer connectionless service

! virtual-circuit netw

ork (AT

M) provides netw

ork-layer connection service

! analogous to T

CP/U

DP connecton-oriented /

connectionless transport-layer services, but: " service: host-to-host " no choice: netw

ork provides one or the other " im

plementation: prim

arily in network core

Page 12: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-12

Virtual circuits (e.g., A

TM

)

! call setup, teardow

n for each call before data can flow

! every router on source-dest path m

aintains �state� for each passing connection

! link, router resources (bandw

idth, buffers) may be

allocated to VC

(dedicated resources = predictable service)

source-to-dest path behaves like telephone circuit " perform

ance-wise

" network actions along source-to-dest path

Page 13: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-13

Virtual circuit im

plementation

VC consists of: 1. 

path from source to destination

2. VC num

bers, one number for each link along path

3. entries in forw

arding tables in routers along path ! 

packet belonging to VC

carries VC

number

(rather than dest address) ! 

VC

number typically changed on each link.

" new

VC

number com

es from forw

arding table

Page 14: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-14

Virtual circuit forw

arding table 12

22 32

1 2

3

VC

number

interface num

ber

Incoming interface Incom

ing VC

# Outgoing interface O

utgoing VC

#

1 12 3 22 2 63 1 18 3 7 2 17 1 97 3 87 …

… …

forwarding table in northw

est router:

VC routers maintain connection state inform

ation!

Page 15: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-15

application transport netw

ork data link physical

Virtual circuit signaling

! used to setup, m

aintain teardown V

C

! used in A

TM

, frame-relay, X

.25 ! not used in today�s Internet

1. initiate call 2. incom

ing call 3. accept call

4. call connected 5. data flow

begins 6. receive data

application transport netw

ork data link physical

How

does this compare to datagram

netw

orks like the Internet?

Page 16: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-16

Datagram

networks (e.g., Internet)

! no call setup at netw

ork layer ! routers: no state about end-to-end connections " no netw

ork-level concept of �connection�

! packets forw

arded using destination host address

1. send datagrams

application transport netw

ork data link physical

application transport netw

ork data link physical

2. receive datagrams

Page 17: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-17

1

2 3

Datagram

forwarding table

IP destination address in arriving packet�s header

routing algorithm

local forwarding table

dest address output link address-range 1 address-range 2 address-range 3 address-range 4

3 2 2 1

4 billion IP addresses, so rather than list individual destination address list range of addresses (aggregate table entries)

Page 18: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-18

Destination A

ddress Range

11001000 00010111 00010000 00000000 through 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 through 11001000 00010111 00011000 11111111 11001000 00010111 00011001 00000000 through 11001000 00010111 00011111 11111111 otherw

ise

Link Interface 0 1 2 3

Q: but w

hat happens if ranges don�t divide up so nicely?

Datagram

forwarding table

Page 19: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-19

Longest prefix matching

Destination A

ddress Range

11001000 00010111 00010*** ********* 11001000 00010111 00011000 ********* 11001000 00010111 00011*** ********* otherw

ise !

DA

: 11001000 00010111 00011000 10101010

examples: D

A: 11001000 00010111 00010110 10100001

which interface?

which interface?

when looking for forw

arding table entry for given destination address, use longest address prefix that m

atches destination address.

longest prefix matching

Link interface

0 1 2 3

Page 20: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-20

Datagram

or VC

network: w

hy? Internet (datagram

) ! data exchange am

ong com

puters " �elastic� service, no strict tim

ing requirement

! m

any link types " 

different characteristics " 

uniform service difficult

! �sm

art� end systems

" can adapt, perform

control, error recovery

" sim

ple inside network,

complexity at �edge�

ATM (VC)

! evolved from

telephony ! hum

an conversation: " 

strict timing, reliability

requirements

" need for guaranteed service

! �dum

b� end system

s " 

telephones " 

complexity inside

network

Page 21: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-21

4.1 introduction 4.2 virtual circuit and

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format

" IPv4 addressing

" IC

MP

" IPv6

4.5 routing algorithms

" link state

" distance vector

" hierarchical routing

4.6 routing in the Internet " 

RIP

" O

SPF " 

BGP

4.7 broadcast and multicast

routing

Chapter 4: outline

Page 22: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-22

Router architecture overview

tw

o key router functions: ! running routing protocols (R

IP, OSPF, BG

P) ! forw

arding datagrams from

incoming to outgoing link

high-seed sw

itching fabric

routing processor

router input ports router output ports

forwarding data

plane (hardware)

routing, managem

ent control plane (softw

are)

forwarding tables com

puted, pushed to input ports

Page 23: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-23

line term

ination

link layer

protocol (receive)

lookup, forw

arding

queueing

Input port functions

decentralized switching:

! 

given datagram dest., lookup output port

using forwarding table in input port

mem

ory (“match plus action”)

! 

goal: complete input port processing at

�line speed�

! 

queuing: if datagrams arrive faster than

forwarding rate into sw

itch fabric

physical layer: bit-level reception

data link layer: e.g., E

thernet see chapter 5

switch

fabric

Page 24: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-24

Switching fabrics

! transfer packet from

input to correct output buffer ! sw

itching rate: rate at which packets can be

transfer from inputs to outputs

" often m

easured as multiple of input/output line rate

" N

inputs: switching rate N

times line rate desirable

! three types of sw

itching fabrics

mem

ory

mem

ory

bus crossbar

Page 25: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-25

Switching via m

emory

first generation routers: ! traditional com

puters with sw

itching under direct control of C

PU

! packet copied to system

�s mem

ory !  speed lim

ited by mem

ory bandwidth (2 bus crossings per

datagram)

input port (e.g.,

Ethernet)

mem

ory output port (e.g.,

Ethernet)

system bus

Page 26: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-26

Switching via a bus

! datagram

transferred from input

port mem

ory to output port m

emory via a shared bus

! bus contention: sw

itching speed lim

ited by bus bandwidth

! 32 G

bps bus, Cisco 5600: sufficient

speed for access/enterprise routers bus

Page 27: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-27

Switching via interconnection netw

ork

! overcom

e bus bandwidth lim

itations ! crossbar, banyan netw

orks, other interconnection nets initially developed to connect processors in m

ultiprocessor ! advanced design: fragm

enting datagram

into fixed length cells, sw

itch cells through the fabric. ! C

isco 12000: switches 60 G

bps through interconnection netw

ork

crossbar

Page 28: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-28

Output ports

! buffering required w

hen datagrams arrive from

fabric faster than the transm

ission rate ! scheduling policy chooses am

ong queued datagrams

for transmission

line term

ination

link layer

protocol (send)

switch

fabric

datagram

buffer

queueing

Page 29: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-29

Output port queueing

! buffering w

hen arrival rate via switch exceeds

output line speed ! queueing (delay) and loss due to output port buffer overflow

!

at t, packets move

from input to output

one packet time later

switch

fabric

switch

fabric

Page 30: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-30

How

much buffering?

! R

FC 3439 rule of thum

b: average buffering equal to �typical�

�RT

T tim

es link capacity C

" e.g., C=10G

bps, RT

T=250m

s # 2.5 G

bit buffer ! recent recom

mendation: w

ith N flow

s, buffering reduced by 1/sqrt(N

) suffices:

RTT C

.

N

Page 31: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-31

Input port queuing ! fabric slow

er than input ports combined $

queueing may

occur at input queues " queueing delay and loss due to input buffer overflow

! ! H

ead-of-the-Line (HO

L) blocking: queued datagram at front

of queue prevents others in queue from m

oving forward

output port contention: only one red datagram

can be transferred.

lower red packet is blocked

switch

fabric

one packet time

later: green packet experiences H

OL

blocking

switch

fabric

Page 32: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q1: C

onnection/-less service

! W

hich of the following is connection-oriented?

Pick one. A

. T

CP, datagram

network

B. U

DP, virtual circuit netw

ork C

. TC

P, virtual circuit network

D. 

UD

P, datagram netw

ork E. 

TC

P, virtual circuit network, datagram

network N

etwork Layer

4-32

Page 33: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q2: C

onnection state

! W

hich of the following relies on connection state

in routers in the network? Pick one.

A. 

TC

P B. 

Internet C

. Virtual circuit netw

ork D

. U

DP

E. A

and C

Netw

ork Layer 4-33

Page 34: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q3: V

irtual circuit vs. datagram

! H

ow m

any entries do virtual circuit forwarding

tables and datagram netw

ork forwarding tables

respectively have? A

. 1,2

B. 2,4

C. 2,2

D. 

4,2 E. 

2,1

Netw

ork Layer 4-34

Page 35: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q4: V

irtual circuit

! W

hich of the following is true? Pick one.

A. A

virtual circuit uses a different VC

number

for each link along a route B. A

virtual circuit uses the same V

C num

ber for all packets in a connection

C. A

virtual circuit router uses the destination address (am

ong other fields) in order to determ

ine the outgoing interface D

. A and C

Netw

ork Layer 4-35

Page 36: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q5: Longest prefix m

atching

! O

n which outgoing interface w

ill a packet destined to 11011001 be forw

arded?

Netw

ork Layer 4-36

Prefix

Interface

1* A

11* B

111* C

Default

D

Page 37: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q6: R

outer architecture

! W

here will queuing delay or loss occur if the link

bandwidth (but not the sw

itching fabric) is the bottleneck? A

. Input port

B. O

utput port

Netw

ork Layer 4-37

Page 38: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q7: R

outer architecture

! W

here does head-of-the-line blocking occur? A

. Input port

B. O

utput port

Netw

ork Layer 4-38

Page 39: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q8: R

outer architecture

! T

he amount of buffering m

emory required in a

router increases/decreases with the num

ber of sim

ultaneous TC

P flows flow

ing through it. A

. increases

B. decreases

Netw

ork Layer 4-39

Page 40: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-40

4.1 introduction 4.2 virtual circuit and

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format

" IPv4 addressing

" IC

MP

" IPv6

4.5 routing algorithms

" link state

" distance vector

" hierarchical routing

4.6 routing in the Internet " 

RIP

" O

SPF " 

BGP

4.7 broadcast and multicast

routing

Chapter 4: outline

Page 41: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-41

The Internet netw

ork layer

forwarding

table

host, router network layer functions:

routing protocols •  path selection •  R

IP, OS

PF, B

GP

IP protocol •  addressing conventions •  datagram

format

•  packet handling conventions

ICMP protocol

•  error reporting •  router �signaling

transport layer: TCP, U

DP

link layer

physical layer

network

layer

Page 42: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-42

ver length

32 bits

data (variable length, typically a TC

P or U

DP segm

ent)

16-bit identifier header

checksum

time to

live 32 bit source IP address

head. len

type of service flgs

fragment

offset upper layer

32 bit destination IP address options (if any)

IP datagram form

at IP protocol version

number

header length (bytes)

upper layer protocol to deliver payload to

total datagram

length (bytes)

�type� of data

for fragm

entation/ reassem

bly m

ax number

remaining hops

(decremented at

each router)

e.g. timestam

p, record route taken, specify list of routers to visit.

how m

uch overhead? ! 

20 bytes of TCP

! 

20 bytes of IP ! 

= 40 bytes + app layer overhead

Page 43: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-43

IP fragmentation, reassem

bly ! netw

ork links have MT

U

(max. transfer unit) that

limits link-layer fram

e size " different link types have

different MT

Us

! large IP datagram

chopped (�fragm

ented�) in netw

ork into several datagram

s " �reassem

bled� only at

final destination " IP header bits used to

identify, order fragments

fragmentation:

in: one large datagram

out: 3 smaller datagram

s

reassembly

Page 44: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-44

ID

=x offset

=0 fragflag

=0 length =4000

ID

=x offset

=0 fragflag

=1 length =1500

ID

=x offset =185

fragflag =1

length =1500 ID

=x

offset =370

fragflag =0

length =1040

one large datagram becom

es several sm

aller datagrams

example:

! 

4000 byte datagram

! 

MT

U = 1500 bytes

1480 bytes in data field

offset = 1480/8

IP fragmentation, reassem

bly

Page 45: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-45

4.1 introduction 4.2 virtual circuit and

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format

" IPv4 addressing

" IC

MP

" IPv6

4.5 routing algorithms

" link state

" distance vector

" hierarchical routing

4.6 routing in the Internet " 

RIP

" O

SPF " 

BGP

4.7 broadcast and multicast

routing

Chapter 4: outline

Page 46: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-46

IP addressing: introduction

! IP address: 32-bit identifier for interface on host or router

! interface: connection betw

een host/router and physical link " 

router�s typically have m

any interfaces " 

host typically has one or tw

o interfaces (e.g., wired

Ethernet, wireless 802.11)

! IP addresses associated w

ith 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.2 223.1.3.1

223.1.3.27

223.1.1.1 = 11011111 00000001 00000001 00000001

223 1

1 1

Page 47: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-47

IP addressing: introduction

Q: how

are interfaces actually connected? A: w

e’ll learn about that in chapter 5, 6.

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.2 223.1.3.1

223.1.3.27

A: w

ired Ethernet interfaces

connected by Ethernet sw

itches

A: w

ireless WiFi interfaces

connected by WiFi base station

For now: let’s not w

orry about how

one interface is connected to another (w

ith no intervening router)

Page 48: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-48

Subnets

! IP address: " subnet part: high order bits

" host part: low order bits

" netmask specifies subnet

and host part bits ! w

hat�s a subnet ? " interfaces w

ith same

subnet part of IP address " physically inter-reachable w

ithout intervening router netw

ork consisting of 3 subnets

223.1.1.1

223.1.1.3 223.1.1.4 223.1.2.9

223.1.3.2 223.1.3.1

subnet

223.1.1.2

223.1.3.27 223.1.2.2

223.1.2.1

Page 49: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-49

recipe to determine subnets

! detach each interface from

its host or router, creating islands of isolated netw

orks ! each isolated netw

ork is called a subnet

subnet mask: /24

Subnets 223.1.1.0/24

223.1.2.0/24

223.1.3.0/24

223.1.1.1

223.1.1.3 223.1.1.4 223.1.2.9

223.1.3.2 223.1.3.1

subnet

223.1.1.2

223.1.3.27 223.1.2.2

223.1.2.1

Page 50: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-50

how m

any? 223.1.1.1

223.1.1.3

223.1.1.4

223.1.2.2 223.1.2.1 223.1.2.6

223.1.3.2 223.1.3.1 223.1.3.27

223.1.1.2

223.1.7.0

223.1.7.1 223.1.8.0

223.1.8.1 223.1.9.1 223.1.9.2

Subnets

Page 51: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-51

IP addressing: CID

R

CID

R: C

lassless InterDom

ain Routing

" subnet portion of address of arbitrary length " address form

at: a.b.c.d/x, where x is # bits in

subnet portion of address

11001000 00010111 00010000 00000000

subnet part

host part

200.23.16.0/23

Page 52: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-52

IP addresses: how to get one?

Q: H

ow does a host get IP address?

! hard-coded by system

admin in a file

" Window

s: control-panel->network->configuration->tcp/

ip->properties " U

NIX

: /etc/rc.config ! D

HC

P: Dynam

ic Host C

onfiguration Protocol: dynam

ically get address from as server

" �plug-and-play�

Page 53: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-53

DH

CP: D

ynamic H

ost Configuration Protocol

goal: allow host to dynam

ically obtain its IP address from netw

ork server w

hen it joins network

" can renew its lease on address in use

" allows reuse of addresses (only hold address w

hile connected/�on

�) " support for m

obile users to join network (m

ore shortly) D

HCP overview

: " host broadcasts �D

HC

P discover��m

sg [optional] " D

HC

P server responds with �D

HC

P offer��m

sg [optional] " host requests IP address: �D

HC

P request��m

sg " D

HC

P server sends address: �DH

CP ack�

�msg

Page 54: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-54

DH

CP client-server scenario

223.1.1.0/24

223.1.2.0/24

223.1.3.0/24

223.1.1.1

223.1.1.3 223.1.1.4 223.1.2.9

223.1.3.2 223.1.3.1

223.1.1.2

223.1.3.27 223.1.2.2 223.1.2.1

DH

CP

server

arriving DH

CP

client needs address in this netw

ork

Page 55: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-55

DH

CP server: 223.1.2.5

arriving client

DH

CP discover

src : 0.0.0.0, 68 dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID

: 654 D

HC

P offer src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID

: 654 lifetim

e: 3600 secs

DH

CP request

src: 0.0.0.0, 68 dest:: 255.255.255.255, 67 yiaddrr: 223.1.2.4 transaction ID

: 655 lifetim

e: 3600 secs

DH

CP A

CK

src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID

: 655 lifetim

e: 3600 secs

DH

CP client-server scenario

Page 56: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-56

DH

CP: m

ore than IP addresses

DH

CP can return m

ore than just allocated IP address on subnet: " address of first-hop router for client " nam

e and IP address of DN

S sever " netw

ork mask (indicating netw

ork versus host portion of address)

Page 57: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-57

! 

connecting laptop needs its IP address, addr of first-hop router, addr of D

NS server: use D

HC

P

router with D

HC

P server built into router

! 

DH

CP request encapsulated

in UD

P, encapsulated in IP, encapsulated in 802.1 Ethernet

! 

Ethernet frame broadcast

(dest: FFFFFFFFFFFF) on LAN

, received at router running D

HC

P server

! 

Ethernet demuxed to IP

demuxed, U

DP dem

uxed to D

HC

P

168.1.1.1

DH

CP

UD

P IP E

th P

hy

DH

CP

DH

CP

DH

CP

DH

CP

DH

CP D

HC

P U

DP

IP E

th P

hy

DH

CP

DH

CP

DH

CP

DH

CP

DH

CP

DH

CP: exam

ple

Page 58: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-58

DH

CP: W

ireshark output (hom

e LAN

) M

essage type: Boot R

eply (2) H

ardware type: E

thernet H

ardware address length: 6

Hops: 0

Transaction ID: 0x6b3a11b7

Seconds elapsed: 0

Bootp flags: 0x0000 (U

nicast) C

lient IP address: 192.168.1.101 (192.168.1.101) Your (client) IP address: 0.0.0.0 (0.0.0.0) N

ext server IP address: 192.168.1.1 (192.168.1.1) R

elay agent IP address: 0.0.0.0 (0.0.0.0) C

lient MA

C address: W

istron_23:68:8a (00:16:d3:23:68:8a) S

erver host name not given

Boot file nam

e not given M

agic cookie: (OK

) O

ption: (t=53,l=1) DH

CP M

essage Type = DH

CP A

CK

O

ption: (t=54,l=4) Server Identifier = 192.168.1.1 O

ption: (t=1,l=4) Subnet Mask = 255.255.255.0

Option: (t=3,l=4) R

outer = 192.168.1.1 O

ption: (6) Dom

ain Nam

e Server Length: 12; Value: 445747E2445749F244574092; IP A

ddress: 68.87.71.226; IP A

ddress: 68.87.73.242; IP A

ddress: 68.87.64.146 O

ption: (t=15,l=20) Dom

ain Nam

e = "hsd1.ma.com

cast.net."

reply

Message type: B

oot Request (1)

Hardw

are type: Ethernet

Hardw

are address length: 6 H

ops: 0 Transaction ID

: 0x6b3a11b7 S

econds elapsed: 0 B

ootp flags: 0x0000 (Unicast)

Client IP address: 0.0.0.0 (0.0.0.0)

Your (client) IP address: 0.0.0.0 (0.0.0.0) N

ext server IP address: 0.0.0.0 (0.0.0.0) R

elay agent IP address: 0.0.0.0 (0.0.0.0) C

lient MA

C address: W

istron_23:68:8a (00:16:d3:23:68:8a) S

erver host name not given

Boot file nam

e not given M

agic cookie: (OK

) O

ption: (t=53,l=1) DH

CP M

essage Type = DH

CP R

equest O

ption: (61) Client identifier

Length: 7; Value: 010016D323688A

; H

ardware type: E

thernet C

lient MA

C address: W

istron_23:68:8a (00:16:d3:23:68:8a) O

ption: (t=50,l=4) Requested IP A

ddress = 192.168.1.101 O

ption: (t=12,l=5) Host N

ame = "nom

ad" O

ption: (55) Parameter R

equest List Length: 11; Value: 010F03062C

2E2F1F21F92B

1 = Subnet M

ask; 15 = Dom

ain Nam

e 3 = R

outer; 6 = Dom

ain Nam

e Server 44 = N

etBIO

S over TC

P/IP N

ame S

erver …

request

Page 59: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-59

IP addresses: how to get one?

Q: how

does network get subnet part of IP addr?

A: gets portion of its provider ISP�s address space

ISP

's block 11001000 00010111 00010000 00000000 200.23.16.0/20 O

rganization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 O

rganization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 O

rganization 2 11001000 00010111 00010100 00000000 200.23.20.0/23 ... …

.. …. …

. O

rganization 7 11001000 00010111 00011110 00000000 200.23.30.0/23

Page 60: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-60

Hierarchical addressing: route aggregation

�Send m

e anything w

ith addresses beginning 200.23.16.0/20

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

Fly-By-N

ight-ISP

Organization 0

Organization 7

Internet

Organization 1

ISP

s-R-U

s �S

end me anything

with addresses

beginning 199.31.0.0/16

200.23.20.0/23 O

rganization 2

. . .

. . .

hierarchical addressing allows efficient advertisem

ent of routing inform

ation:

Page 61: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-61

ISPs-R-U

s has a more specific route to O

rganization 1

�Send m

e anything w

ith addresses beginning 200.23.16.0/20

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

Fly-By-N

ight-ISP

Organization 0

Organization 7

Internet

Organization 1

ISP

s-R-U

s �S

end me anything

with addresses

beginning 199.31.0.0/16 or 200.23.18.0/23

200.23.20.0/23 O

rganization 2

. . .

. . .

Hierarchical addressing: m

ore specific routes

Page 62: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-62

IP addressing: the last word...

Q: how

does an ISP get block of addresses? A: IC

AN

N: Internet C

orporation for Assigned

Nam

es and Num

bers http://ww

w.icann.org/

" allocates addresses " m

anages DN

S " assigns dom

ain names, resolves disputes

Page 63: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q1 H

eader fields

! W

hich of the following fields not part of either a

TC

P or UD

P header? A

. Source port

B. Source IP address

C. 

Receive w

indow

D. 

Length E. 

Checksum

Netw

ork Layer 4-63

Page 64: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q2 IP prefixes

! H

ow m

any IP addresses belong to the subnet 128.119.254.0/25 ?

Netw

ork Layer 4-64

Page 65: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q3 H

ow m

any subnets

! H

ow m

any subnets are there in this network? N

etwork Layer

4-65

223.1.2.2 223.1.2.1 223.1.2.6

223.1.3.2 223.1.3.1 223.1.3.27

223.1.8.0 223.1.8.1

Page 66: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

NA

T: netw

ork address translation

Netw

ork Layer 4-66

Page 67: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-67

NA

T: netw

ork address translation

10.0.0.1

10.0.0.2

10.0.0.3

10.0.0.4

138.76.29.7

local network

(e.g., home netw

ork) 10.0.0/24

rest of Internet

datagrams w

ith source or destination in this netw

ork have 10.0.0/24 address for source, destination (as usual)

all datagrams leaving local

network have sam

e single source N

AT IP address:

138.76.29.7,different source port num

bers

Page 68: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-68

motivation: local netw

ork uses just one IP address as far as outside w

orld is concerned: " range of addresses not needed from

ISP: just one IP address for all devices

" can change addresses of devices in local network

without notifying outside w

orld " can change ISP w

ithout changing addresses of devices in local netw

ork " devices inside local net not explicitly addressable,

visible by outside world (a security plus)

NA

T: netw

ork address translation

Page 69: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-69

implem

entation: NA

T router m

ust: " outgoing datagram

s: replace (source IP address, port #) of every outgoing datagram

to (NA

T IP address, new

port #) . . . rem

ote clients/servers will respond using (N

AT

IP address, new

port #) as destination addr

" remem

ber (in NAT translation table) every (source IP address,

port #) to (NA

T IP address, new

port #) translation pair

" incoming datagram

s: replace (NA

T IP address, new

port #) in dest fields of every incom

ing datagram w

ith corresponding (source IP address, port #) stored in N

AT

table

NA

T: netw

ork address translation

Page 70: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-70

10.0.0.1

10.0.0.2

10.0.0.3

S: 10.0.0.1, 3345

D: 128.119.40.186, 80

1 10.0.0.4

138.76.29.7

1: host 10.0.0.1 sends datagram

to 128.119.40.186, 80

NAT translation table

WA

N side addr LA

N side addr

138.76.29.7, 5001 10.0.0.1, 3345 …

… …

S: 128.119.40.186, 80

D: 10.0.0.1, 3345

4

S: 138.76.29.7, 5001

D: 128.119.40.186, 80

2

2: NAT router

changes datagram

source addr from

10.0.0.1, 3345 to 138.76.29.7, 5001, updates table

S: 128.119.40.186, 80

D: 138.76.29.7, 5001

3

3: reply arrives dest. address: 138.76.29.7, 5001

4: NAT router

changes datagram

dest addr from

138.76.29.7, 5001 to 10.0.0.1, 3345

NA

T: netw

ork address translation

Page 71: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-71

! 16-bit port-num

ber field: " ~65K

simultaneous connections w

ith a single W

AN

-side address! " Possible to allow

~65K connections to each

external destination [IP,port]. ! N

AT

is controversial: " routers should only process up to layer 3 " violates end-to-end argum

ent • N

AT

possibility must be taken into account by app

designers, e.g., P2P applications " address shortage ought to be solved by IPv6

NA

T: netw

ork address translation

Page 72: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-72

NA

T traversal problem

! client w

ants to connect to server w

ith address 10.0.0.1 " 

server address 10.0.0.1 local to LA

N (client can

�t use it as destination addr)

" only one externally visible N

AT

ed address: 138.76.29.7

! solution1: statically configure N

AT

to forward incom

ing connection requests at given port to server " 

e.g., (123.76.29.7, port 2500) alw

ays forwarded to 10.0.0.1 port

25000

10.0.0.1

10.0.0.4

NAT

router 138.76.29.7

client ?

Page 73: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-73

NA

T traversal problem

! solution 2: U

niversal Plug and Play (U

PnP) Internet Gatew

ay Device

(IGD

) Protocol. Allow

s NA

Ted

host to: ! learn public IP address (138.76.29.7)

! add/rem

ove port mappings

(with lease tim

es)

i.e., automate static N

AT

port m

ap configuration

10.0.0.1

NAT

router IGD

Page 74: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-74

NA

T traversal problem

! solution 3: relaying (used in Skype) " N

AT

ed client establishes connection to relay " external client connects to relay " relay bridges packets betw

een to connections

138.76.29.7

client

1. connection to relay initiated by N

ATed host

2. connection to relay initiated by client

3. relaying established

NAT

router

10.0.0.1

Page 75: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-75

4.1 introduction 4.2 virtual circuit and

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format

" IPv4 addressing

" IC

MP

" IPv6

4.5 routing algorithms

" link state

" distance vector

" hierarchical routing

4.6 routing in the Internet " 

RIP

" O

SPF " 

BGP

4.7 broadcast and multicast

routing

Chapter 4: outline

Page 76: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-76

ICM

P: internet control message protocol

! used by hosts &

routers to com

municate netw

ork-level inform

ation " 

error reporting: unreachable host, netw

ork, port, protocol

" echo request/reply (used by ping)

! netw

ork-layer �above� IP: " 

ICM

P msgs carried in IP

datagrams

! IC

MP m

essage: type, code plus first 8 bytes of IP datagram

causing error

Type Code description

0 0 echo reply (ping) 3 0 dest. netw

ork unreachable 3 1 dest host unreachable 3 2 dest protocol unreachable 3 3 dest port unreachable 3 6 dest netw

ork unknown

3 7 dest host unknown

4 0 source quench (congestion control - not used) 8 0 echo request (ping) 9 0 route advertisem

ent 10 0 router discovery 11 0 TTL expired 12 0 bad IP header

Page 77: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-77

Traceroute and IC

MP

! source sends series of U

DP segm

ents to dest " 

first set has TT

L =1 " 

second set has TT

L=2, etc. " 

unlikely port number

! w

hen nth set of datagrams

arrives to nth router: " 

router discards datagrams

" and sends source IC

MP

messages (type 11, code 0)

" IC

MP m

essages includes nam

e of router & IP address

! w

hen ICM

P messages

arrives, source records R

TT

s

stopping criteria: ! U

DP segm

ent eventually arrives at destination host

! destination returns IC

MP

�port unreachable� m

essage (type 3, code 3) ! source stops

3 probes

3 probes 3 probes

Page 78: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-78

IPv6: motivation

! initial m

otivation: 32-bit address space soon to be com

pletely allocated. ! additional m

otivation: " header form

at helps speed processing/forwarding

" header changes to facilitate QoS

IPv6 datagram form

at: " fixed-length 40 byte header " no fragm

entation allowed

Page 79: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-79

IPv6 datagram form

at

priority: identify priority among datagram

s in flow

flow Label: identify datagram

s in same �flow

.� (concept of�flow

� not well defined).

next header: identify upper layer protocol for data

data

destination address (128 bits)

source address (128 bits)

payload len next hdr

hop limit

flow label

pri ver

32 bits

Page 80: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-80

Other changes from

IPv4

! checksum

: removed entirely to reduce processing

time at each hop

! options: allow

ed, but outside of header, indicated by �N

ext Header� field

! ICM

Pv6: new version of IC

MP

" additional message types, e.g. �Packet T

oo Big� " m

ulticast group managem

ent functions

Page 81: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-81

Transition from

IPv4 to IPv6 ! not all routers can be upgraded sim

ultaneously " no �flag days� " how

will netw

ork operate with m

ixed IPv4 and IPv6 routers?

! tunneling: IPv6 datagram

carried as payload in IPv4 datagram

among IPv4 routers

IPv4 source, dest addr

IPv4 header fields

IPv4 datagram

IP

v6 datagram

IPv4 payload

UD

P/TC

P payload IP

v6 source dest addr IP

v6 header fields

Page 82: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-82

Tunneling

physical view:

IPv4

IPv4

A B

IPv6

IPv6

E

IPv6

IPv6

F C

D

logical view:

IPv4 tunnel

connecting IPv6 routers

E

IPv6

IPv6

F A

B

IPv6

IPv6

Page 83: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-83

flow: X

src: A dest: F data

A-to-B

: IP

v6

Flow: X

S

rc: A D

est: F data

src:B

dest: E

B-to-C

: IP

v6 inside IP

v4

E-to-F: IP

v6

flow: X

src: A dest: F data

B-to-C

: IP

v6 inside IP

v4

Flow: X

S

rc: A D

est: F data

src:B

dest: E

physical view:

A B

IPv6

IPv6

E

IPv6

IPv6

F C

D

logical view:

IPv4 tunnel

connecting IPv6 routers

E

IPv6

IPv6

F A

B

IPv6

IPv6

Tunneling

IPv4

IPv4

Page 84: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q1IP addressing: subnets

! T

he two subnets 128.119.245.129/25 and

128.119.245.4/26 have overlapping IP addresses. A

. T

rue B. 

False

Netw

ork Layer 4-84

Page 85: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q2 IP addressing: D

HC

P

! W

hat transport protocol does DH

CP use?

A. 

UD

P B. 

TC

P C

. IP

D. 

HT

TP

Netw

ork Layer 4-85

Page 86: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q3 IP addressing: N

AT

s

! A

host with a private IP address 192.168.0.2

opens a TC

P socket on its local port 4567 and connects to a w

eb server at 34.5.6.7. The N

AT

’s public IP address is 22.33.44.55. W

hich of the follow

ing mapping entries could the N

AT

create as a result?

A. 

[22.33.44.55, 3333]$[192.168.0.2, 80]

B. [34.5.6.7, 80] $

[22.33.44.55, 4567] C

. [192.168.0.2, 80]$

[34.5.6.7, 4567] D

. [22.33.44.55, 3967]$

[192.168.0.2, 4567]

Netw

ork Layer 4-86

192.168.0.2

NAT

router

22.33.44.55

34.5.6.7

Page 87: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q4 IP addressing: N

AT

s

! A

host with a private IP address 192.168.0.2 opens a T

CP

socket on its local port 4567 and connects to a web

server at 34.5.6.7. The N

AT

’s public IP address is 22.33.44.55. Suppose the N

AT

created the mapping

[22.33.44.55, 3967]$[192.168.0.2, 4567] as a result.

What are the source and destination port num

bers in the SY

NA

CK

response from the server?

A. 

80, 3967 B. 

4567, 80 C

. 3967, 80

D. 

3967, 4567

Netw

ork Layer 4-87

192.168.0.2

NAT

router

22.33.44.55

34.5.6.7

Page 88: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q5 IP addressing: N

AT

s

! W

hich of the following is false about N

AT

s? A

. N

AT

s are network layer devices but process

both network and transport layer headers.

B. T

he number of possible sim

ultaneous connections through a N

AT

is limited by the size

of the port number space.

C. 

The num

ber of possible simultaneous

connections through a NA

T is lim

ited by the size of the private (LA

N-side) IP address space.

D. 

Outgoing packets from

a NA

T originating from

different LA

N-side m

achines can not have the sam

e [srcIP, srcPort]. N

etwork Layer

4-88

Page 89: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q6 IP addressing IPv6

! W

hich of the following is not true?

A. 

IPv6 increases the size of the IP address space from

2^32 to 2^128. B. 

IPv6 removes checksum

s and fragmentation

compared to IPv4.

C. 

IPv6 has fixed length headers. D

. IPv6 adds reliability at the netw

ork layer.

Netw

ork Layer 4-89

Page 90: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-90

4.1 introduction 4.2 virtual circuit and

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format

" IPv4 addressing

" IC

MP

" IPv6

4.5 routing algorithms

" link state

" distance vector

" hierarchical routing

4.6 routing in the Internet " 

RIP

" O

SPF " 

BGP

4.7 broadcast and multicast

routing

Chapter 4: outline

Page 91: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-91

1

2 3

IP destination address in arriving packet�s header

routing algorithm

local forwarding table

dest address output link address-range 1 address-range 2 address-range 3 address-range 4

3 2 2 1

Interplay between routing, forw

arding

routing algorithm determ

ines end-end-path through netw

ork

forwarding table determ

ines local forw

arding at this router

Page 92: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-92

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

Graph abstraction

aside: graph abstraction is useful in other network contexts, e.g.,

P2P, w

here N is set of peers and E

is set of TCP connections

Page 93: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-93

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

�) e.g., c(w

,z) = 5 cost could alw

ays be 1, or inversely related to bandw

idth, or inversely related to congestion

cost of path (x1 , x

2 , x3 ,…

, xp ) = c(x

1 ,x2 ) + c(x

2 ,x3 ) + …

+ c(xp-1 ,x

p )

key question: what is the least-cost path betw

een u and z ? routing algorithm

: algorithm that finds that least cost path

Page 94: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-94

Routing algorithm

classification

Q: global or decentralized inform

ation? global: ! all routers have com

plete topology, link cost info

! �link state� algorithm

s decentralized: ! router know

s physically-connected neighbors, link costs to neighbors

! iterative process of com

putation, exchange of info w

ith neighbors ! �distance vector� algorithm

s

Q: static or dynam

ic? static: ! routes rarely change

dynamic:

! routes change frequently " periodic update " upon link cost change

Page 95: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-95

4.1 introduction 4.2 virtual circuit and

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format

" IPv4 addressing

" IC

MP

" IPv6

4.5 routing algorithms

" link state

" distance vector

" hierarchical routing

4.6 routing in the Internet " 

RIP

" O

SPF " 

BGP

4.7 broadcast and multicast

routing

Chapter 4: outline

Page 96: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-96

A Link-State R

outing Algorithm

Dijkstra�s algorithm

! netw

ork topology, link costs know

n to all nodes " 

via �link state broadcast� " 

all nodes have same info

! com

putes least cost paths from

one node (�source�) to all other nodes " 

gives node forwarding table

! iterative: after k iterations, know

least cost path to k dest.�s

notation: ! c(x,y): link cost from

node x to y; = ∞

if not direct neighbors

! D

(v): current value of cost of path from

src to dest v ! p(v): predecessor node along path from

source to v ! N

': set of nodes whose

least cost path definitively know

n

Page 97: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-97

Dijsktra�s A

lgorithm

1 Initialization: 2 N

' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D

(v) = c(u,v) 6 else D

(v) = ∞

7 8 

Loop 16 until all nodes in N

'

notation: ! 

c(x,y): link cost from node x to y; =

∞ if not direct neighbors

! 

D(v): current value of cost of path

from src to dest v

! 

p(v): predecessor node along path from

source to v ! 

N': set of nodes w

hose least cost path definitively know

n

u

y x

w v

z 2

2 1

3

1

1 2 5

3 5

Page 98: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-98

Dijsktra�s A

lgorithm

1 Initialization: 2 N

' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D

(v) = c(u,v) 6 else D

(v) = ∞

7 8 Loop 9 find w

not in N' such that D

(w) is a m

inimum

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 know

n 14 

shortest path cost to w plus cost from

w to v */

15 p(v) %

w if D

(v) changed above 16 until all nodes in N

'

notation: ! 

c(x,y): link cost from node x to y; =

∞ if not direct neighbors

! 

D(v): current value of cost of path

from src to dest v

! 

p(v): predecessor node along path from

source to v ! 

N': set of nodes w

hose least cost path definitively know

n

Page 99: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-99

w 3

4

v x

u

5

3 7

4

y 8

z 2

7 9

Dijkstra�s algorithm

: example

Step

N'

D(v) p(v)

0 1 2 3 4 5

D(w

) p(w

) D(x) p(x) D

(y) p(y) D

(z) p(z)

u ∞

7,u

3,u 5,u

uw

11,w

6,w

5,u 14,x

11,w

6,w

uwx

uwxv

14,x 10,v

uwxvy

12,y

notes: ! 

construct shortest path tree by tracing predecessor nodes

! 

ties can exist (can be broken arbitrarily)

uwxvyz

Page 100: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-100

Dijkstra�s algorithm

: another example

Step 0 1 2 3 4 5

N' u

ux uxy

uxyv uxyvw

uxyvw

z

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

Page 101: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-101

Dijkstra�s algorithm

: example (2)

u

y x

w v

z

resulting shortest-path tree from u:

v x y w z

(u,v) (u,x)

(u,x) (u,x) (u,x)

destination link

resulting forwarding table in u:

Page 102: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-102

Dijkstra�s algorithm

, discussion algorithm

complexity: n nodes

! each iteration: need to check all nodes, w

, not in N

! n(n+1)/2 com

parisons: O(n

2) ! m

ore efficient implem

entations possible: O(nlogn)

oscillations possible: ! e.g., support link cost equals am

ount of carried traffic:

A D

C B

1 1+e

e 0

e 1

1

0 0

initially

A D

C B

given these costs, find new

routing….

resulting in new costs

2+e 0

0 0

1+e 1

A D

C B

given these costs, find new

routing….

resulting in new costs

0 2+e

1+e 1

0 0

A D

C B

given these costs, find new

routing….

resulting in new costs

2+e 0

0 0

1+e 1

Page 103: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-103

4.1 introduction 4.2 virtual circuit and

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format

" IPv4 addressing

" IC

MP

" IPv6

4.5 routing algorithms

" link state

" distance vector

" hierarchical routing

4.6 routing in the Internet " 

RIP

" O

SPF " 

BGP

4.7 broadcast and multicast

routing

Chapter 4: outline

Page 104: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-104

Distance vector algorithm

Bellman-Ford equation (dynam

ic programm

ing) let d

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

then d

x (y) = min {c(x,v) + d

v (y) }

v

cost to neighbor v

min taken over all neighbors v of x

cost from neighbor v to destination y

Page 105: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-105

Bellman-Ford exam

ple

u

y x

w v

z 2

2 1

3

1

1 2 5

3 5

clearly, dv (z) = 5, d

x (z) = 3, dw (z) = 3

du (z) = m

in { c(u,v) + dv (z),

c(u,x) + dx (z),

c(u,w) + d

w (z) } = m

in {2 + 5, 1 + 3, 5 + 3} = 4

node achieving minim

um is next

hop in shortest path, used in forwarding table

B-F equation says:

Page 106: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-106

Distance vector algorithm

! D

x (y) = estimate of least cost from

x to y " x m

aintains distance vector Dx = [D

x (y): y � N ]

! node x: " know

s cost to each neighbor v: c(x,v) " m

aintains its neighbors� distance vectors. For each neighbor v, x m

aintains D

v = [Dv (y): y � N

]

Page 107: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-107

key idea: ! from

time-to-tim

e, each node sends its own

distance vector estimate to neighbors

! w

hen x receives new D

V estim

ate from neighbor,

it updates its own D

V using B-F equation:

Dx (y) ←

min

v {c(x,v) + Dv (y)} for each node y � N

! under m

inor, natural conditions, the estimate D

x (y) converge to the actual least cost d

x (y)

Distance vector algorithm

Page 108: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-108

iterative, asynchronous: each local iteration caused by:

! local link cost change

! D

V update m

essage from

neighbor distributed: ! each node notifies neighbors only w

hen its D

V changes

" neighbors then notify their neighbors if necessary

wait for (change in local link

cost or msg from

neighbor)

recompute

estimates

if DV

to any dest has changed, notify neighbors

each node:

Distance vector algorithm

Page 109: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-109

x y z

x y z

0 2 7

∞ ∞

∞ ∞

from

cost to

from from

x y z

x y z

0

x y z

x y z

∞ ∞

∞ ∞

cost to

x y z

x y z ∞

∞ ∞

7 1

0

cost to

2 0 1

∞ ∞

2 0 1 7 1 0

time

x z

1 2

7 y

node x table

Dx (y) = m

in{c(x,y) + Dy (y), c(x,z) + D

z (y)} = m

in{2+0 , 7+1} = 2 D

x (z) = min{c(x,y) +

Dy (z), c(x,z) + D

z (z)} = m

in{2+1 , 7+0} = 3

3 2

node y table

node z table

cost to

from

Page 110: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-110

x y z

x y z

0 2 3

from

cost to

x y z

x y z

0 2 7

from cost to

x y z

x y z

0 2 3

from

cost to

x y z

x y z

0 2 3 from

cost to x y z

x y z

0 2 7

from

cost to

2 0 1 7 1 0

2 0 1 3 1 0

2 0 1 3 1 0

2 0 1

3 1 0

2 0 1

3 1 0 time

x y z

x y z

0 2 7

∞ ∞

∞ ∞

from

cost to

from from

x y z

x y z

0

x y z

x y z

∞ ∞

∞ ∞

cost to

x y z

x y z ∞

∞ ∞

7 1

0

cost to

2 0 1

∞ ∞

2 0 1 7 1 0

time

x z

1 2

7 y

node x table

Dx (y) = m

in{c(x,y) + Dy (y), c(x,z) + D

z (y)} = m

in{2+0 , 7+1} = 2 D

x (z) = min{c(x,y) +

Dy (z), c(x,z) + D

z (z)} = m

in{2+1 , 7+0} = 3

3 2

node y table

node z table

cost to

from

Page 111: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-111

Distance vector: link cost changes

link cost changes: ! node detects local link cost change

! updates routing info, recalculates distance vector

! if D

V changes, notify neighbors

�good new

s travels fast�

x z

1 4

50

y 1

t0 : y detects link-cost change, updates its DV, inform

s its neighbors. t1 : z receives update from

y, updates its table, computes new

least cost to x , sends its neighbors its D

V. t2 : y receives z

�s update, updates its distance table. y�s least costs

do not change, so y does not send a message to z.

Page 112: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-112

Distance vector: link cost changes

link cost changes: ! node detects local link cost change

! bad new

s travels slow - �count to

infinity� problem!

! 44 iterations before algorithm

stabilizes: see text

x z

1 4

50

y 60

poisoned reverse: ! If Z

routes through Y to get to X

: " 

Z tells Y

its (Z�s) distance to X

is infinite (so Y w

on�t route

to X via Z

) ! w

ill this completely solve count to infinity problem

?

Page 113: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-113

Com

parison of LS and DV

algorithms

message com

plexity ! 

LS: with n nodes, E links, O

(nE) m

sgs sent ! 

DV: exchange betw

een neighbors only " 

convergence time varies

speed of convergence ! 

LS: O(n

2) algorithm requires

O(nE) m

sgs " 

may have oscillations

! 

DV: convergence tim

e varies " 

may be routing loops

" count-to-infinity problem

robustness: what happens if

router malfunctions?

LS: " node can advertise incorrect link cost

" each node com

putes only its ow

n table D

V: " D

V node can advertise

incorrect path cost " 

each node�s table used by others

• error propagate thru network

Page 114: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q1Intradom

ain routing

! W

hich of link state and distance vector routing has m

ore predictable convergence times?

1. Link state

2. D

istance vector

Netw

ork Layer 4-114

Page 115: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q2 Intradom

ain routing

! In this link-state routing netw

ork running D

ijkstra’s algorithm, the set N

’ (the set of nodes to w

hich the least cost is definitively known) is

initially {u}. After tw

o iterations, which nodes

belong to N’?

A. 

u B. 

ux C

. uw

D

. uvx

E. uw

x

Netw

ork Layer 4-115

u

y x

w v

z 3

5 1

1

3

4 8 5

3 4

Page 116: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q3 Intradom

ain routing

! In link state routing, the tim

e for routing to re-converge after a link-cost change does N

OT

significantly depend on w

hich one of the follow

ing? A

. N

umber of nodes

B. D

iameter of the netw

ork C

. W

hether the link cost increased or decreased D

. W

hether routing is load-dependent or not Netw

ork Layer 4-116

Page 117: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q4 Intradom

ain routing

! In this distance vector routing netw

ork, roughly how

many iterations w

ill the network take to re-

converge after the event shown?

Netw

ork Layer 4-117

x z

2 4

80

y 100

Page 118: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-118

4.1 introduction 4.2 virtual circuit and

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format

" IPv4 addressing

" IC

MP

" IPv6

4.5 routing algorithms

" link state

" distance vector

" hierarchical routing

4.6 routing in the Internet " 

RIP

" O

SPF " 

BGP

4.7 broadcast and multicast

routing

Chapter 4: outline

Page 119: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-119

Hierarchical routing

scale: with ~1B hosts,

millions of routers

! can�t store the entire

Internet graph! ! routing table exchange w

ould swam

p links!

administrative autonom

y ! internet = netw

ork of netw

orks ! each netw

ork admin m

ay w

ant to control routing in its ow

n network

our routing study thus far - idealization ! all routers identical

! netw

ork �flat� …

not true in practice

Page 120: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-120

! aggregate routers into regions, �autonom

ous system

s� (AS)

! routers in sam

e AS

run same routing

protocol " �intra-A

S� routing protocol

" routers in different AS

can run different intra-A

S routing protocol

gateway router:

! at �edge� of its ow

n AS

! has link to router in another A

S

Hierarchical routing

Page 121: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-121

3b

1d

3a 1c

2a A

S3

AS

1 A

S2

1a

2c 2b

1b

Intra-AS

R

outing algorithm

Inter-AS

R

outing algorithm

Forwarding

table

3c

Interconnected ASes !

 forwarding table

configured by both intra- and inter-A

S routing algorithm

" intra-A

S sets entries for internal dests

" inter-AS &

intra-AS

sets entries for external dests

Page 122: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-122

Inter-AS tasks

! suppose router in A

S1 receives datagram

destined outside of A

S1: " router should forw

ard packet to gatew

ay router, but w

hich one?

AS1 must:

1. learn w

hich dests are reachable through A

S2, w

hich through AS3

2. propagate this reachability info to all routers in A

S1 job of inter-AS routing!

AS

3

AS

2

3b 3c 3a A

S1

1c 1a

1d 1b

2a 2c 2b

other netw

orks other netw

orks

Page 123: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-123

Example: setting forw

arding table in router 1d

! suppose A

S1 learns (via inter-AS protocol) that subnet x

reachable via AS3 (gatew

ay 1c), but not via AS2

" inter-AS protocol propagates reachability info to all internal

routers ! router 1d determ

ines from intra-A

S routing info that its interface I is on the least cost path to 1c " installs forw

arding table entry (x,I)

AS

3

AS

2

3b 3c 3a A

S1

1c 1a

1d 1b

2a 2c 2b

other netw

orks other netw

orks

x …

Page 124: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-124

Example: choosing am

ong multiple A

Ses

! now

suppose AS1 learns from

inter-AS protocol that subnet

x is reachable from A

S3 and from A

S2. ! to configure forw

arding table, router 1d must determ

ine w

hich gateway it should forw

ard packets towards for dest x

" this is also job of inter-AS routing protocol!

AS

3

AS

2

3b 3c 3a A

S1

1c 1a

1d 1b

2a 2c 2b

other netw

orks other netw

orks

x …

?

Page 125: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-125

learn from inter-A

S

protocol that subnet x is reachable via m

ultiple gateways

use routing info from

intra-AS

protocol to determ

ine costs of least-cost

paths to each of the gatew

ays

hot potato routing: choose the gatew

ay that has the

smallest least cost

determine from

forw

arding table the interface I that leads

to least-cost gateway.

Enter (x,I) in

forwarding table

Example: choosing am

ong multiple A

Ses

! now

suppose AS1 learns from

inter-AS protocol that subnet

x is reachable from A

S3 and from A

S2. ! to configure forw

arding table, router 1d must determ

ine tow

ards which gatew

ay it should forward packets for dest x

" this is also job of inter-AS routing protocol!

! hot potato routing: send packet tow

ards closest of two

routers.

Page 126: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-126

4.1 introduction 4.2 virtual circuit and

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format

" IPv4 addressing

" IC

MP

" IPv6

4.5 routing algorithms

" link state

" distance vector

" hierarchical routing

4.6 routing in the Internet " 

RIP

" O

SPF " 

BGP

4.7 broadcast and multicast

routing

Chapter 4: outline

Page 127: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-127

Intra-AS R

outing

! also know

n as interior gateway protocols (IG

P) ! m

ost comm

on intra-AS routing protocols:

" RIP: R

outing Information Protocol

" OSPF: O

pen Shortest Path First " IG

RP: Interior G

ateway R

outing Protocol (C

isco proprietary)

Page 128: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-128

RIP ( R

outing Information Protocol)

! included in BSD

-UN

IX distribution in 1982

! distance vector algorithm

" 

distance metric: # hops (m

ax = 15 hops), each link has cost 1 " 

DV

s exchanged with neighbors every 30 sec (advertisem

ent) " 

each advertisement can list up to 25 destination IP subnets

D C

B A

u v

w x

y z

subnet hops u 1 v 2 w

2 x 3 y 3 z 2

from router A to destination subnets:

Page 129: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-129

w

x

y

z

A

C

D

B

destination subnet next router # hops to dest

w

A

2 y

B

2

z

B

7

x

--

1

….

….

....

routing table in router D A

5

dest next hops w

- 1 x

- 1 z

C 4

….

… ... A

-to-D advertisem

ent R

IP: example

Page 130: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-130

RIP: link failure, recovery

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 advertisem

ents (if tables changed)

" link failure info quickly (?) propagates to entire network

" poison reverse used to prevent ping-pong loops (infinite distance = 16 hops)

Page 131: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-131

RIP table processing

! R

IP routing tables managed by application-level

process called route-d (daemon)

! advertisem

ents sent as periodic UD

P packets

physical link

network forw

arding (IP

) table

transport (U

DP

)

routed

physical link

network

(IP)

transprt (U

DP

)

routed

forwarding

table

Page 132: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-132

OSPF (O

pen Shortest Path First)

! �open

�: publicly available ! uses link state algorithm

" LS packet dissem

ination " full topology m

ap at each node " route com

putation using Dijkstra�s algorithm

! O

SPF advertisement carries one entry per neighbor

! advertisem

ents flooded to entire AS

" carried in OSPF m

essages directly over IP (rather than T

CP or U

DP

! IS-IS routing protocol: nearly identical to O

SPF

Page 133: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-133

OSPF �advanced

� features (not in RIP)

! security: all O

SPF messages authenticated (to prevent

malicious intrusion)

! m

ultiple same-cost paths allow

ed (only one in RIP)

! T

OS : for each link, m

ultiple cost metrics for

different TO

S (e.g., satellite link cost set �low� for

best effort ToS; high for real tim

e ToS)

! integrated unicast and m

ulticast support: " M

ulticast OSPF (M

OSPF) uses sam

e topology data base as O

SPF ! hierarchical O

SPF in large domains.

Page 134: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-134

Hierarchical O

SPF boundary router backbone router

area 1 area 2

area 3

backbone area border routers

internal routers

Page 135: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-135

! tw

o-level hierarchy: local area, backbone. " link-state advertisem

ents only in area " each nodes has detailed area topology; only know

direction (shortest path) to nets in other areas.

! area border routers: �sum

marize� distances to nets in

own area, advertise to other A

rea Border routers. ! backbone routers: run O

SPF limited to backbone.

! boundary routers: connect to other A

S�s.

Hierarchical O

SPF

Page 136: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-136

Internet inter-AS routing: BG

P

! BG

P (Border Gatew

ay Protocol): the de facto inter-dom

ain routing protocol " �glue that holds the Internet together�

! BG

P provides each AS a m

eans to: " eBG

P: obtain subnet reachability information from

neighboring A

Ss. " iBG

P: propagate reachability information to all A

S-internal routers.

" determ

ine �good� routes to other netw

orks based on reachability inform

ation and policy. ! allow

s subnet to advertise its existence to rest of Internet: �I am

here�

Page 137: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-137

BGP basics

! w

hen AS3 advertises a prefix to A

S1: " 

AS3 prom

ises it will forw

ard datagrams tow

ards that prefix " 

AS3 can aggregate prefixes in its advertisem

ent

AS

3

AS

2

3b 3c 3a A

S1

1c 1a

1d 1b

2a 2c 2b

other netw

orks other netw

orks

! BG

P session: two BG

P routers (�peers�) exchange BGP

messages: " 

advertises paths to destination network prefixes (�path vector� protocol)

" exchanged over sem

i-permanent T

CP connections

BG

P m

essage

Page 138: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-138

BGP basics: distributing path inform

ation

AS

3

AS

2

3b 3a A

S1

1c 1a

1d 1b

2a 2c 2b

other netw

orks other netw

orks

! using eBG

P session between 3a and 1c, A

S3 sends prefix reachability info to A

S1. " 

1c can then use iBGP to distribute prefix info to all routers in A

S1 " 

1b can then re-advertise reachability info to AS2 over 1b-to-2a

eBGP session

! w

hen router learns of new prefix, it creates entry for

prefix in its forwarding table.

eBG

P session

iBG

P session

route propagation

Page 139: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-139

Path attributes and BGP routes

! advertised prefix includes BG

P attributes " prefix + attributes = �route�

! tw

o important attributes:

" AS-PA

TH

: contains ASs through w

hich prefix advertisem

ent has passed: e.g., [AS 67, A

S 17, AS 24]

" NEX

T-H

OP: indicates specific internal-A

S router to next-hop A

S. (multiple links m

ay exist from self to next-hop-A

S) ! policy-based routing: gatew

ay router receiving route advertisem

ent uses import policy to select/reject route and

export policy to re-advertise route " e.g., select cheaper route; or never route through A

S x; or never advertise routes to A

S y.

Page 140: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-140

BGP route selection (im

port policy) ! router m

ay learn about more than 1 route to

destination AS, selects route based on:

1. local preference value attribute: policy decision

2. shortest A

S-PAT

H

3. closest N

EXT

-HO

P router: hot potato routing 4. 

additional criteria

Page 141: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-141

BGP re-announce (export policy)

! R

outers comm

only use “valley-free” routing export policy " 

Never advertise peer or provider routes to another

peer or provider. ! Exam

ples (arrows indicate $ flow

or customer $

provider relationship, else peering):

Q: W

hich of the above routes are permitted by “valley free” export policy?

Page 142: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-142

BGP m

essages

! BG

P messages exchanged betw

een peers over TC

P connection

! BG

P messages:

" OPEN

: opens TC

P connection to peer and authenticates sender

" UPD

AT

E: advertises new path (or w

ithdraws old)

" KEEPA

LIVE: keeps connection alive in absence of

UPD

AT

ES; also AC

Ks O

PEN request

" NO

TIFIC

AT

ION

: reports errors in previous msg; also

used to close connection

Page 143: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-143

BGP routing policy

! A

,B,C are provider netw

orks ! X

,W,Y

are customer (of provider netw

orks) ! X

is dual-homed: attached to tw

o networks

" X does not w

ant to route from B via X

to C

" .. so X w

ill not advertise to B a route to C

A

B C

W

X Y

legend:

customer

network:

provider

network

Page 144: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-144

BGP routing policy (2)

! A

advertises path AW to B

! B advertises path BAW

to X

! Should B advertise path BAW

to C?

" N

o way! B gets no �revenue� for routing C

BAW since neither W

nor C

are B�s custom

ers " 

B wants to force C

to route to w via A

" 

B wants to route only to/from

its customers!

A

B C

W

X Y

legend:

customer

network:

provider

network

Page 145: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-145

Why different Intra-, Inter-A

S routing ? policy: ! inter-A

S: admin w

ants control over how its traffic

routed, who routes through its net.

! intra-A

S: single admin, so no policy decisions needed

scale: ! hierarchical routing saves table size, reduced update traffic

performance:

! intra-A

S: can focus on performance

! inter-A

S: policy may dom

inate over performance

Page 146: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q1N

etwork-layer functions

! W

hich of the following are respectively used to

(1) assign an IP address, (2) forward packets, (3)

compute routes w

ithin an AS?

A. 

DH

CP, longest prefix m

atching, link-state routing B. 

IP, NA

T, BG

P C

. IP, m

emory/bus/interconnection architecture,

OSPF

D. 

DN

S, longest-prefix matching, interdom

ain routing

E. T

CP, IP, BG

P

Netw

ork Layer 4-146

Page 147: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q2 Internet routing

! W

hat is hot-potato routing used for? A

. T

o determine w

hether to accept or decline a route.

B. T

o determine w

hether and who to re-advertise

a route C

. T

o determine the best interdom

ain route by relying on intradom

ain routing information

D. 

To determ

ine the best interdomain route based

on local preferences. E. 

To dissem

inate interdomain routing inform

ation to routers w

ithin an AS

Netw

ork Layer 4-147

Page 148: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q3 Internet routing

! W

hat is the most num

ber of iterations that RIP

can take to re-converge after a routing event? (H

int: how bad can count-to-infinity be in R

IP given its im

plementation?)

Netw

ork Layer 4-148

Page 149: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Q4 Internet routing

! A

re the two routes below

allowed by valley-free

routing? The source is the leftm

ost node and the destination is the rightm

ost. Arrow

s indicate custom

er-to-provider $-flow relationship, non-

arrowed lines indicate peering.

A. 

Yes, Y

es B. 

No, N

o C

. Y

es, No

D. 

No, Y

es

Netw

ork Layer 4-149

Page 150: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-150

4.1 introduction 4.2 virtual circuit and

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format

" IPv4 addressing

" IC

MP

" IPv6

4.5 routing algorithms

" link state

" distance vector

" hierarchical routing

4.6 routing in the Internet " 

RIP

" O

SPF " 

BGP

4.7 broadcast and multicast

routing

Chapter 4: outline

Page 151: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-151

R1

R2

R3

R4

source duplication

R1

R2

R3

R4

in-network

duplication

duplicate creation/transm

ission duplicate

duplicate

Broadcast routing ! deliver packets from

source to all other nodes ! source duplication is inefficient:

! source duplication: how

does source determine

recipient addresses?

Page 152: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-152

Limiting in-netw

ork duplication

! flooding: w

hen node receives broadcast packet, sends copy to all neighbors " problem

s: cycles & broadcast storm

! controlled flooding: node only broadcasts pkt if it hasn�t broadcast sam

e packet before " node keeps track of packet ids already broadacsted " e.g., reverse path forw

arding (RPF) (details shortly)

! spanning tree: " packets only forw

arded along a single shared spanning tree, so no redundant packets received by any node

Page 153: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-153

Multicast routing: problem

statement

goal: find a tree (or trees) connecting routers having local m

ulticast group mem

bers ! tree: not all paths betw

een routers used ! group-shared: single spanning tree used by all m

embers

shared tree source-based trees

group m

ember

not group m

ember

router w

ith a group m

ember

router w

ithout group m

ember

legend

! source-based: different tree from

each sender to rcvrs

Group-shared spanning tree and

source-based forest broad approaches for both broadcast

and multicast routing

Page 154: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-154

A

B

G

D

E

c

F

A

B

G

D

E

c

F

(a) broadcast initiated at A (b) broadcast initiated at D

Shared spanning tree

! first construct one spanning tree, then forw

ard/m

ake copies only along that spanning tree

Page 155: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-155

A

B

G

D

E

c

F 1

2

3

4

5

(a) stepwise construction of

spanning tree (center: E)

A

B

G

D

E

c

F

(b) constructed spanning tree

Shared spanning tree: creation ! pick a center node

! each node sends unicast join m

essage to center " m

essage forwarded until it arrives at a node already

belonging to spanning tree

Page 156: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-156

Source-based shortest path tree

! m

ulticast forwarding tree: tree of shortest path

routes from source to all receivers

" e.g., Dijkstra�s algorithm

+ reverse-path forwarding

i

router with attached

group mem

ber

router with no attached

group mem

ber

link used for forwarding,

i indicates order link added by algorithm

LEG

EN

D

R1

R2

R3

R4 R

5

R6

R7

2 1

6

3 4

5

s: source

Page 157: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-157

Reverse path forw

arding

if (multicast datagram

received on incoming link on

shortest path back to source) then flood datagram

onto all outgoing links else ignore datagram

! source-based approach relying on router�s know

ledge of unicast shortest path to sender ! each router has sim

ple forwarding behavior:

Page 158: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-158

Reverse path forw

arding: example

! result is a source-specific reverse SPT

" m

ay be a bad choice with asym

metric links

router with attached

group mem

ber

router with no attached

group mem

ber

datagram w

ill be forwarded

LEG

EN

D

R1

R2

R3

R4 R

5

R6

R7

s: source

datagram w

ill not be forw

arded

Page 159: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-159

Reverse path forw

arding: pruning ! forw

arding tree has subtrees with no m

cast group mem

bers " no need to forw

ard datagrams dow

n subtree " �prune�

�msgs sent upstream

by router with no

downstream

group mem

bers

router with attached

group mem

ber

router with no attached

group mem

ber

prune message

LEG

EN

D

links with m

ulticast forw

arding

P

R1

R2

R3

R4 R

5

R6

R7

s: source

P

P

Page 160: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

End of Chapter 4 syllabus

Netw

ork Layer 4-160

Page 161: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-161

Shared-tree: steiner tree

! steiner tree: m

inimum

cost tree connecting all routers w

ith attached group mem

bers ! problem

is NP-com

plete ! excellent heuristics exists

! not used in practice: " com

putational complexity

" information about entire netw

ork needed " m

onolithic: rerun when any router needs to join/leave

Page 162: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-162

Center-based trees

! single delivery tree shared by all

! one router identified as �center� of tree

! to join: " edge router sends unicast join-m

sg addressed to center router

" join-msg �processed

� by intermediate routers and

forwarded tow

ards center " join-m

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

" path taken by join-msg becom

es new branch of tree for

this router

Page 163: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-163

Center-based trees: exam

ple

suppose R6 chosen as center: router w

ith attached group m

ember

router with no attached

group mem

ber

path order in which join

messages generated

LEG

EN

D

2 1

3

1

R1

R2

R3

R4 R

5

R6

R7

Page 164: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-164

Internet Multicasting R

outing: DV

MR

P

! D

VM

RP: distance vector m

ulticast routing protocol, R

FC1075

! flood and prune: reverse path forw

arding, source-based tree " R

PF tree based on DV

MR

P�s ow

n routing tables constructed by com

municating D

VM

RP routers

" no assumptions about underlying unicast

" initial datagram to m

cast group flooded everywhere

via RPF

" routers not wanting group: send upstream

prune msgs

Page 165: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-165

DV

MR

P: continued…

! soft state: D

VM

RP router periodically (1 m

in.) �forgets� branches are pruned: " m

cast data again flows dow

n unpruned branch " dow

nstream router: reprune or else continue to receive

data ! routers can quickly regraft to tree " follow

ing IGM

P join at leaf ! odds and ends " com

monly im

plemented in com

mercial router

Page 166: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-166

Tunneling

Q: how

to connect �islands� of multicast routers in a

�sea� of unicast routers?

! m

cast datagram encapsulated inside �norm

al� (non-m

ulticast-addressed) datagram

! norm

al IP datagram sent thru �tunnel� via regular IP unicast

to receiving mcast router (recall IPv6 inside IPv4 tunneling)

! receiving m

cast router unencapsulates to get mcast

datagram physical topology

logical topology

Page 167: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-167

PIM: Protocol Independent M

ulticast

! not dependent on any specific underlying unicast routing algorithm

(works w

ith all)

! tw

o different multicast distribution scenarios :

dense: ! group m

embers densely

packed, in �close� proxim

ity. ! bandw

idth more plentiful

sparse: ! # netw

orks with group

mem

bers small w

rt # interconnected netw

orks ! group m

embers �w

idely dispersed

� ! bandw

idth not plentiful

Page 168: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-168

Consequences of sparse-dense dichotom

y:

dense ! group m

embership by

routers assumed until

routers explicitly prune ! data-driven construction on m

cast tree (e.g., RPF)

! bandw

idth and non-group-router processing profligate

sparse: ! no m

embership until routers

explicitly join ! receiver- driven construction of m

cast tree (e.g., center-based)

! bandw

idth and non-group-router processing conservative

Page 169: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-169

PIM- dense m

ode

flood-and-prune RPF: sim

ilar to DV

MR

P but…

! underlying unicast protocol provides R

PF info for incom

ing datagram

! less com

plicated (less efficient) downstream

flood than D

VM

RP reduces reliance on

underlying routing algorithm

! has protocol m

echanism for router to detect it

is a leaf-node router

Page 170: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-170

PIM - sparse m

ode

! center-based approach

! router sends join m

sg to rendezvous point (R

P) " interm

ediate routers update state and forw

ard join ! after joining via R

P, router can sw

itch to source-specific tree " increased

performance: less

concentration, shorter paths

all data multicast

from rendezvous

point

rendezvous point

join

join

join

R1

R2

R3

R4 R

5

R6

R7

Page 171: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-171

sender(s): ! unicast data to R

P, w

hich distributes dow

n RP-rooted tree

! R

P can extend mcast

tree upstream to

source ! R

P can send stop msg

if no attached receivers " �no one is listening!�

all data multicast

from rendezvous

point

rendezvous point

join

join

join

R1

R2

R3

R4 R

5

R6

R7

PIM - sparse m

ode

Page 172: yerarun/cs453/lectures/Chapter4.pdf · 4-18 11001000 00010111 00010000 00000000 h 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 h 11001000 00010111 00011000

Netw

ork Layer 4-172

4.1 introduction 4.2 virtual circuit and

datagram netw

orks 4.3 w

hat�s inside a router 4.4 IP: Internet Protocol

" datagram

format, IPv4

addressing, ICM

P, IPv6

4.5 routing algorithms

" link state, distance vector, hierarchical routing

4.6 routing in the Internet " 

RIP, O

SPF, BGP

4.7 broadcast and multicast

routing

Chapter 4: done!

! understand principles behind netw

ork layer services: " netw

ork layer service models, forw

arding versus routing how

a router works, routing (path selection), broadcast,

multicast

! instantiation, im

plementation in the Internet