25
Chapter 4, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 9 Announcements: Chapter 4 Credit for lecture slides to Professor Bechir Hamdaoui Adapted from Jim Kurose & Keith Ross (original copyright)

ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

  • Upload
    ngophuc

  • View
    224

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 1

ECE/CS 372 – introduction to computer networksLecture 9

Announcements:

Chapter 4

Credit for lecture slides to Professor Bechir Hamdaoui

Adapted from Jim Kurose & Keith Ross (original copyright)

Page 2: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 2

Chapter 3: Recap

Transport layer services: required vs. available• Reliability/Bandwidth/Timing/Security

Connectionless vs. connection-oriented• TCP vs. UDP

Reliable data transfer• ACK/Retransmit/RTT and Timeout

Flow control• Sender should not overwhelm receiver’s buffer

Congestion control• TCP Tahoe/Reno: Fast retransmit, slow start, congestion avoidance

What we covered in chapter 3:

Page 3: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 3

Chapter 4: Network Layer

Chapter goals: understand principles behind network layer

services: network layer service models

forwarding versus routing

subnetting and IP addressing

routing algorithms (path selection)

Page 4: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 4

Network layer

network layer protocols run at end systems &

routers

Sender side: get segments from

transport layer

encapsulates segments into IP datagrams

router examines header fields in all IP datagrams

Receiver side: delivers segments to

transport layer

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: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

local forwarding table

header value

0100

0101

0111

1001

3

2

2

1

output link

Chapter 4, slide: 5

routing algorithm

Interplay between routing and forwarding

routing process: find route taken by packets from source to dest.

forwarding table: a lookup table for figuring out output port for each input pkt

routing algorithm:constructs routing tables

forwarding process:move pkts from input to output

1

23

0111

value in arriving

packet’s header

Destination

Source

Page 6: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 6

Two Key Network-Layer Functions

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

routing: determine 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 7: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 7

Network service model

Q: What network services are needed/offered to deliver datagrams from sender to receiver?

Example services for individual datagrams:

Reliability Guaranteed delivery

End-to-end delay guaranteed delivery

within 40 msec delay

Example services for a flow of datagrams:

In-order in-order datagram delivery

Throughput guaranteed minimum

bandwidth to flow

Jitter delay restrictions on changes in

inter-packet spacing

Page 8: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 8

Network layer: connection and connection-less services

Network-layer versus transport-layer services

datagram network provides network-layer connectionless service

Transport layer Network layer

Service Process to process Host to host

Choice Reliable (TCP) and unreliable (UDP)

Unreliable only (Best effort)

Implementation Edge (Hosts) Core (routers)

Page 9: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 9

Datagram networks

no call setup at network layer

no state about end-to-end connections is kept in routers no network-level concept of “connection”

packets forwarded using dest. host address packets (same source-dest pair) may take different paths

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

1. Send data 2. Receive data

Page 10: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 10

Forwarding table

Destination Address Range Link Interface

11001000 00010111 00010000 00000000

through 0

11001000 00010111 00010111 11111111

11001000 00010111 00011000 00000000

through 1

11001000 00010111 00011000 11111111

11001000 00010111 00011001 00000000

through 2

11001000 00010111 00011111 11111111

otherwise 3

4 billion possible entries

Page 11: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 11

Longest prefix matching

Prefix Match Link Interface

11001000 00010111 00010 0

11001000 00010111 00011000 1

11001000 00010111 00011 2

otherwise 3

DA: 11001000 00010111 00011000 10101010

Examples

DA: 11001000 00010111 00010110 10100001 Which interface?

Which interface?

Page 12: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 12

Chapter 4: Network Layer

Introduction

IP: Internet Protocol IPv4 addressing

NAT, IPv6

Routing algorithms Link state

Distance Vector

Routing in the Internet RIP, OSPF, BGP

Page 13: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 13

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 14: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 14

IP Fragmentation & Reassembly network links have MTU

(max.transfer size) - largest possible link-level frame.

different link types, different MTUs

large IP datagram divided (“fragmented”) within net

one datagram becomes several datagrams

“reassembled” only at final destination

IP header bits used to identify, order related fragments

fragmentation: in: one large datagramout: 3 smaller datagrams

reassembly

Page 15: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 15

IP Fragmentation & Reassembly (ctd)

ID=x

offset=0

fragflag=0

length=4000

One large datagram becomesseveral smaller datagrams

Example

4000 byte datagram

= 20 (header) + 3980 (data)

MTU = 1500 bytes

Page 16: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 16

IP Fragmentation & Reassembly (ctd)

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

Example

4000 byte datagram

= 20 (header) + 3980 (data)

MTU = 1500 bytes

1480 bytes in data field

offset =1480/8

1040= 20 (header) + 1020 (data)1020 (data) =3980 – 1480 -1480

Page 17: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 17

IP Addressing: introduction

IP address: 32-bit identifier for host,

router interface

interface: connection between host/router and physical link multiple interfaces per

router

one interface per host

one IP address per 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 18: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 18

Subnets IP address:

subnet part (higher bits)

host part (lower bits)

What’s a subnet ? device interfaces with same

subnet part of IP address

can physically reach each other without intervening router

network consisting of 3 subnets

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

subnet11001000 00010111 00010000 00000000

subnetpart

hostpart

200.23.16.0/23

Page 19: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 19

Subnets 223.1.1.0/24223.1.2.0/24

223.1.3.0/24

Recipe

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 20: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 20

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.1

223.1.8.0223.1.8.1

223.1.9.1

223.1.9.2

Page 21: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 21

IP addressing: CIDRClassful addressing: A, B, C

A: /8 B: /16 C: /24

Problem: see which class is needed for 300 hosts? Issue?

CIDR: Classless InterDomain Routing subnet portion of address of arbitrary length 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

(only 28 subnets, but 224 hosts per subnet)(216 subnets, and 216 hosts per subnet)(224 subnets, but only 28 hosts per subnet)

Page 22: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 22

IP addresses: how to get one?

Q: How does host get IP address?

hard-coded by system admin in a file

DHCP: Dynamic Host Configuration Protocol: dynamically get IP address from a server when joining the

network

IP address can be reused by other hosts if released

Can renew IP addresses if stayed connected

Page 23: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 23

DHCP client-server scenario

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

B

E

DHCP server

arriving DHCP

client needs

address in this

network

Page 24: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 24

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 25: ECE/CS 372 introduction to computer networksclasses.engr.oregonstate.edu/eecs/spring2014/cs372-001/Lectures/... · ECE/CS 372 –introduction to computer networks ... Credit for lecture

Chapter 4, slide: 25

Example

Subnet 1Subnet 2

Subnet 3

Three subnets

All interfaces in all these subnets are required to have prefix: 223.1.13.0/24

Subnet 1 is required to support 125 interfaces

Subnet 2 & 3 are each required to support 60interfaces

Question:

Provide 3 network addresses in the form: a.b.c.d/x for subnets 1, 2, and 3

Answer: see board (board notes will be posted)