informática y comunicaciones chapter 3 transport, … transport...transport vs. network layer...

80
Transport, Network and Link Layers 3-1 Chapter 3 Transport, Network and Link Layers All material copyright 1996-2012 J.F Kurose and K.W. Ross, All Rights Reserved Informática y Comunicaciones

Upload: others

Post on 11-Jul-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Transport, Network and Link Layers 3-1

Chapter 3Transport, Network and

Link Layers

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

Informática y Comunicaciones

Page 2: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Chapter 3: outline

3.1 Transport layer

3.2 Network layer

3.3 Link layer

Transport, Network and Link Layers 3-2

Page 3: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Transport services and protocols

provide logical communicationbetween app processes running on different hosts

transport protocols run in end systems

send side: breaks app messages into segments, passes to network layer

rcv side: reassembles segments into messages, passes to app layer

more than one transport protocol available to apps

Internet: TCP and UDP

application

transport

network

data link

physical

application

transport

network

data link

physical

Transport, Network and Link Layers 3-3

Page 4: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Transport vs. network layer

household analogy: network layer:logical communication between hosts

transport layer:logical communication between processes relies on, enhances,

network layer services

12 kids in Ann’s house sending letters to 12 kids in Bill’s house:

hosts = houses processes = kids app messages = letters

in envelopes transport protocol = Ann

and Bill who demux to in-house siblings

network-layer protocol = postal service

Transport, Network and Link Layers 3-4

Page 5: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Multiplexing/demultiplexing

process

socket

use header info to deliver

received segments to correct

socket

demultiplexing at receiver:handle data from multiple

sockets, add transport header (later used for demultiplexing)

multiplexing at sender:

transport

application

physical

link

network

P2P1

transport

application

physical

link

network

P4

transport

application

physical

link

network

P3

Transport, Network and Link Layers 3-5

Page 6: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

How demultiplexing works

host receives IP datagrams each datagram has source

IP address, destination IP address

each datagram carries one transport-layer segment

each segment has source, destination port number

host uses IP addresses & port numbers to direct segment to appropriate socket

source port # dest port #

32 bits

application

data

(payload)

other header fields

TCP/UDP segment format

Transport, Network and Link Layers 3-6

Page 7: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

UDP: User Datagram Protocol

“no frills,” “bare bones”Internet transport protocol

“best effort” service, UDP segments may be:

lost

delivered out-of-order to app

connectionless:

no handshaking between UDP sender, receiver

each UDP segment handled independently of others

UDP use: streaming multimedia

apps (loss tolerant, rate sensitive)

DNS

SNMP

reliable transfer over UDP: add reliability at

application layer

application-specific error recovery!

Transport, Network and Link Layers 3-7

Page 8: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

UDP: segment header

source port # dest port #

32 bits

application

data

(payload)

UDP segment format

length checksum

length, in bytes of UDP segment,

including header

no connection establishment (which can add delay)

simple: no connection state at sender, receiver

small header size

no congestion control: UDP can blast away as fast as desired

why is there a UDP?

Transport, Network and Link Layers 3-8

Page 9: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

UDP checksum

sender: treat segment

contents, including header fields, as sequence of 16-bit integers

checksum: addition (one’s complement sum) of segment contents

sender puts checksum value into UDP checksum field

receiver: compute checksum of

received segment

check if computed checksum equals checksum field value:

NO - error detected

YES - no error detected. But maybe errors nonetheless?

Goal: detect “errors” (e.g., flipped bits) in transmitted segment

Transport, Network and Link Layers 3-9

Page 10: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

TCP: Overview

full duplex data: bi-directional data flow

in same connection

MSS: maximum segment size

connection-oriented: handshaking (exchange

of control msgs) initssender, receiver state before data exchange

flow controlled: sender will not

overwhelm receiver

point-to-point: one sender, one

receiver

reliable, in-order byte stream: no “message

boundaries”

pipelined: TCP congestion and

flow control set window size

Transport, Network and Link Layers 3-10

Page 11: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

TCP segment structure

source port # dest port #

32 bits

application

data

(variable length)

sequence number

acknowledgement number

receive window

Urg data pointerchecksum

FSRPAUhead

len

not

used

options (variable length)

URG: urgent data

(generally not used)

ACK: ACK #

valid

PSH: push data now

(generally not used)

RST, SYN, FIN:

connection estab

(setup, teardown

commands)

# bytes

rcvr willing

to accept

counting

by bytes

of data

(not segments!)

Internet

checksum

(as in UDP)

Transport, Network and Link Layers 3-11

Page 12: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

TCP reliable data transfer

TCP creates rdt service on top of IP’s unreliable service pipelined segments

cumulative acks

single retransmission timer

retransmissions triggered by: timeout events

duplicate acks

Transport, Network and Link Layers 3-12

Page 13: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

congestion: informally: “too many sources sending too

much data too fast for network to handle”

different from flow control!

manifestations:

lost packets (buffer overflow at routers)

long delays (queueing in router buffers)

a top-10 problem!

Principles of congestion control

Transport, Network and Link Layers 3-13

Page 14: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Causes/costs of congestion: scenario 1

two senders, two receivers

one router, infinite buffers

output link capacity: R

no retransmission

maximum per-connection throughput: R/2

unlimited shared

output link buffers

Host A

original data: lin

Host B

throughput:

lout

R/2

R/2

lo

ut

lin R/2d

ela

ylin

large delays as arrival rate, lin, approaches capacity

Transport, Network and Link Layers 3-14

Page 15: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

one router, finite buffers

sender retransmission of timed-out packet application-layer input = application-layer output: lin = lout

transport-layer input includes retransmissions : lin lin

finite shared

output link

buffers

Host A

lin : original

data

Host B

lout

l'in: original data,

plus retransmitted

data

Causes/costs of congestion: scenario 2

Transport, Network and Link Layers 3-15

Page 16: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

idealization: perfect knowledge

sender sends only when router buffers available

finite shared

output link

buffers

lin : original

data lout

l'in: original data,

plus retransmitted

data

copy

free buffer space!

R/2

R/2

lo

ut

lin

Causes/costs of congestion: scenario 2

Host B

Host A

Transport, Network and Link Layers 3-16

Page 17: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

lin : original

data lout

l'in: original data,

plus retransmitted

data

copy

no buffer space!

Idealization: known loss packets can be lost, dropped at router due to full buffers

sender only resends if packet known to be lost

Causes/costs of congestion: scenario 2

A

Host

B Transport, Network and Link Layers 3-17

Page 18: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

lin : original

data lout

l'in: original data,

plus retransmitted

datafree buffer space!

Causes/costs of congestion: scenario 2

Idealization: known loss packets can be lost, dropped at router due to full buffers

sender only resends if packet known to be lost

R/2

R/2lin

lo

ut

when sending at R/2,

some packets are

retransmissions but

asymptotic goodput

is still R/2

A

Host

B Transport, Network and Link Layers 3-18

Page 19: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

A

linloutl'in

copy

free buffer space!

timeout

R/2

R/2lin

lo

ut

when sending at R/2,

some packets are

retransmissions

including duplicated

that are delivered!

Host

B

Realistic: duplicates packets can be lost, dropped

at router due to full buffers

sender times out prematurely, sending two copies, both of which are delivered

Causes/costs of congestion: scenario 2

Transport, Network and Link Layers 3-19

Page 20: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

R/2

lo

ut

when sending at R/2,

some packets are

retransmissions

including duplicated

that are delivered!

“costs” of congestion: more work (retrans) for given “goodput” unneeded retransmissions: link carries multiple copies

of pkt

decreasing goodput

R/2lin

Causes/costs of congestion: scenario 2

Realistic: duplicates packets can be lost,

dropped at router due to full buffers

sender times out prematurely, sending twocopies, both of which are delivered

Transport, Network and Link Layers 3-20

Page 21: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

four senders

multihop paths

timeout/retransmit

Q: what happens as lin and lin’

increase ?

finite shared output link

buffers

Host A lout

Causes/costs of congestion: scenario 3

Host B

Host C

Host D

lin : original data

l'in: original data, plus

retransmitted data

A: as red lin’ increases, all arriving

blue pkts at upper queue are dropped, blue throughput g 0

Transport, Network and Link Layers 3-21

Page 22: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

another “cost” of congestion:

when packet dropped, any “upstream transmission capacity used for that packet was wasted!

Causes/costs of congestion: scenario 3

C/2

C/2

lo

ut

lin’

Transport, Network and Link Layers 3-22

Page 23: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Approaches towards congestion control

two broad approaches towards congestion control:

end-end congestion control:

no explicit feedback from network

congestion inferred from end-system observed loss, delay

approach taken by TCP

network-assisted congestion control:

routers provide feedback to end systems

single bit indicating congestion (SNA, DECbit, TCP/IP ECN, ATM)

explicit rate for sender to send at

Transport, Network and Link Layers 3-23

Page 24: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

fairness goal: if K TCP sessions share same bottleneck link of bandwidth R, each should have average rate of R/K

TCP connection 1

bottleneck

router

capacity R

TCP Fairness

TCP connection 2

Transport, Network and Link Layers 3-24

Page 25: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Chapter 3: outline

3.1 Transport layer

3.2 Network layer

3.3 Link layer

Transport, Network and Link Layers 3-25

Page 26: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Network layer

transport segment from sending to receiving host

on sending side encapsulates segments into datagrams

on receiving side, delivers segments to transport layer

network layer protocols in every host, router

router examines header fields in all IP datagrams passing through it

application

transport

network

data link

physical

application

transport

network

data link

physical

network

data link

physical network

data link

physical

network

data link

physical

network

data link

physical

network

data link

physical

network

data link

physical

network

data link

physical

network

data link

physical

network

data link

physical

network

data link

physicalnetwork

data link

physical

Transport, Network and Link Layers 3-26

Page 27: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

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

Transport, Network and Link Layers 3-27

Page 28: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

1

23

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 forwarding

routing algorithm determines

end-end-path through network

forwarding table determines

local forwarding at this router

Transport, Network and Link Layers 3-28

Page 29: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

The Internet network layer

forwarding

table

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

network

layer

Transport, Network and Link Layers 3-29

Page 30: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

ver length

32 bits

data

(variable length,

typically a TCP

or UDP segment)

16-bit identifier

header

checksum

time to

live

32 bit source IP address

head.

len

type of

serviceflgs

fragment

offsetupper

layer

32 bit destination IP address

options (if any)

IP datagram formatIP protocol version

numberheader length

(bytes)

upper layer protocol

to deliver payload to

total datagram

length (bytes)

“type” of data for

fragmentation/

reassemblymax number

remaining hops

(decremented at

each router)

e.g. timestamp,

record route

taken, specify

list of routers

to visit.

how much overhead?

20 bytes of TCP

20 bytes of IP

= 40 bytes + app layer overhead

Transport, Network and Link Layers 3-30

Page 31: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

IP addressing: introduction

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

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

multiple interfaces

host typically has one or two interfaces (e.g., wired Ethernet, wireless 802.11)

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

Transport, Network and Link Layers 3-31

Page 32: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

IP addressing: introduction223.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

wired Ethernet interfaces connected

by Ethernet switches

wireless WiFi interfaces connected

by WiFi base station

Transport, Network and Link Layers 3-32

Page 33: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Subnets

IP address:subnet part - high order bits

host part - low order 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.3

223.1.1.4 223.1.2.9

223.1.3.2223.1.3.1

subnet

223.1.1.2

223.1.3.27223.1.2.2

223.1.2.1

Transport, Network and Link Layers 3-33

Page 34: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

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

Subnets223.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.2223.1.3.1

subnet

223.1.1.2

223.1.3.27223.1.2.2

223.1.2.1

Transport, Network and Link Layers 3-34

Page 35: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

how 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

Subnets

Transport, Network and Link Layers 3-35

Page 36: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

IP addressing: CIDR

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

subnet

part

host

part

200.23.16.0/23

Transport, Network and Link Layers 3-36

Page 37: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

IP addresses: how to get one?

Q: How does a host get IP address?

hard-coded by system admin in a file Windows: control-panel->network->configuration-

>tcp/ip->properties

UNIX: /etc/rc.config

DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server

“plug-and-play”

Transport, Network and Link Layers 3-37

Page 38: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

DHCP: Dynamic Host Configuration Protocol

goal: allow host to dynamically obtain its IP address from network server when it joins network

can renew its lease on address in use

allows reuse of addresses (only hold address while connected/“on”)

support for mobile users who want to join network (more shortly)

DHCP overview: host broadcasts “DHCP discover” msg [optional]

DHCP server responds with “DHCP offer” msg [optional]

host requests IP address: “DHCP request” msg

DHCP server sends address: “DHCP ack” msg

Transport, Network and Link Layers 3-38

Page 39: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

DHCP 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.2223.1.3.1

223.1.1.2

223.1.3.27223.1.2.2

223.1.2.1

DHCP

server

arriving DHCP

client needs

address in this

network

Transport, Network and Link Layers 3-39

Page 40: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

DHCP: more than IP addresses

DHCP can return more than just allocated IP address on subnet: address of first-hop router for client

name and IP address of DNS sever

network mask (indicating network versus host portion of address)

Transport, Network and Link Layers 3-40

Page 41: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

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 Transport, Network and Link Layers 3-41

Page 42: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

IP addressing: the last word...

Q: how does an ISP get block of addresses?

A: ICANN: Internet Corporation for Assigned

Names and Numbers http://www.icann.org/

allocates addresses

manages DNS

assigns domain names, resolves disputes

Transport, Network and Link Layers 3-42

Page 43: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

NAT: network 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 network)

10.0.0/24

rest of

Internet

datagrams with source or

destination in this network

have 10.0.0/24 address for

source, destination (as usual)

all datagrams leaving local

network have same single source NAT IP address:

138.76.29.7,different source port numbers

Transport, Network and Link Layers 3-43

Page 44: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

motivation: local network uses just one IP address as far as outside world 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 world

can change ISP without changing addresses of devices in local network

devices inside local net not explicitly addressable, visible by outside world (a security plus)

NAT: network address translation

Transport, Network and Link Layers 3-44

Page 45: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

implementation: NAT router must:

outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #)

. . . remote clients/servers will respond using (NAT IP address, new port #) as destination addr

remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair

incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table

NAT: network address translation

Transport, Network and Link Layers 3-45

Page 46: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

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

WAN side addr LAN side addr

138.76.29.7, 5001 10.0.0.1, 3345

…… ……

S: 128.119.40.186, 80

D: 10.0.0.1, 33454

S: 138.76.29.7, 5001

D: 128.119.40.186, 802

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, 50013

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

NAT: network address translation

Transport, Network and Link Layers 3-46

Page 47: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

16-bit port-number field:

60,000 simultaneous connections with a single LAN-side address!

NAT is controversial:

routers should only process up to layer 3

violates end-to-end argument

• NAT possibility must be taken into account by

app designers, e.g., P2P applications

address shortage should instead be solved by IPv6

NAT: network address translation

Transport, Network and Link Layers 3-47

Page 48: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

IPv6: motivation

initial motivation: 32-bit address space soon to be completely allocated.

additional motivation: header format helps speed processing/forwarding

header changes to facilitate QoS

IPv6 datagram format: fixed-length 40 byte header

no fragmentation allowed

Transport, Network and Link Layers 3-48

Page 49: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

IPv6 datagram format

priority: identify priority among datagrams in flow

flow Label: identify datagrams 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 limitflow labelpriver

32 bitsTransport, Network and Link Layers 3-49

Page 50: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Transition from IPv4 to IPv6

not all routers can be upgraded simultaneously no “flag days” how will network operate with mixed 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

IPv6 datagram

IPv4 payload

UDP/TCP payload

IPv6 source dest addr

IPv6 header fields

Transport, Network and Link Layers 3-50

Page 51: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Chapter 3: outline

3.1 Transport layer

3.2 Network layer

3.3 Link layer

Transport, Network and Link Layers 3-51

Page 52: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Link layer: introduction

terminology: hosts and routers: nodes

communication channels that connect adjacent nodes along communication path: links

wired links

wireless links

LANs

layer-2 packet: frame,encapsulates datagram

data-link layer has responsibility of

transferring datagram from one node

to physically adjacent node over a link

global ISP

Transport, Network and Link Layers 3-52

Page 53: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Link layer: context

datagram transferred by different link protocols over different links:

e.g., Ethernet on first link, frame relay on intermediate links, 802.11 on last link

each link protocol provides different services

e.g., may or may not provide rdt over link

transportation analogy: trip from Princeton to Lausanne

limo: Princeton to JFK

plane: JFK to Geneva

train: Geneva to Lausanne

tourist = datagram

transport segment = communication link

transportation mode = link layer protocol

travel agent = routing algorithm

Transport, Network and Link Layers 3-53

Page 54: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Link layer services

framing, link access: encapsulate datagram into frame, adding header,

trailer channel access if shared medium “MAC” addresses used in frame headers to identify

source, dest

• different from IP address! reliable delivery between adjacent nodes

we learned how to do this already! seldom used on low bit-error link (fiber, some twisted

pair) wireless links: high error rates

Transport, Network and Link Layers 3-54

Page 55: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

flow control: pacing between adjacent sending and receiving nodes

error detection: errors caused by signal attenuation, noise.

receiver detects presence of errors:

• signals sender for retransmission or drops frame

error correction: receiver identifies and corrects bit error(s) without resorting

to retransmission

half-duplex and full-duplex with half duplex, nodes at both ends of link can transmit, but

not at same time

Link layer services (more)

Transport, Network and Link Layers 3-55

Page 56: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Where is the link layer implemented?

in each and every host

link layer implemented in “adaptor” (aka network interface card NIC) or on a chip

Ethernet card, 802.11 card; Ethernet chipset

implements link, physical layer

attaches into host’s system buses

combination of hardware, software, firmware

controller

physical

transmission

cpu memory

host

bus

(e.g., PCI)

network adapter

card

application

transport

network

link

link

physical

Transport, Network and Link Layers 3-56

Page 57: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Adaptors communicating

sending side:

encapsulates datagram in frame

adds error checking bits, rdt, flow control, etc.

receiving side

looks for errors, rdt, flow control, etc

extracts datagram, passes to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

Transport, Network and Link Layers 3-57

Page 58: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Error detectionEDC= Error Detection and Correction bits (redundancy)

D = Data protected by error checking, may include header fields

• Error detection not 100% reliable!

• protocol may miss some errors, but rarely

• larger EDC field yields better detection and correction

otherwise

Transport, Network and Link Layers 3-58

Page 59: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Multiple access links, protocols

two types of “links”:

point-to-point PPP for dial-up access

point-to-point link between Ethernet switch, host

broadcast (shared wire or medium) old-fashioned Ethernet

upstream HFC

802.11 wireless LAN

shared wire (e.g.,

cabled Ethernet)

shared RF

(e.g., 802.11 WiFi)

shared RF

(satellite)

humans at a

cocktail party

(shared air, acoustical)

Transport, Network and Link Layers 3-59

Page 60: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Multiple access protocols

single shared broadcast channel

two or more simultaneous transmissions by nodes: interference

collision if node receives two or more signals at the same time

multiple access protocol distributed algorithm that determines how nodes share

channel, i.e., determine when node can transmit

communication about channel sharing must use channel itself! no out-of-band channel for coordination

Transport, Network and Link Layers 3-60

Page 61: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

An ideal multiple access protocol

given: broadcast channel of rate R bps

desiderata:1. when one node wants to transmit, it can send at rate

R.

2. when M nodes want to transmit, each can send at average rate R/M

3. fully decentralized:

• no special node to coordinate transmissions

• no synchronization of clocks, slots4. simple

Transport, Network and Link Layers 3-61

Page 62: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

MAC protocols: taxonomy

three broad classes:

channel partitioning divide channel into smaller “pieces” (time slots, frequency,

code)

allocate piece to node for exclusive use

random access channel not divided, allow collisions

“recover” from collisions

“taking turns” nodes take turns, but nodes with more to send can take

longer turns

Transport, Network and Link Layers 3-62

Page 63: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Channel partitioning MAC protocols: TDMA

TDMA: time division multiple access access to channel in "rounds" each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example: 6-station LAN, 1,3,4 have pkt, slots

2,5,6 idle

1 3 4 1 3 4

6-slot

frame

6-slot

frame

Transport, Network and Link Layers 3-63

Page 64: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

FDMA: frequency division multiple access channel spectrum divided into frequency bands

each station assigned fixed frequency band

unused transmission time in frequency bands go idle

example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle

fre

qu

en

cy b

an

ds

FDM cable

Channel partitioning MAC protocols: FDMA

Transport, Network and Link Layers 3-64

Page 65: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Random access protocols

when node has packet to send transmit at full channel data rate R. no a priori coordination among nodes

two or more transmitting nodes ➜ “collision”, random access MAC protocol specifies:

how to detect collisions how to recover from collisions (e.g., via delayed

retransmissions)

examples of random access MAC protocols: slotted ALOHA ALOHA CSMA, CSMA/CD, CSMA/CA

Transport, Network and Link Layers 3-65

Page 66: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

“Taking turns” MAC protocols

channel partitioning MAC protocols: share channel efficiently and fairly at high load

inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node!

random access MAC protocols efficient at low load: single node can fully utilize

channel

high load: collision overhead

“taking turns” protocolslook for best of both worlds!

Transport, Network and Link Layers 3-66

Page 67: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

polling: master node “invites” slave nodes to transmit in turn

typically used with “dumb” slave devices

concerns:

polling overhead

latency

single point of failure (master)

master

slaves

poll

data

data

“Taking turns” MAC protocols

Transport, Network and Link Layers 3-67

Page 68: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

token passing: control token passed

from one node to next sequentially.

token message

concerns:

token overhead

latency

single point of failure (token)

T

data

(nothing

to send)

T

“Taking turns” MAC protocols

Transport, Network and Link Layers 3-68

Page 69: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

MAC addresses and ARP

32-bit IP address: network-layer address for interface

used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address: function: used ‘locally” to get frame from one interface

to another physically-connected interface (same network, in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM, also sometimes software settable

e.g.: 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation

(each “number” represents 4 bits)

Transport, Network and Link Layers 3-69

Page 70: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

LAN addresses and ARP

each adapter on LAN has unique LAN address

adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

(wired or

wireless)

Transport, Network and Link Layers 3-70

Page 71: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Ethernet

“dominant” wired LAN technology:

cheap $20 for NIC

first widely used LAN technology

simpler, cheaper than token LANs and ATM

kept up with speed race: 10 Mbps – 10 Gbps

Metcalfe’s Ethernet

sketch Transport, Network and Link Layers 3-71

Page 72: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Ethernet: physical topology

bus: popular through mid 90s all nodes in same collision domain (can collide with

each other)

star: prevails today active switch in center

each “spoke” runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus: coaxial cablestar

Transport, Network and Link Layers 3-72

Page 73: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Ethernet frame structure

sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

preamble:

7 bytes with pattern 10101010 followed by one byte with pattern 10101011

used to synchronize receiver, sender clock rates

dest.address

sourceaddress

data (payload) CRCpreamble

type

Transport, Network and Link Layers 3-73

Page 74: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Ethernet frame structure (more)

addresses: 6 byte source, destination MAC addresses if adapter receives frame with matching destination

address, or with broadcast address (e.g. ARP packet), it passes data in frame to network layer protocol

otherwise, adapter discards frame

type: indicates higher layer protocol (mostly IP but others possible, e.g., Novell IPX, AppleTalk)

CRC: cyclic redundancy check at receiver error detected: frame is dropped

dest.address

sourceaddress

data (payload) CRCpreamble

type

Transport, Network and Link Layers 3-74

Page 75: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Ethernet switch link-layer device: takes an active role

store, forward Ethernet frames

examine incoming frame’s MAC address, selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment, uses CSMA/CD to access segment

transparent

hosts are unaware of presence of switches

plug-and-play, self-learning

switches do not need to be configured

Transport, Network and Link Layers 3-75

Page 76: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Switch: multiple simultaneous transmissions

hosts have dedicated, direct connection to switch

switches buffer packets

Ethernet protocol used on each incoming link, but no collisions; full duplex

each link is its own collision domain

switching: A-to-A’ and B-to-B’ can transmit simultaneously, without collisions

switch with six interfaces

(1,2,3,4,5,6)

A

A’

B

B’ C

C’

1 2

345

6

Transport, Network and Link Layers 3-76

Page 77: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Interconnecting switches

switches can be connected together

A

B

S1

C D

E

FS2

S4

S3

H

I

G

Transport, Network and Link Layers 3-77

Page 78: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Institutional network

to external

networkrouter

IP subnet

mail server

web server

Transport, Network and Link Layers 3-78

Page 79: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Switches vs. routers

both are store-and-forward:

routers: network-layer devices (examine network-layer headers)

switches: link-layer devices (examine link-layer headers)

both have forwarding tables:

routers: compute tables using routing algorithms, IP addresses

switches: learn forwarding table using flooding, learning, MAC addresses

application

transport

network

link

physical

network

link

physical

link

physical

switch

datagram

application

transport

network

link

physical

frame

frame

frame

datagram

Transport, Network and Link Layers 3-79

Page 80: Informática y Comunicaciones Chapter 3 Transport, … Transport...Transport vs. network layer network layer: household analogy: logical communication between hosts transport layer:

Chapter 3: summary

transport layer

UDP

TCP

Congestion

network layer

Routing

IP

DHCP

NAT

link layer

Error detection

MAC

Ethernet

our study of layers now complete!

Transport, Network and Link Layers 3-80