informática y comunicaciones chapter 3 transport, network ... transpo… · 1. when one node wants...

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

Upload: others

Post on 03-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Chapter 3Transport, Network and

Informática y Comunicaciones

Transport, Network and Link Layers 3-1

Transport, Network and Link Layers

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

Page 2: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Transport services and protocols

� provide logical communicationbetween app processes running on different hosts

� transport protocols run in end systems

� send side: breaks app

application

transport

network

data link

physical

� 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

Transport, Network and Link Layers 3-3

Page 4: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Transport vs. network layer

household analogy:� network layer: logical communication between hosts

� transport layer:logical communication

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

� hosts = housesprocesses = kids

logical communication between processes� relies on, enhances, network layer services

� 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, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Multiplexing/demultiplexing

use header info to deliverreceived segments to correct socket

demultiplexing at receiver:handle data from multiplesockets, add transport header (later used for demultiplexing)

multiplexing at sender:

application

process

socket

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, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

How demultiplexing works

� host receives IP datagrams� each datagram has source IP address, destination IP address

� each datagram carries one transport-layer segment

source port # dest port #

32 bits

other header fields

transport-layer segment

� each segment has source, destination port number

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

application

data

(payload)

TCP/UDP segment format

Transport, Network and Link Layers 3-6

Page 7: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

UDP: User Datagram Protocol

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

� “best effort” service, UDP segments may be:

� lost

� delivered out-of-order

� UDP use:� streaming multimedia apps (loss tolerant, rate sensitive)

� DNS

� SNMP� delivered out-of-order to app

� connectionless:

� no handshaking between UDP sender, receiver

� each UDP segment handled independently of others

� 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, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

UDP: segment header

source port # dest port #

32 bits

application

length checksum

length, in bytes of UDP segment,

including header

� no connection establishment (which can

why is there a UDP?

application

data

(payload)

UDP segment format

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

Transport, Network and Link Layers 3-8

Page 9: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

UDP checksum

sender:� treat segment contents,

including header fields,

receiver:� compute checksum of

received segment

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

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

received segment

� check if computed checksum equals checksum field value:

� NO - error detected

� YES - no error detected. But maybe errors nonetheless?

Transport, Network and Link Layers 3-9

Page 10: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

TCP: Overview

� full duplex data:� bi-directional data flow in same connection

� MSS: maximum segment size

connection-oriented:

� point-to-point:� one sender, one receiver

� reliable, in-order byte stream:

� connection-oriented:� handshaking (exchange of control msgs) initssender, receiver state before data exchange

� flow controlled:� sender will not overwhelm receiver

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, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

TCP segment structure

source port # dest port #

32 bits

sequence number

acknowledgement numberreceive window

Urg data pointerchecksum

FSRPAUheadlen

notused

URG: urgent data (generally not used)

ACK: ACK #valid

PSH: push data now(generally not used)

# bytes rcvr willing

countingby bytes of data(not segments!)

applicationdata (variable length)

Urg data pointerchecksum

options (variable length)

(generally not used)

RST, SYN, FIN:connection estab(setup, teardown

commands)

rcvr willingto accept

Internetchecksum

(as in UDP)

Transport, Network and Link Layers 3-11

Page 12: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

congestion:� informally: “too many sources sending too much data too fast for network to handle”

� different from flow control!

manifestations:

Principles of congestion control

� manifestations:

� lost packets (buffer overflow at routers)

� long delays (queueing in router buffers)

� a top-10 problem!

Transport, Network and Link Layers 3-13

Page 14: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Causes/costs of congestion: scenario 1

� two senders, two receivers

� one router, infinite buffers

� output link capacity: R

� no retransmission

unlimited shared output link buffers

Host A

original data: λin throughput:λout

� maximum per-connection throughput: R/2

Host B

R/2

R/2

λ out

λin R/2

dela

y

λin

� large delays as arrival rate, λin, approaches capacity

Transport, Network and Link Layers 3-14

Page 15: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

� one router, finite buffers

� sender retransmission of timed-out packet� application-layer input = application-layer output: λin =

λout

� transport-layer input includes retransmissions : λin λin‘

Causes/costs of congestion: scenario 2

finite shared output link

buffers

Host A

λin : original data

Host B

λout

λ'in: original data, plus retransmitted

data

Transport, Network and Link Layers 3-15

Page 16: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

idealization: perfect knowledge

� sender sends only when router buffers available

R/2

R/2

λ out

λin

Causes/costs of congestion: scenario 2

finite shared output link

buffers

λin : original data λout

λ'in: original data, plus retransmitted

data

copy

free buffer space!

Host B

A

Transport, Network and Link Layers 3-16

Page 17: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Idealization: known losspackets 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

λin : original data λout

λ'in: original data, plus retransmitted

data

copy

no buffer space!A

Host B Transport, Network and Link Layers 3-17

Page 18: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Causes/costs of congestion: scenario 2

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

� sender only resends if packet known to be lost

R/2

R/2λin

λ out

when sending at R/2, some packets are retransmissions but asymptotic goodput is still R/2

λin : original data λout

λ'in: original data, plus retransmitted

datafree buffer space!A

Host B Transport, Network and Link Layers 3-18

Page 19: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

R/2

R/2λin

λ out

when sending at R/2, some packets are retransmissions including duplicated that are delivered!

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

A

λin λoutλ'incopy

free buffer space!

timeout

Host B Transport, Network and Link Layers 3-19

Page 20: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

R/2

λ out

when sending at R/2, some packets are retransmissions including duplicated that are delivered!

R/2λin

Causes/costs of congestion: scenario 2

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

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

� decreasing goodput

Transport, Network and Link Layers 3-20

Page 21: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

� four senders

� multihop paths

� timeout/retransmit

Q: what happens as λin and λin’

increase ?

Host A λout

Causes/costs of congestion: scenario 3

Host B

λin : original data

λ' : original data, plus

A: as red λin’ increases, all arriving

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

finite shared output link

buffers

Host CHost D

λ'in: original data, plusretransmitted data

Transport, Network and Link Layers 3-21

Page 22: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Causes/costs of congestion: scenario 3

C/2λ o

ut

λ

another “cost” of congestion:� when packet dropped, any “upstream transmission capacity used for that packet was wasted!

C/2λin’

Transport, Network and Link Layers 3-22

Page 23: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Approaches towards congestion control

two broad approaches towards congestion control:

end-end congestion control:

� no explicit feedback

network-assisted congestion control:

� routers provide � no explicit feedback from network

� congestion inferred from end-system observed loss, delay

� approach taken by TCP

� 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, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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

TCP connection 1

TCP Fairness

bottleneckroutercapacity RTCP connection 2

Transport, Network and Link Layers 3-24

Page 25: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Network layer

� transport segment from sending to receiving host

� on sending side encapsulates segments into datagrams

� on receiving side, delivers

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

networknetwork� 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

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, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Two key network-layer functions

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

routing: determine route

analogy:

� routing: process of planning trip from source to dest

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

� routing algorithms

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, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

routing algorithm

local forwarding tableheader value output link

0100010101111001

3221

Interplay between routing and forwarding

routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router

1

23

0111

value in arrivingpacket’s header

1001 1

Transport, Network and Link Layers 3-28

Page 29: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Connection setup

� 3rd important function in some network architectures:� ATM, frame relay, X.25

� before datagrams flow, two end hosts andintervening routers establish virtual connectionintervening routers establish virtual connection� routers get involved

� network vs transport layer connection service:� network: between two hosts (may also involve intervening routers in case of VCs)

� transport: between two processes

Transport, Network and Link Layers 3-29

Page 30: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Network service model

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

example services for individual datagrams:guaranteed delivery

example services for a flow of datagrams:in-order datagram � guaranteed delivery

� guaranteed delivery with less than 40 msec delay

� in-order datagram delivery

� guaranteed minimum bandwidth to flow

� restrictions on changes in inter-packet spacing

Transport, Network and Link Layers 3-30

Page 31: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Network layer service models:

NetworkArchitecture

Internet

ATM

ServiceModel

best effort

CBR

Bandwidth

none

constant

Loss

no

yes

Order

no

yes

Timing

no

yes

Congestionfeedback

no (inferredvia loss)no

Guarantees ?

ATM

ATM

ATM

ATM

CBR

VBR

ABR

UBR

constantrateguaranteedrateguaranteed minimumnone

yes

yes

no

no

yes

yes

yes

yes

yes

yes

no

no

nocongestionnocongestionyes

no

Transport, Network and Link Layers 3-31

Page 32: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Connection, connection-less service

� datagram network provides network-layer connectionless service

� virtual-circuit network provides network-layer connection service

� analogous to TCP/UDP connecton-oriented / � analogous to TCP/UDP connecton-oriented / connectionless transport-layer services, but:

� service: host-to-host

� no choice: network provides one or the other

� implementation: in network core

Transport, Network and Link Layers 3-32

Page 33: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Virtual circuits

“source-to-dest path behaves much like telephone circuit”� performance-wise

� network actions along source-to-dest path

� call setup, teardown for each call before data can flow

� each packet carries VC identifier (not destination host address)

� every router on source-dest path maintains “state” for each passing connection

� link, router resources (bandwidth, buffers) may be allocated to VC (dedicated resources = predictable service)

Transport, Network and Link Layers 3-33

Page 34: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

VC implementation

a VC consists of:1. path from source to destination

2. VC numbers, one number for each link along path

3. entries in forwarding tables in routers along path

� packet belonging to VC carries VC number � packet belonging to VC carries VC number (rather than dest address)

� VC number can be changed on each link.� new VC number comes from forwarding table

Transport, Network and Link Layers 3-34

Page 35: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

VC forwarding table

12 22 32

1 23

VC numberinterfacenumber

Incoming interface Incoming VC # Outgoing interface Outgoing VC #

forwarding table in

northwest router:

Incoming interface Incoming VC # Outgoing interface Outgoing VC #

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

VC routers maintain connection state information!

Transport, Network and Link Layers 3-35

Page 36: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Datagram networks

� no call setup at network layer

� routers: no state about end-to-end connections� no network-level concept of “connection”

� packets forwarded using destination host address

1. send datagrams

applicationtransportnetworkdata linkphysical

applicationtransportnetworkdata linkphysical

2. receive datagrams

Transport, Network and Link Layers 3-36

Page 37: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Datagram forwarding table

routing algorithm

local forwarding tabledest address output link

address-range 1address-range 2address-range 3address-range 4

3221

4 billion IP addresses, so rather than list individual destination address

list range of addresses

(aggregate table entries)

1

23

IP destination address in arriving packet’s header

address-range 4 1

Transport, Network and Link Layers 3-37

Page 38: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Datagram or VC network: why?

Internet (datagram)� data exchange among

computers� “elastic” service, no strict

timing req.

� many link types

ATM (VC)� evolved from telephony� human conversation:

� strict timing, reliability requirements

� need for guaranteed service

� “dumb” end systemsmany link types � different characteristics

� uniform service difficult

� “smart” end systems (computers)� can adapt, perform control,

error recovery

� simple inside network, complexity at “ edge”

� “dumb” end systems� telephones� complexity inside network

Transport, Network and Link Layers 3-38

Page 39: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Router architecture overviewtwo key router functions:� run routing algorithms/protocol (RIP, OSPF, BGP)

� forwarding datagrams from incoming to outgoing link

routing processor

routing, managementcontrol plane (software)

forwarding tables computed,pushed to input ports

high-seed switching

fabric

router input ports router output ports

forwarding data plane (hardware)

Transport, Network and Link Layers 3-39

Page 40: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

linetermination

link layer

protocol(receive)

lookup,forwarding

queueing

Input port functions

physical layer:

switchfabric

decentralized switching:

� given datagram dest., lookup output port using forwarding table in input port memory (“match plus action”)

� goal: complete input port processing at ‘line speed’

� queuing: if datagrams arrive faster than forwarding rate into switch fabric

bit-level receptiondata link layer:e.g., Ethernet

Transport, Network and Link Layers 3-40

Page 41: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Switching fabrics

� transfer packet from input buffer to appropriate output buffer

� switching rate: rate at which packets can be transfer from inputs to outputs� often measured as multiple of input/output line rate

� N inputs: switching rate N times line rate desirable

� three types of switching fabrics

memory

memory

bus crossbar

Transport, Network and Link Layers 3-41

Page 42: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Switching via memory

first generation routers:� traditional computers with switching under direct control of CPU

� packet copied to system’s memory

� speed limited by memory bandwidth (2 bus crossings per datagram)

inputport(e.g.,

Ethernet)

memoryoutputport(e.g.,

Ethernet)

system bus

Transport, Network and Link Layers 3-42

Page 43: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Switching via a bus

� datagram from input port memory

to output port memory via a shared bus

� bus contention: switching speed limited by bus bandwidthlimited by bus bandwidth

� 32 Gbps bus, Cisco 5600: sufficient speed for access and enterprise routers

bus

Transport, Network and Link Layers 3-43

Page 44: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Switching via interconnection network

� overcome bus bandwidth limitations

� banyan networks, crossbar, other interconnection nets initially developed to connect processors in multiprocessor

� advanced design: fragmenting � advanced design: fragmenting datagram into fixed length cells, switch cells through the fabric.

� Cisco 12000: switches 60 Gbps through the interconnection network

crossbar

Transport, Network and Link Layers 3-44

Page 45: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Output ports

linetermination

link layer

protocol(send)

switchfabric

datagrambuffer

queueing

� buffering required when datagrams arrive from fabric faster than the transmission rate

� scheduling discipline chooses among queued datagrams for transmission

queueing

Transport, Network and Link Layers 3-45

Page 46: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Output port queueing

switchfabric

switchfabric

� buffering when arrival rate via switch exceeds output line speed

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

at t, packets morefrom input to output

one packet time later

Transport, Network and Link Layers 3-46

Page 47: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

The Internet network layerhost, router network layer functions:

routing protocols• path selection• RIP, OSPF, BGP

IP protocol• addressing conventions• datagram format

transport layer: TCP, UDP

network

forwardingtable

• RIP, OSPF, BGP • datagram format• packet handling conventions

ICMP protocol• error reporting• router “signaling”

link layer

physical layer

networklayer

Transport, Network and Link Layers 3-47

Page 48: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

ver length

32 bits

16-bit identifierheader

checksum

time tolive

32 bit source IP address

head.len

type ofservice

flgs fragmentoffsetupper

layer

IP datagram formatIP protocol version

numberheader length

(bytes)

total datagramlength (bytes)

“type” of data forfragmentation/reassemblymax number

remaining hops(decremented at

data (variable length,typically a TCP

or UDP segment)

32 bit source IP address

32 bit destination IP address

options (if any)upper layer protocolto deliver payload to

(decremented at each router)

e.g. timestamp,record routetaken, specifylist 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-48

Page 49: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

IP addressing: introduction

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

� interface: connection between host/router and physical link

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.27physical 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.3223.1.2.2

223.1.3.2223.1.3.1

223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 11

Transport, Network and Link Layers 3-49

Page 50: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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

223.1.2.2

223.1.3.2223.1.3.1

wired Ethernet interfaces connected by Ethernet switches

wireless WiFi interfaces connected by WiFi base station

Transport, Network and Link Layers 3-50

Page 51: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Subnets

� IP address:�subnet part - high order bits

�host part - low order bits

�what’s a subnet ?

223.1.1.1

223.1.1.3

223.1.1.4 223.1.2.9223.1.1.2

223.1.3.27223.1.2.2

223.1.2.1

�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.3.2223.1.3.1

subnet

Transport, Network and Link Layers 3-51

Page 52: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

recipe

� to determine the subnets, detach each interface from its host or router, creating

Subnets223.1.1.0/24

223.1.2.0/24223.1.1.1

223.1.1.3

223.1.1.4 223.1.2.9223.1.1.2

223.1.3.27223.1.2.2

223.1.2.1

or router, creating islands of isolated networks

� each isolated network is called a subnet

subnet mask: /24

223.1.3.0/24

223.1.3.2223.1.3.1

subnet

Transport, Network and Link Layers 3-52

Page 53: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

how many? 223.1.1.1

223.1.1.3

223.1.1.4

223.1.1.2

223.1.7.0223.1.9.2

Subnets

223.1.2.2223.1.2.1

223.1.2.6

223.1.3.2223.1.3.1

223.1.3.27

223.1.7.1223.1.8.0223.1.8.1

223.1.9.1

Transport, Network and Link Layers 3-53

Page 54: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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

subnetpart

hostpart

200.23.16.0/23

Transport, Network and Link Layers 3-54

Page 55: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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>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-55

Page 56: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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 � 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-56

Page 57: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

DHCP client-server scenario

223.1.1.0/24

223.1.1.1

223.1.1.4 223.1.2.9223.1.1.2

223.1.2.1

DHCPserver

arriving DHCPclient needs

223.1.2.0/24

223.1.3.0/24

223.1.1.3

223.1.1.4 223.1.2.9

223.1.3.2223.1.3.1

223.1.3.27223.1.2.2

client needs address in thisnetwork

Transport, Network and Link Layers 3-57

Page 58: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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 � network mask (indicating network versus host portion of address)

Transport, Network and Link Layers 3-58

Page 59: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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-59

Page 60: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Hierarchical addressing: route aggregation

“Send me anything

200.23.16.0/23

Organization 0

Organization 1

hierarchical addressing allows efficient advertisement of routing

information:

“Send me anythingwith addresses beginning 200.23.16.0/20”

200.23.18.0/23

200.23.30.0/23

Fly-By-Night-ISP

Organization 7Internet

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

200.23.20.0/23Organization 2

...

...

Transport, Network and Link Layers 3-60

Page 61: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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

“Send me anything

200.23.16.0/23

Organization 0

Hierarchical addressing: more specific routes

“Send me anythingwith addresses beginning 200.23.16.0/20”

200.23.18.0/23

200.23.30.0/23

Fly-By-Night-ISP

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

...

...

Transport, Network and Link Layers 3-61

Page 62: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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� manages DNS

� assigns domain names, resolves disputes

Transport, Network and Link Layers 3-62

Page 63: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

NAT: network address translation

10.0.0.1

10.0.0.210.0.0.4

138.76.29.7

local network(e.g., home network)

10.0.0/24

rest ofInternet

10.0.0.3

138.76.29.7

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-63

Page 64: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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

NAT: network address translation

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

Transport, Network and Link Layers 3-64

Page 65: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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

NAT: network address translation

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

Transport, Network and Link Layers 3-65

Page 66: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

10.0.0.1

S: 10.0.0.1, 3345D: 128.119.40.186, 80

1: host 10.0.0.1 sends datagram to 128.119.40.186, 80

NAT translation tableWAN side addr LAN side addr138.76.29.7, 5001 10.0.0.1, 3345…… ……

2: NAT routerchanges datagramsource addr from10.0.0.1, 3345 to138.76.29.7, 5001,updates table

NAT: network address translation

10.0.0.1

10.0.0.2

10.0.0.3

110.0.0.4

138.76.29.7 S: 128.119.40.186, 80 D: 10.0.0.1, 3345

4

S: 138.76.29.7, 5001D: 128.119.40.186, 802

updates table

S: 128.119.40.186, 80 D: 138.76.29.7, 5001 3

3: reply arrivesdest. address:138.76.29.7, 5001

4: NAT routerchanges datagramdest addr from138.76.29.7, 5001 to 10.0.0.1, 3345

Transport, Network and Link Layers 3-66

Page 67: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

� 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

NAT: network address translation

� 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

Transport, Network and Link Layers 3-67

Page 68: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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-68

Page 69: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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 dataflow labelpriver

data

destination address(128 bits)

source address(128 bits)

payload len next hdr hop limitflow labelpriver

32 bitsTransport, Network and Link Layers 3-69

Page 70: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Other changes from IPv4

� checksum: removed entirely to reduce processing time at each hop

� options: allowed, but outside of header, indicated by “Next Header” field

� ICMPv6: new version of ICMP� ICMPv6: new version of ICMP� additional message types, e.g. “Packet Too Big”� multicast group management functions

Transport, Network and Link Layers 3-70

Page 71: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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 routerstunneling: IPv6 datagram carried as payload in IPv4 datagram among IPv4 routers

IPv4 source, dest addr IPv4 header fields

IPv4 datagramIPv6 datagram

IPv4 payload

UDP/TCP payload

IPv6 source dest addrIPv6 header fields

Transport, Network and Link Layers 3-71

Page 72: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Chapter 3: outline

3.1 Transport layer

3.2 Network layer

3.3 Link layer

Transport, Network and Link Layers 3-72

Page 73: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Link layer: introduction

terminology:� hosts and routers: nodes

� communication channels that connect adjacent nodes along communication path: links

� wired links

global ISP

� 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 linkTransport, Network and Link Layers 3-73

Page 74: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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

transportation analogy:� trip from Princeton to Lausanne

� limo: Princeton to JFK

� plane: JFK to Geneva

� train: Geneva to Lausanne

� tourist = datagramintermediate links, 802.11 on last link

� each link protocol provides different services

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

� tourist = datagram

� transport segment = communication link

� transportation mode = link layer protocol

� travel agent = routing algorithm

Transport, Network and Link Layers 3-74

Page 75: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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!• 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-75

Page 76: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

� 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

Link layer services (more)

• 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

Transport, Network and Link Layers 3-76

Page 77: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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

cpu memory

applicationtransportnetwork

card; Ethernet chipset

� implements link, physical layer

� attaches into host’s system buses

� combination of hardware, software, firmware

controller

physicaltransmission

host bus (e.g., PCI)

network adaptercard

link

linkphysical

Transport, Network and Link Layers 3-77

Page 78: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Adaptors communicating

controller controller

sending host receiving host

datagram datagram

� 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

datagram

frame

Transport, Network and Link Layers 3-78

Page 79: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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-79

Page 80: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Parity checking

single bit parity:� detect single bit

errors

two-dimensional bit parity:� detect and correct single bit errors

0 0

Transport, Network and Link Layers 3-80

Page 81: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Internet checksum (review)

sender:� treat segment contents

as sequence of 16-bit

receiver:� compute checksum of

received segment

goal: detect “errors” (e.g., flipped bits) in transmitted packet (note: used at transport layer only)

as sequence of 16-bit integers

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

� sender puts checksum value into UDP checksum field

received segment� check if computed

checksum equals checksum field value:� NO - error detected� YES - no error detected. But maybe errors nonetheless?

Transport, Network and Link Layers 3-81

Page 82: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Multiple access links, protocolstwo 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� upstream HFC

� 802.11 wireless LAN

shared wire (e.g., cabled Ethernet)

shared RF(e.g., 802.11 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air, acoustical)

Transport, Network and Link Layers 3-82

Page 83: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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-83

Page 84: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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/Mrate R/M

3. fully decentralized:

• no special node to coordinate transmissions

• no synchronization of clocks, slots4. simple

Transport, Network and Link Layers 3-84

Page 85: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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� 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-85

Page 86: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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 � example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle

1 3 4 1 3 4

6-slotframe

6-slotframe

Transport, Network and Link Layers 3-86

Page 87: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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

Channel partitioning MAC protocols: FDMA

idle

freq

uenc

y ba

nds

FDM cable

Transport, Network and Link Layers 3-87

Page 88: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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 collisionsrandom 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-88

Page 89: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

“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 protocolsrandom 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-89

Page 90: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

polling:� master node “invites”

slave nodes to transmit in turn

� typically used with “dumb” slave devices master

polldata

“Taking turns” MAC protocols

“dumb” slave devices� concerns:

� polling overhead

� latency

� single point of failure (master)

master

slaves

data

Transport, Network and Link Layers 3-90

Page 91: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

token passing:� control token passed

from one node to next sequentially.

� token message

� concerns:

T

(nothingto send)

“Taking turns” MAC protocols

� concerns:

� token overhead

� latency

� single point of failure (token)

data

to send)

T

Transport, Network and Link Layers 3-91

Page 92: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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 � 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-92

Page 93: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

LAN addresses and ARP

each adapter on LAN has unique LAN address

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

adapter

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Transport, Network and Link Layers 3-93

Page 94: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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-94

Page 95: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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)do not collide with each other)

switch

bus: coaxial cablestar

Transport, Network and Link Layers 3-95

Page 96: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Ethernet frame structure

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

dest.address

sourceaddress

data (payload) CRCpreamble

type

preamble:

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

� used to synchronize receiver, sender clock rates

Transport, Network and Link Layers 3-96

Page 97: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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 � 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-97

Page 98: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Ethernet: unreliable, connectionless

� connectionless: no handshaking between sending and receiving NICs

� unreliable: receiving NIC doesnt send acks or nacks to sending NIC

� data in dropped frames recovered only if initial � data in dropped frames recovered only if initial sender uses higher layer rdt (e.g., TCP), otherwise dropped data lost

� Ethernet’s MAC protocol: unslotted CSMA/CD wth binary backoff

Transport, Network and Link Layers 3-98

Page 99: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

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 segmentsegment, 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-99

Page 100: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Switch: multiple simultaneous transmissions

� hosts have dedicated, direct connection to switch

� switches buffer packets

� Ethernet protocol used on eachincoming link, but no collisions; full duplex

A

BC’

1 2

345

6

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’

B’ C

345

Transport, Network and Link Layers 3-100

Page 101: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Interconnecting switches

� switches can be connected together

S

S4

A

B

S1

C D

E

FS2

S3

HI

G

Transport, Network and Link Layers 3-101

Page 102: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Institutional network

to externalnetwork

router

mail server

web server

IP subnet

Transport, Network and Link Layers 3-102

Page 103: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Switches vs. routers

both are store-and-forward:

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

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

application

transport

network

link

physical link

physical

switch

datagram

frame

frame

headers)

both have forwarding tables:� routers: compute tables

using routing algorithms, IP addresses

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

network

link

physicalapplication

transport

network

link

physical

frame

datagram

Transport, Network and Link Layers 3-103

Page 104: Informática y Comunicaciones Chapter 3 Transport, Network ... Transpo… · 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can

Chapter 3: summary

� transport layer

� UDP

� TCP

� Congestion

� network layer

our study of layers now complete!

� network layer

� Routing

� IP

� DHCP

� NAT

� link layer

� Error detection

� MAC

� EthernetTransport, Network and Link Layers 3-104