chapter 4 network layer - university of waterloocs456/w08/... · network layer 4-3 chapter 4:...

34
Network Layer 4-1 Chapter 4 Network Layer A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: q If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!) q If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Thanks and enjoy! JFK/KWR All material copyright 1996-2007 J.F Kurose and K.W. Ross, All Rights Reserved Computer Networking: A Top Down Approach 4 th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007.

Upload: others

Post on 09-Jul-2020

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-1

Chapter 4Network Layer

A note on the use of these ppt slides:We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following:q If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!)q If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material.

Thanks and enjoy! JFK/KWR

All material copyright 1996-2007J.F Kurose and K.W. Ross, All Rights Reserved

Computer Networking: A Top Down Approach 4th edition. Jim Kurose, Keith RossAddison-Wesley, July 2007.

Page 2: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-2

Chapter 4: Network Layer

Chapter goals:r understand principles behind network layer

services:m network layer service modelsm forwarding versus routingm how a router worksm routing (path selection)m dealing with scalem advanced topics: IPv6, mobility

r instantiation, implementation in the Internet

Page 3: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-3

Chapter 4: Network Layer

r 4. 1 Introductionr 4.2 Virtual circuit and

datagram networksr 4.3 What’s inside a

routerr 4.4 IP: Internet

Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6

r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing

r 4.6 Routing in the Internetm RIPm OSPFm BGP

r 4.7 Broadcast and multicast routing

Page 4: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-4

Network layerr transport segment from

sending to receiving host r on sending side

encapsulates segments into datagrams

r on rcving side, delivers segments to transport layer

r network layer protocols in every host, router

r router examines header fields in all IP datagrams passing through it

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

networkdata linkphysical network

data linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysicalnetwork

data linkphysical

Page 5: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-5

Two Key Network-Layer Functions

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

r routing: determine route taken by packets from source to dest.

m routing algorithms

analogy:

r routing: process of planning trip from source to dest

r forwarding: process of getting through single interchange

Page 6: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-6

1

23

0111

value in arrivingpacket’s header

routing algorithm

local forwarding tableheader value output link

0100010101111001

3221

Interplay between routing and forwarding

Page 7: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-7

Connection setup

r 3rd important function in some network architectures:mATM, frame relay, X.25

r before datagrams flow, two end hosts andintervening routers establish virtual connectionmrouters get involved

Page 8: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-8

Network service modelQ: What service model for “channel” transporting datagrams from sender to receiver?

Example services for individual datagrams:

r guaranteed deliveryr guaranteed delivery

with less than 40 msec delay

Example services for a flow of datagrams:

r in-order datagram delivery

r guaranteed minimum bandwidth to flow

r restrictions on changes in inter-packet spacing

Page 9: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-9

Chapter 4: Network Layer

r 4. 1 Introductionr 4.2 Virtual circuit and

datagram networksr 4.3 What’s inside a

routerr 4.4 IP: Internet

Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6

r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing

r 4.6 Routing in the Internetm RIPm OSPFm BGP

r 4.7 Broadcast and multicast routing

Page 10: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-10

Network layer connection and connection-less servicer datagram network provides network-layer

connectionless servicer VC network provides network-layer

connection servicerSpecifically:m service: host-to-hostm no choice: network provides one or the otherm implementation: in network core

Page 11: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-11

Virtual circuits

r call setup, teardown for each call before data can flowr each packet carries VC identifier (not destination host

address)r every router on source-dest path maintains “state” for

each passing connectionr link, router resources (bandwidth, buffers) may be

allocated to VC (dedicated resources = predictable service)

“source-to-dest path behaves much like telephone circuit”m performance-wisem network actions along source-to-dest path

Page 12: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-12

VC implementation

a VC consists of:1. path from source to destination2. VC numbers, one number for each link along

path3. entries in forwarding tables in routers along

pathr packet belonging to VC carries VC number

(rather than dest address)r VC number can be changed on each link.m New VC number comes from forwarding table

Page 13: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-13

Forwarding table12 22 32

1 23

VC number

interfacenumber

Incoming interface Incoming VC # Outgoing interface Outgoing VC #

1 12 3 222 63 1 18 3 7 2 171 97 3 87… … … …

Forwarding table innorthwest router:

Routers maintain connection state information!

Page 14: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-14

Virtual circuits: signaling protocols

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

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

1. Initiate call 2. incoming call3. Accept call4. Call connected

5. Data flow begins 6. Receive data

Page 15: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-15

Datagram networksr no call setup at network layerr routers: no state about end-to-end connections

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

m packets between same source-dest pair may take different paths

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

1. Send data 2. Receive data

Page 16: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-16

Forwarding table

Destination Address Range Link Interface

11001000 00010111 00010000 00000000through 0

11001000 00010111 00010111 11111111

11001000 00010111 00011000 00000000through 1

11001000 00010111 00011000 11111111

11001000 00010111 00011001 00000000through 2

11001000 00010111 00011111 11111111

otherwise 3

4 billion possible entries

Page 17: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-17

Longest prefix matching

Prefix Match Link Interface11001000 00010111 00010 0 11001000 00010111 00011000 111001000 00010111 00011 2

otherwise 3

DA: 11001000 00010111 00011000 10101010

Examples

DA: 11001000 00010111 00010110 10100001 Which interface?

Which interface?

Page 18: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-18

Datagram or VC network: why?

Internet (datagram)r data exchange among

computersm “elastic” service, no strict

timing req. r “smart” end systems

(computers)m can adapt, perform

control, error recoverym simple inside network,

complexity at “edge”r many link types

m different characteristicsm uniform service difficult

ATM (VC)r evolved from telephonyr human conversation:

m strict timing, reliability requirements

m need for guaranteed service

r “dumb” end systemsm telephonesm complexity inside

network

Page 19: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-19

Chapter 4: Network Layer

r 4. 1 Introductionr 4.2 Virtual circuit and

datagram networksr 4.3 What’s inside a

routerr 4.4 IP: Internet

Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6

r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing

r 4.6 Routing in the Internetm RIPm OSPFm BGP

r 4.7 Broadcast and multicast routing

Page 20: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-20

The Internet Network layer

forwardingtable

Host, router network layer functions:

Routing protocols•path selection•RIP, OSPF, BGP

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

ICMP protocol•error reporting•router “signaling”

Transport layer: TCP, UDP

Link layer

physical layer

Networklayer

Page 21: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-21

IP datagram format

ver length

32 bits

data (variable length,typically a TCP

or UDP segment)

16-bit identifierheader

checksumtime to

live

32 bit source IP address

IP protocol versionnumber

header length(bytes)

max numberremaining hops

(decremented at each router)

forfragmentation/reassembly

total datagramlength (bytes)

upper layer protocolto deliver payload to

head.len

type ofservice

“type” of data flgs fragmentoffset

upperlayer

32 bit destination IP address

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

how much overhead with TCP?

r 20 bytes of TCPr 20 bytes of IPr = 40 bytes + app

layer overhead

Page 22: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-22

IP Fragmentation & Reassemblyr network links have MTU

(max.transfer size) - largest possible link-level frame.m different link types,

different MTUs r large IP datagram divided

(“fragmented”) within netm one datagram becomes

several datagramsm “reassembled” only at final

destinationm IP header bits used to

identify, order related fragments

fragmentation: in: one large datagramout: 3 smaller datagrams

reassembly

Page 23: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-23

IP Fragmentation and Reassembly

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 becomesseveral smaller datagrams

Exampler 4000 byte

datagramr MTU = 1500 bytes

1480 bytes in data field

offset =1480/8

Page 24: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-24

Chapter 4: Network Layer

r 4. 1 Introductionr 4.2 Virtual circuit and

datagram networksr 4.3 What’s inside a

routerr 4.4 IP: Internet

Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6

r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing

r 4.6 Routing in the Internetm RIPm OSPFm BGP

r 4.7 Broadcast and multicast routing

Page 25: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-25

IP Addressing: introductionr IP address: 32-bit

identifier for host, router interface

r interface: connection between host/router and physical linkm router’s typically have

multiple interfacesm host typically has one

interfacem IP addresses

associated with each interface

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 11

Page 26: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-26

Subnetsr IP address:

m subnet part (high order bits)

m host part (low order bits)

r What’s a subnet ?m device interfaces with

same subnet part of IP address

m can physically reach each other without intervening router

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

network consisting of 3 subnets

subnet

Page 27: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-27

Subnets 223.1.1.0/24223.1.2.0/24

223.1.3.0/24

Reciper To determine the

subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet.

Subnet mask: /24

Page 28: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-28

SubnetsHow many? 223.1.1.1

223.1.1.3

223.1.1.4

223.1.2.2223.1.2.1

223.1.2.6

223.1.3.2223.1.3.1

223.1.3.27

223.1.1.2

223.1.7.0

223.1.7.1223.1.8.0223.1.8.1

223.1.9.1

223.1.9.2

Page 29: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-29

IP addressing: CIDRCIDR: Classless InterDomain Routingm subnet portion of address of arbitrary lengthm address format: a.b.c.d/x, where x is # bits in

subnet portion of address

11001000 00010111 00010000 00000000

subnetpart

hostpart

200.23.16.0/23

Page 30: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-30

IP addresses: how to get one?

Q: How does host get IP address?

r hard-coded by system admin in a filemWintel: control-panel->network->configuration-

>tcp/ip->propertiesm UNIX: /etc/rc.config

r DHCP: Dynamic Host Configuration Protocol: dynamically get address from as serverm “plug-and-play”

Page 31: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-31

IP addresses: how to get one?Q: How does network get subnet part of IP

addr?A: gets allocated portion of its provider ISP’s

address space

ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20

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

... ….. …. ….Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23

Page 32: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-32

Hierarchical addressing: route aggregation

“Send me anythingwith addresses beginning 200.23.16.0/20”

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

Fly-By-Night-ISP

Organization 0

Organization 7Internet

Organization 1

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

200.23.20.0/23Organization 2

...

...

Hierarchical addressing allows efficient advertisement of routing information:

Page 33: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-33

Hierarchical addressing: more specific routes

ISPs-R-Us has a more specific route to Organization 1

“Send me anythingwith addresses beginning 200.23.16.0/20”

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

Fly-By-Night-ISP

Organization 0

Organization 7Internet

Organization 1

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

200.23.20.0/23Organization 2

...

...

Page 34: Chapter 4 Network Layer - University of Waterloocs456/W08/... · Network Layer 4-3 Chapter 4: Network Layer r4. 1 Introduction r4.2 Virtual circuit and datagram networks r4.3 What’s

Network Layer 4-34

IP addressing: the last word...

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

Names and Numbersm allocates addressesm manages DNSm assigns domain names, resolves disputes