The Network Layer · Outline Basic network-layer architecture of a datagram network Introduction to...

Preview:

Citation preview

The Network Layer

Antonio Carzaniga

Faculty of InformaticsUniversity of Lugano

April 21, 2009

© 2005–2007 Antonio Carzaniga

Outline

Basic network-layer architecture of a datagram network

Introduction to forwarding

Introduction to routing

General architecture of a router

Switching fabric and queuing

Internet network-layer protocol

The Internet protocol (IP)

Fragmentation

© 2005–2007 Antonio Carzaniga

Application Level

web

browser

web

server

© 2005–2007 Antonio Carzaniga

Application Level

web

browser

web

server

© 2005–2007 Antonio Carzaniga

Application Level

web

browser

web

server

GET /carzaniga/ HTTP/1.1

Host: www.inf.unisi.ch

. . .

© 2005–2007 Antonio Carzaniga

Application Level

web

browser

web

server

HTTP/1.1 200 OK

. . .

<html><head>. . . </head><body>

. . .

© 2005–2007 Antonio Carzaniga

Application Level

web

browser

web

server

GET /carzaniga/anto.png HTTP/1.1

Host: www.inf.unisi.ch

. . .

© 2005–2007 Antonio Carzaniga

Application Level

web

browser

web

server

HTTP/1.1 200 OK

. . .

. . .

© 2005–2007 Antonio Carzaniga

Transport Level

web

browser

web

server

© 2005–2007 Antonio Carzaniga

Transport Level

web

browser

web

server

© 2005–2007 Antonio Carzaniga

Transport Level

web

browser

web

server

© 2005–2007 Antonio Carzaniga

Network Layer

web

browser

web

server

© 2005–2007 Antonio Carzaniga

Network Layer

web

browser

web

server

© 2005–2007 Antonio Carzaniga

Network Layer

web

browser

web

server

© 2005–2007 Antonio Carzaniga

Router

© 2005–2007 Antonio Carzaniga

Router

Fundamental component of the network layer

© 2005–2007 Antonio Carzaniga

Router

Fundamental component of the network layer

A node in a graph

© 2005–2007 Antonio Carzaniga

Router

12

3

4 5

Fundamental component of the network layer

A node in a graph

A finite set of input/output (physical) connections◮ a.k.a., interfaces or ports

© 2005–2007 Antonio Carzaniga

Focus: “Datagram” Networks

© 2005–2007 Antonio Carzaniga

Focus: “Datagram” Networks

Packet-switched network

© 2005–2007 Antonio Carzaniga

Focus: “Datagram” Networks

Packet-switched network

◮ information is transmitted in discrete units called datagrams

© 2005–2007 Antonio Carzaniga

Focus: “Datagram” Networks

Packet-switched network

◮ information is transmitted in discrete units called datagrams

Connectionless service

© 2005–2007 Antonio Carzaniga

Focus: “Datagram” Networks

Packet-switched network

◮ information is transmitted in discrete units called datagrams

Connectionless service

◮ a datagram is a self-contained message

◮ treated independently by the network

◮ no connection setup/tear-down phase

© 2005–2007 Antonio Carzaniga

Focus: “Datagram” Networks

Packet-switched network

◮ information is transmitted in discrete units called datagrams

Connectionless service

◮ a datagram is a self-contained message

◮ treated independently by the network

◮ no connection setup/tear-down phase

“Best-effort” service

© 2005–2007 Antonio Carzaniga

Focus: “Datagram” Networks

Packet-switched network

◮ information is transmitted in discrete units called datagrams

Connectionless service

◮ a datagram is a self-contained message

◮ treated independently by the network

◮ no connection setup/tear-down phase

“Best-effort” service

◮ delivery guarantee: none

© 2005–2007 Antonio Carzaniga

Focus: “Datagram” Networks

Packet-switched network

◮ information is transmitted in discrete units called datagrams

Connectionless service

◮ a datagram is a self-contained message

◮ treated independently by the network

◮ no connection setup/tear-down phase

“Best-effort” service

◮ delivery guarantee: none

◮ maximum latency guarantee: none

© 2005–2007 Antonio Carzaniga

Focus: “Datagram” Networks

Packet-switched network

◮ information is transmitted in discrete units called datagrams

Connectionless service

◮ a datagram is a self-contained message

◮ treated independently by the network

◮ no connection setup/tear-down phase

“Best-effort” service

◮ delivery guarantee: none

◮ maximum latency guarantee: none

◮ bandwidth guarantee: none

© 2005–2007 Antonio Carzaniga

Focus: “Datagram” Networks

Packet-switched network

◮ information is transmitted in discrete units called datagrams

Connectionless service

◮ a datagram is a self-contained message

◮ treated independently by the network

◮ no connection setup/tear-down phase

“Best-effort” service

◮ delivery guarantee: none

◮ maximum latency guarantee: none

◮ bandwidth guarantee: none

◮ in-order delivery guarantee: none

© 2005–2007 Antonio Carzaniga

Focus: “Datagram” Networks

Packet-switched network

◮ information is transmitted in discrete units called datagrams

Connectionless service

◮ a datagram is a self-contained message

◮ treated independently by the network

◮ no connection setup/tear-down phase

“Best-effort” service

◮ delivery guarantee: none

◮ maximum latency guarantee: none

◮ bandwidth guarantee: none

◮ in-order delivery guarantee: none

◮ congestion indication: none

© 2005–2007 Antonio Carzaniga

Datagram Network

© 2005–2007 Antonio Carzaniga

Datagram Network

© 2005–2007 Antonio Carzaniga

Datagram Network

© 2005–2007 Antonio Carzaniga

Datagram Network

© 2005–2007 Antonio Carzaniga

Datagram Network

© 2005–2007 Antonio Carzaniga

Datagram Network

© 2005–2007 Antonio Carzaniga

Datagram Network

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

Potentially asymmetric paths

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

Potentially asymmetric paths

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

Potentially asymmetric paths

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

Potentially asymmetric paths

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

Potentially asymmetric paths

© 2005–2007 Antonio Carzaniga

Datagram Network

Potentially multiple paths for the same source/destination

Potentially asymmetric paths

© 2005–2007 Antonio Carzaniga

Forwarding

© 2005–2007 Antonio Carzaniga

Forwarding

A Bk

c

d

e

f

gh

i

j

A sends a datagram to B

© 2005–2007 Antonio Carzaniga

Forwarding

A Bk

c

d

e

f

gh

i

j

to: B. . .

A sends a datagram to B

The datagram is forwarded towards B

© 2005–2007 Antonio Carzaniga

Forwarding

A Bk

c

d

e

f

gh

i

j

to: B. . .

A sends a datagram to B

The datagram is forwarded towards B

© 2005–2007 Antonio Carzaniga

Forwarding

A Bk

c

d

e

f

gh

i

j

to: B. . .

© 2005–2007 Antonio Carzaniga

Forwarding

A Bk

c

d

e

f

gh

i

j

to: B. . .

© 2005–2007 Antonio Carzaniga

Forwarding

A Bk

c

d

e

f

gh

i

j

to: B. . .

12

43

forwarding

table

dest. output

. . . . . .

B port 4

. . . . . .

© 2005–2007 Antonio Carzaniga

Forwarding

A Bk

c

d

e

f

gh

i

j

12

to: B. . .

43

forwarding

table

dest. output

. . . . . .

B port 4

. . . . . .

© 2005–2007 Antonio Carzaniga

Forwarding

A Bk

c

d

e

f

gh

i

j

12

43

to: B. . .

forwarding

table

dest. output

. . . . . .

B port 4

. . . . . .

© 2005–2007 Antonio Carzaniga

Forwarding

A Bk

c

d

e

f

gh

i

j

12

43

to: B. . .

forwarding

table

dest. output

. . . . . .

B port 4

. . . . . .

© 2005–2007 Antonio Carzaniga

Forwarding

Input: datagram destination

© 2005–2007 Antonio Carzaniga

Forwarding

Input: datagram destination

Output: output port

© 2005–2007 Antonio Carzaniga

Forwarding

Input: datagram destination

Output: output port

Simple design: “forwarding table”

© 2005–2007 Antonio Carzaniga

Forwarding

Input: datagram destination

Output: output port

Simple design: “forwarding table”

Issues

© 2005–2007 Antonio Carzaniga

Forwarding

Input: datagram destination

Output: output port

Simple design: “forwarding table”

Issues

◮ how big is the forwarding table?

© 2005–2007 Antonio Carzaniga

Forwarding

Input: datagram destination

Output: output port

Simple design: “forwarding table”

Issues

◮ how big is the forwarding table?

◮ how fast does the router have to forward datagrams?

© 2005–2007 Antonio Carzaniga

Forwarding

Input: datagram destination

Output: output port

Simple design: “forwarding table”

Issues

◮ how big is the forwarding table?

◮ how fast does the router have to forward datagrams?

◮ how does the router build and maintain the forwarding table?

© 2005–2007 Antonio Carzaniga

Routing

© 2005–2007 Antonio Carzaniga

Routing

A Bk

c

d

e

f

gh

i

j

1 2

1

24

23

2

1

1

3

42

4

12

3

3

3

1

23

2

1

14

2

5

44

3

5

1

3

1 1

© 2005–2007 Antonio Carzaniga

Routing

A Bk

c

d

e

f

gh

i

j

1 2

1

24

23

2

1

1

3

42

4

12

3

3

3

1

23

2

1

14

2

5

44

3

5

1

3

1 1

router k

A 2

B 1

. . .

© 2005–2007 Antonio Carzaniga

Router Functions

© 2005–2007 Antonio Carzaniga

Router Functions

routing

communications

with neighbors:

routing protocol

routing

table

© 2005–2007 Antonio Carzaniga

Router Functions

routing

communications

with neighbors:

routing protocol

routing

table

forwarding

table

© 2005–2007 Antonio Carzaniga

Router Functions

routing

communications

with neighbors:

routing protocol

routing

table

forwarding

table

forwardinginput packets

from input ports

output packets

to output ports

© 2005–2007 Antonio Carzaniga

Anatomy of a Router

© 2005–2007 Antonio Carzaniga

Anatomy of a Router

routing

processor

input port

input port

input port

...

output port

output port

output port

...

switch

fabric

© 2005–2007 Antonio Carzaniga

Anatomy of a Router

routing

processor

input port

input port

input port

...

output port

output port

output port

...

switch

fabric

data link

processing

lookup

forwarding

queuing

© 2005–2007 Antonio Carzaniga

Anatomy of a Router

routing

processor

input port

input port

input port

...

output port

output port

output port

...

switch

fabric

© 2005–2007 Antonio Carzaniga

Anatomy of a Router

routing

processor

input port

input port

input port

...

output port

output port

output port

...

switch

fabric

queuing data link

processing

© 2005–2007 Antonio Carzaniga

Queuing

Where does queuing occur?

© 2005–2007 Antonio Carzaniga

Queuing

Where does queuing occur?

Input ports

◮ queuing may occur here if the switching fabric is slower than

the aggregate speed of all the input lines. I.e., TS < nTin

© 2005–2007 Antonio Carzaniga

Queuing

Where does queuing occur?

Input ports

◮ queuing may occur here if the switching fabric is slower than

the aggregate speed of all the input lines. I.e., TS < nTin

Output ports

◮ queuing may occur here because of the limited throughput of

the output link. I.e., Tout < min(TS ,nTin)

© 2005–2007 Antonio Carzaniga

Queuing

What happens when packets queue up in a router?

© 2005–2007 Antonio Carzaniga

Queuing

What happens when packets queue up in a router?

Scheduling: deciding which packets to process

© 2005–2007 Antonio Carzaniga

Queuing

What happens when packets queue up in a router?

Scheduling: deciding which packets to process

◮ first-come-first-served

© 2005–2007 Antonio Carzaniga

Queuing

What happens when packets queue up in a router?

Scheduling: deciding which packets to process

◮ first-come-first-served

◮ weighted fair queuing: the router tries to be balance traffic

evenly among the different end-to-end connections. Essential

to implement quality-of-service guarantees

© 2005–2007 Antonio Carzaniga

Queuing

What happens when packets queue up in a router?

Scheduling: deciding which packets to process

◮ first-come-first-served

◮ weighted fair queuing: the router tries to be balance traffic

evenly among the different end-to-end connections. Essential

to implement quality-of-service guarantees

Deciding when to drop packets, and which packets to drop

© 2005–2007 Antonio Carzaniga

Queuing

What happens when packets queue up in a router?

Scheduling: deciding which packets to process

◮ first-come-first-served

◮ weighted fair queuing: the router tries to be balance traffic

evenly among the different end-to-end connections. Essential

to implement quality-of-service guarantees

Deciding when to drop packets, and which packets to drop

◮ drop tail: drop arriving packets when queues are full

© 2005–2007 Antonio Carzaniga

Queuing

What happens when packets queue up in a router?

Scheduling: deciding which packets to process

◮ first-come-first-served

◮ weighted fair queuing: the router tries to be balance traffic

evenly among the different end-to-end connections. Essential

to implement quality-of-service guarantees

Deciding when to drop packets, and which packets to drop

◮ drop tail: drop arriving packets when queues are full

◮ active queue management: a set of policies and algorithms to

decide when and how to drop or mark packets in the attempt

to prevent congestion

© 2005–2007 Antonio Carzaniga

Internet Network Layer

© 2005–2007 Antonio Carzaniga

Internet Network Layer

Routing: defining paths and compiling forwarding tables

© 2005–2007 Antonio Carzaniga

Internet Network Layer

Routing: defining paths and compiling forwarding tables

◮ RIP

◮ OSPF

◮ BGP

© 2005–2007 Antonio Carzaniga

Internet Network Layer

Routing: defining paths and compiling forwarding tables

◮ RIP

◮ OSPF

◮ BGP

IP

© 2005–2007 Antonio Carzaniga

Internet Network Layer

Routing: defining paths and compiling forwarding tables

◮ RIP

◮ OSPF

◮ BGP

IP

◮ addressing

◮ datagram format

◮ fragmentation and packet handling

© 2005–2007 Antonio Carzaniga

Internet Network Layer

Routing: defining paths and compiling forwarding tables

◮ RIP

◮ OSPF

◮ BGP

IP

◮ addressing

◮ datagram format

◮ fragmentation and packet handling

ICMP

© 2005–2007 Antonio Carzaniga

Internet Network Layer

Routing: defining paths and compiling forwarding tables

◮ RIP

◮ OSPF

◮ BGP

IP

◮ addressing

◮ datagram format

◮ fragmentation and packet handling

ICMP

◮ error reporting

◮ signaling

© 2005–2007 Antonio Carzaniga

IPv4 Datagram Format

0 31

© 2005–2007 Antonio Carzaniga

IPv4 Datagram Format

0 31

vers.

© 2005–2007 Antonio Carzaniga

IPv4 Datagram Format

0 31

vers. hlen

© 2005–2007 Antonio Carzaniga

IPv4 Datagram Format

0 31

vers. hlen type of service

© 2005–2007 Antonio Carzaniga

IPv4 Datagram Format

0 31

vers. hlen type of service datagram length

© 2005–2007 Antonio Carzaniga

IPv4 Datagram Format

0 31

vers. hlen type of service datagram length

identifier flags fragmentation offset

© 2005–2007 Antonio Carzaniga

IPv4 Datagram Format

0 31

vers. hlen type of service datagram length

identifier flags fragmentation offset

time-to-live

© 2005–2007 Antonio Carzaniga

IPv4 Datagram Format

0 31

vers. hlen type of service datagram length

identifier flags fragmentation offset

time-to-live protocol

© 2005–2007 Antonio Carzaniga

IPv4 Datagram Format

0 31

vers. hlen type of service datagram length

identifier flags fragmentation offset

time-to-live protocol header checksum

© 2005–2007 Antonio Carzaniga

IPv4 Datagram Format

0 31

vers. hlen type of service datagram length

identifier flags fragmentation offset

time-to-live protocol header checksum

source address

destination address

© 2005–2007 Antonio Carzaniga

IPv4 Datagram Format

0 31

vers. hlen type of service datagram length

identifier flags fragmentation offset

time-to-live protocol header checksum

source address

destination address

options (if any)

© 2005–2007 Antonio Carzaniga

IPv4 Datagram Format

0 31

vers. hlen type of service datagram length

identifier flags fragmentation offset

time-to-live protocol header checksum

source address

destination address

options (if any)

data

© 2005–2007 Antonio Carzaniga

Fragmentation

© 2005–2007 Antonio Carzaniga

Fragmentation

routing

processor

input port

input port

input port

...

output port

output port

output port

...

switch

fabric

© 2005–2007 Antonio Carzaniga

Fragmentation

routing

processor

input port

input port

input port

...

output port

output port

output port

...

switch

fabric

© 2005–2007 Antonio Carzaniga

Fragmentation

routing

processor

input port

input port

input port

...

output port

output port

output port

...

switch

fabric

© 2005–2007 Antonio Carzaniga

Fragmentation

routing

processor

input port

input port

input port

...

output port

output port

output port

...

switch

fabric

© 2005–2007 Antonio Carzaniga

Fragmentation

routing

processor

input port

input port

input port

...

output port

output port

output port

...

switch

fabric

MTU = 1500b

size = 1000b

© 2005–2007 Antonio Carzaniga

Fragmentation

routing

processor

input port

input port

input port

...

output port

output port

output port

...

switch

fabric

MTU = 1500b

size = 1000b

MTU = 512b

© 2005–2007 Antonio Carzaniga

Fragmentation

routing

processor

input port

input port

input port

...

output port

output port

output port

...

switch

fabric

MTU = 1500b

size = 1000b

MTU = 512b

How does the router handle cases where the size of an input

datagram exceeds the maximum transmission unit (MTU) of

the output link?

© 2005–2007 Antonio Carzaniga

Fragmentation

routing

processor

input port

input port

input port

...

output port

output port

output port

...

switch

fabric

MTU = 1500b

size = 1000b

MTU = 512b

How does the router handle cases where the size of an input

datagram exceeds the maximum transmission unit (MTU) of

the output link?

The datagram is fragmented

© 2005–2007 Antonio Carzaniga

Fragmentation

input datagram

header

© 2005–2007 Antonio Carzaniga

Fragmentation

input datagram

header

MTU

© 2005–2007 Antonio Carzaniga

Fragmentation

input datagram

header

MTU

fragment 1

header

+

fragment 2

header

© 2005–2007 Antonio Carzaniga

Fragmentation

input datagram

header

MTU

fragment 1

header

+

fragment 2

header

The destination reassembles fragmented datagrams

© 2005–2007 Antonio Carzaniga

Fragmentation

input datagram

header

MTU

fragment 1

header

+

fragment 2

header

The destination reassembles fragmented datagrams

◮ not intermediate routers

◮ this is mainly to push complexity out of the network

© 2005–2007 Antonio Carzaniga

Fragmentation

input datagram

header

MTU

fragment 1

header

+

fragment 2

header

The destination reassembles fragmented datagrams

◮ not intermediate routers

◮ this is mainly to push complexity out of the network

◮ a datagram may have to be fragmented further along the path

© 2005–2007 Antonio Carzaniga

Fragmentation

input datagram

header

MTU

fragment 1

header

+

fragment 2

header

The destination reassembles fragmented datagrams

◮ not intermediate routers

◮ this is mainly to push complexity out of the network

◮ a datagram may have to be fragmented further along the path

The fragmentation scheme must ensure that the destinationhost

◮ can recognize two fragments of the same original datagram

◮ can figure out if and when all the fragments have been received

© 2005–2007 Antonio Carzaniga

Fragmentation

input datagram

header

MTU

fragment 1

header

+

fragment 2

header

The destination reassembles fragmented datagrams

◮ not intermediate routers

◮ this is mainly to push complexity out of the network

◮ a datagram may have to be fragmented further along the path

The fragmentation scheme must ensure that the destinationhost

◮ can recognize two fragments of the same original datagram

◮ can figure out if and when all the fragments have been received

The fragmentation scheme must ensure that the intermediate

routers can fragment a datagram to whatever level necessary

© 2005–2007 Antonio Carzaniga

Fragmentation

© 2005–2007 Antonio Carzaniga

Fragmentation

Initial (non-fragmented) datagram format (datasize = 1000)

© 2005–2007 Antonio Carzaniga

Fragmentation

Initial (non-fragmented) datagram format (datasize = 1000)

◮ sender host assigns a 16-bit identifier to the datagram (e.g.,

789)

© 2005–2007 Antonio Carzaniga

Fragmentation

Initial (non-fragmented) datagram format (datasize = 1000)

◮ sender host assigns a 16-bit identifier to the datagram (e.g.,

789)

◮ the fragment offset is set to 0, indicating that this packet

contains data starting at position 0 of the original datagram

◮ fragment offset is actually the offset in units of 8 bytes

(remember it’s only 13 bits. . . )

© 2005–2007 Antonio Carzaniga

Fragmentation

Initial (non-fragmented) datagram format (datasize = 1000)

◮ sender host assigns a 16-bit identifier to the datagram (e.g.,

789)

◮ the fragment offset is set to 0, indicating that this packet

contains data starting at position 0 of the original datagram

◮ fragment offset is actually the offset in units of 8 bytes

(remember it’s only 13 bits. . . )

◮ the “more fragments” flag is set to 0, indicating that no (more)

fragments have been sent

© 2005–2007 Antonio Carzaniga

Fragmentation

Initial (non-fragmented) datagram format (datasize = 1000)

◮ sender host assigns a 16-bit identifier to the datagram (e.g.,

789)

◮ the fragment offset is set to 0, indicating that this packet

contains data starting at position 0 of the original datagram

◮ fragment offset is actually the offset in units of 8 bytes

(remember it’s only 13 bits. . . )

◮ the “more fragments” flag is set to 0, indicating that no (more)

fragments have been sent

identifier fragment more header total

offset fragments length length

789 0 0 20 1020

© 2005–2007 Antonio Carzaniga

Fragmentation

© 2005–2007 Antonio Carzaniga

Fragmentation

Fragmentation to an MTU of 512

© 2005–2007 Antonio Carzaniga

Fragmentation

Fragmentation to an MTU of 512

◮ sender must split the datagram into 3 fragments:

© 2005–2007 Antonio Carzaniga

Fragmentation

Fragmentation to an MTU of 512

◮ sender must split the datagram into 3 fragments:

identifier fragment more header total

offset fragments length length

789 0 1 20 508

© 2005–2007 Antonio Carzaniga

Fragmentation

Fragmentation to an MTU of 512

◮ sender must split the datagram into 3 fragments:

identifier fragment more header total

offset fragments length length

789 0 1 20 508

identifier fragment more header total

offset fragments length length

789 61 1 20 508

© 2005–2007 Antonio Carzaniga

Fragmentation

Fragmentation to an MTU of 512

◮ sender must split the datagram into 3 fragments:

identifier fragment more header total

offset fragments length length

789 0 1 20 508

identifier fragment more header total

offset fragments length length

789 61 1 20 508

identifier fragment more header total

offset fragments length length

789 122 0 20 44

© 2005–2007 Antonio Carzaniga

Recommended