Chapter 3 Transport Layer

Documenti analoghi
Telematica di Base. IL Livello di Trasporto TCP

Chapter 3 Transport Layer

TCP: apertura della connessione. Apertura connessione (handshake)

Telematica di Base. Il livello di trasporto

TCP: rassegna RFCs: 793, 1122, 1323, 2018, 2581

Reti di Calcolatori:

Transport Layer & TCP/UDP

Reti e Protocolli rassegna (II)

Lo sniffer. questo sconosciuto! Corso di Reti di Calcolatori Architetture e Servizi A.A. 2010/11. Introduzione allo sniffing TCP

Riferimenti. I protocolli TCP e UDP. Sorgente TCP. Principi Fondamentali. TCP header. Ricevitore TCP

IL LIVELLO TRASPORTO Protocolli TCP e UDP

Reti di Calcolatori in Tecnologia IP

TCP/IP: una breve introduzione

TCP/IP: una breve introduzione

TCP/IP: summary. Lorenzo Cavallaro, Andrea Lanzi

Programmazione in Rete

IL LIVELLO TRASPORTO Protocolli TCP e UDP

Reti di Calcolatori. IL LIVELLO TRASPORTO Protocolli TCP e UDP

IL LIVELLO TRASPORTO Protocolli TCP e UDP

MOS-oriented design of the VoIP service

Livello di trasporto e TSAP

Reti di calcolatori TCP/IP. Slide a cura di Simon Pietro Romano

Lo strato di Trasporto

Appunti del corso di PROF. G. BONGIOVANNI

Single-rate three-color marker (srtcm)

Il livello trasporto: Introduzione e protocollo UDP

Reti di Calcolatori. Master "Bio Info" Reti e Basi di Dati Lezione 3

4 - Il livello di trasporto

Il Livello Trasporto III 3. Corso di RETI DI CALCOLATORI (9 CFU) a.a II anno / II semestre. Il Livello Trasporto. Il Livello Trasporto

Sistemi e Tecnologie della Comunicazione

TCP e UDP: il livello trasporto dell'architettura TCP/IP

TCP e UDP: il livello trasporto dell'architettura TCP/IP. OSI vs. TCP/IP. Transport layer. A.Lioy - Politecnico di Torino ( ) A-1

I protocolli UDP e TCP

Il livello di trasporto

Corso di Laurea in Ingegneria Informatica. Corso di Reti di Calcolatori I

Reti di Calcolatori. Transport

Livello trasporto in Internet

Livello trasporto. Servizi del livello trasporto

Finite Model Theory / Descriptive Complexity: bin

Accesso Mul*plo - modelli

agenda Transport Layer in Internet protocolli TCP / UDP Scopi TCP - UDP Francesco Dalla Libera

Livello trasporto. Controllo del flusso e della congestione

Pier Luca Montessoro (si veda la nota di copyright alla slide n. 2) 1

TCP. Università di Palermo TCP 1

Network Address Translation (NAT)

Scheduling. Scheduler. Class 1 Class 2 Class 3 Class 4. Scheduler. Class 1 Class 2 Class 3 Class 4. Scheduler. Class 1 Class 2 Class 3 Class 4

Il livello di trasporto

TCP (1) Protocollo TCP Gestione connessione

RETI DI CALCOLATORI E APPLICAZIONI TELEMATICHE


Tecnologie e Protocolli per Internet 1 Introduzione al NAT Network Address Translation

Il livello trasporto: Introduzione e protocollo UDP

Il livello trasporto: controllo di flusso in TCP

Lo strato di Trasporto

PARTE 5 LIVELLO TRASPORTO. - Protocolli UDP e TCP. Parte 5. Modulo 1: Servizi del livello trasporto

Corso di Reti di Telecomunicazioni

Lezione n.3 LIVELLO TRASPORTO

Livello Trasporto. Liv. Applic. Liv. Transport. Transport Entity. Liv. Network. Trasporto

TCP. Servizio di Trasporto Affidabile. Transmission Control Protocol. Caratteristiche di TCP 1

TCP: Panoramica RFC: 793, 1122, 1323, 2018, 2581

Capitolo 3 - parte 3. Corso Reti ed Applicazioni Mauro Campanella

TCP: Panoramica RFC: 793, 1122, 1323, 2018, 2581

Cenni sul protocollo IP

Transmission Control Protocol

Livello trasporto in Internet

Livello trasporto in Internet

TCP: generalità RFCs: 793, 1122, 1323, 2018, 2581

IM-IU v0.1. alternata e continua. pag. 1 / 5

Livello trasporto in Internet

Il livello 4: TCP, UDP

API Socket di Berkeley

Capitolo 3 Livello di trasporto

Livello di trasporto: TCP, controllo flusso, controllo congestione

Uso di UDP per client-server UDP. Porte e multiplexing. TCP e UDP. Connessione TCP (o messaggio UDP) Caratteristiche delle porte TCP e UDP

Il livello trasporto Protocolli TCP e UDP

RETI DI CALCOLATORI. I Protocolli TCP e UDP. Livello TRASPORTO. Reti di Calcolatori A.A Carlo Mastroianni. Internet (IP) Trasporto

R. Cusani - F. Cuomo, Telecomunicazioni - Data link layer: Protocolli, Maggio 2010

Controllo della congestione

Il livello trasporto nella rete Internet: TCP e UDP

4 - Il livello di trasporto

Livello di trasporto: meccanismi trasferimento dati affidabile, TCP

OSI vs. TCP/IP. TCP e UDP: il livello trasporto dell'architettura TCP/IP. Transport layer. Transport layer. Cosa misuriamo?

TCP/IP. Transmission Control Protocol/ Internet Protocol

Livello rete. Piano di controllo. Introduzione: Piano dei dati e piano di controllo Architettura di un router IP: Internet Protocol

Livello trasporto in Internet

Argomenti: ! Servizi dello strato di trasporto! multiplexing/demultiplexing! Servizio senza connessione: UDP

Lo strato di Trasporto: instaurazione della connessione, controllo del flusso e correzione degli errori

Livello trasporto in Internet

J+... J+3 J+2 J+1 K+1 K+2 K+3 K+...

Standard: OSi vs TCP/IP. Il livello di trasporto. TCP e UDP. TCP: Transmission Control Protocol. TCP: funzionalità

Livello trasporto in Internet

TCP, UDP e Applicazioni

Reti di Calcolatori I. Prof. Roberto Canonico Dipartimento di Ingegneria Elettrica e delle Tecnologie dell Informazione

Applicazioni di rete

Transcript:

Chapter 3 Transport Layer Reti di Elaboratori Corso di Laurea in Informatica Università degli Studi di Roma La Sapienza Prof.ssa Chiara Petrioli Parte di queste slide sono state prese dal materiale associato al libro Computer Networking: A Top Down Approach, 5th edition. All material copyright 1996-2009 J.F Kurose and K.W. Ross, All Rights Reserved Thanks also to Antonio Capone, Politecnico di Milano, Giuseppe Bianchi and Francesco LoPresti, Un. di Roma Tor Vergata Transport Layer 3-1

The silly window syndrome SCENARIO Interactive user (one byte at the time) Bulk data source TCP connection Full recv buffer Transport Layer 3-2

The silly window syndrome Fill up buffer until win=0 Buffer FULL Network loaded with tinygrams (40bytes header + 1 payload!!) Ack=X, win=1 1 byte Ack=X+1, win=0 1 byte read Buffer FULL Forever! Anche se il ricevitore e veloce A passare i dati al livello applicativo inviare segmenti piccoli in un bulk di dati ha questo effetto Ack=X+1, win=1 1 byte Ack=X+2, win=0 1 byte read Buffer FULL Transport Layer 3-3

Silly window solution Problem discovered by David Clark (MIT), 1982 easily solved, by preventing receiver to send a window update for 1 byte rule: send window update when: receiver buffer can handle a whole MSS or half received buffer has emptied (if smaller than MSS) sender also may apply rule by waiting for sending data when win low Transport Layer 3-4

Interactive applications Header overhead: 20 TCP header + 20 IP header + 1 data keystroke display Data byte Ack of data byte Echo of data byte Ack of echoed byte server echo CLIENT Interactive apps: create some tricky situations. SERVER Transport Layer 3-5

Nagle s algorithm (RFC 896, 1984) UNLESS MSS data (or at least half the window size bytes) are ready to be transmitted NAGLE RULE: inhibit sending new segments if any previously transmitted data unacked self-clocking algorithm: on LANs, plenty of tynigrams on slow WANs, data aggregation 1 byte WAIT WAIT 1 byte ack 2 byte ack L idea e che si possoa trasmettere segmenti piu lunghi avendo bufferizzato dati nel frattempo Transport Layer 3-6

PUSH flag Header length Source port 6 bit Reserved checksum 32 bit Sequence number 32 bit acknowledgement number U R G A C K P S H R S T S Y N F I N Destination port Window size Urgent pointer Used to notify TCP sender to send data but for this an header flag NOT needed! Sufficient a push type indication in the TCP sender API TCP receiver to pass received data to the application Transport Layer 3-7

Urgent data Header length Source port 6 bit Reserved checksum 32 bit Sequence number 32 bit acknowledgement number U R G A C K P S H R S T S Y N F I N Destination port Window size Urgent pointer URG on: notifies rx that urgent data placed in segment. When URG on, urgent pointer contains position of the last octet of urgent data indeed it contains the positive offset from the segment sequence number and the position of the first octet of urgent data? No way to specify it! Changed wrt RFC 793 receiver is expected to pass all data up to urgent ptr to app interpretation of urgent data is left to the app typical usage: ctrlc (interrupt) in rlogin & telnet; abort in FTP urgent data is a second exception to blocked sender Transport Layer 3-8

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control Transport Layer 3-9

TCP connection Application (client) Socket TCP software State variables: - conn status - MSS - windows - buffer space normally 4 to 16 Kbytes 64+ Kbytes possible Logical connection only end hosts are aware! TCP INTERNET Connection described by client&server status Connection SET-UP duty: 1) initializes state variables 2) reserves buffer space Application (server) Socket TCP software Transmission control block Contains also info on: sockets, pointers to the users send and receive buffers, Transport Layer 3-10 to the retransmit queue and to the current segment

Connection establishment: simplest approach (non TCP) Connection request Connection granted Transmit data time time Transport Layer 3-11

Delayed duplicate problem USER REQ BANK Data duplicate REQ Application: transactional (sell 100000$ stocks) What is this? Oh my God! Too late!!! ACK duplicate Data Selling other 100000$ stocks!!!!! Transport Layer 3-12

Solution: three way handshake Tomlinson 1975 SRC Connection request (seq=x) DEST Connection granted (seq=y,ack=x+1) Acknowledge + data (seq=x+1, ack=y+1) time time Transport Layer 3-13

Delayed duplicate detection USER SEQ X BANK SEQ Y, ACK X+1 What is this? Not too late: Data SEQ X+1, ACK Y+1 duplicate SEQ X duplicate Data SEQ X+1, ACK Y+1 SEQ Z, ACK X+1 Reject SEQ X+1, ACK Z+1 Application: transactional (selling stocks)??? What a case: request with same indicator X? anyway... What is this??? Should be SEQ X, ACK Z!!!! STOP... Ah ah! Got the problem! Disaster could not be avoided with a two-way handshake Transport Layer 3-14

Header length Source port 6 bit Reserved checksum 32 bit Sequence number 32 bit acknowledgement number U R G A C K P S H R S T S Y N F I N Destination port Window size Urgent pointer SYN (synchronize sequence numbers): used to open connection SYN present: this host is setting up a connection SEQ with SYN: means initial sequence number (ISN) data bytes numbered from ISN+1. FIN: no more data to send used to close connection...more later about connection closing... Transport Layer 3-15

Three way handshake in TCP SRC Connection request (SYN, ISN=100) DEST ACTIVE OPEN Connection granted (SYN, ISN=350, ACK=101) Data segment (seq=101, ACK=351) PASSIVE OPEN time Full duplex connection: opened in both ways SRC: performs ACTIVE OPEN DEST: Performs PASSIVE OPEN time Transport Layer 3-16

Initial Sequence Number Should change in time RFC 793 (but not all implementations are conforming) suggests to generate ISN as a sample of a 32 bit counter incrementing at 4µs rate (4.55 hour to wrap around Maximum Segment Lifetime much shorter) transmitted whenever SYN (Synchronize sequence numbers) flag active note that both src and dest transmit THEIR initial sequence number (remember: full duplex) Data Bytes numbered from ISN+1 necessary to allow SYN segment ack Transport Layer 3-17

Forbidden Region Obiettivo: due sequence number identici non devono trovarsi in rete allo stesso tempo Sequence numbers T Forbidden region Time Aging dei pacchettià dopo un certo tempo MSL (Maximum Segment Lifetime) i pacchetti eliminati dalla rete Initial sequence numbers basati sul clock Un ciclo del clock circa 4 ore; MSL circa 2 minuti. à Se non ci sono crash che fanno perdere il valore dell ultimo initial sequence number usato NON ci sono problemi (si riusa lo stesso initial sequence number ogni 4 ore circa, quando il segmento precedentemente trasmesso con quel sequence number non è più in rete) e non si esauriscono in tempo <MSL i sequence number à Cosa succede nel caso di crash? RFC suggerisce l uso di un periodo di silenzio in cui non vengono inviati segmenti dopo il riavvio pari all MSL (per Transport Layer 3-18 evitare che pacchetti precedenti connessioni siano in giro).

Maximum Segment Size - MSS Announced at setup by both ends. Lower value selected (indeed min of lower value and largest size permitted by IP layer). MSS sent in the Options header of the SYN segment clearly cannot (=ignored if happens) send MSS in a non SYN segment, as connection has been already setup when SYN has no MSS, default value 536 used goal: the larger the MSS, the better... until fragmentation occurs e.g. if host is on ethernet, sets MSS=1460 1500 max ethernet size - 20 IP header - 20 TCP header Transport Layer 3-19

MSS advertise CLIENT (C_MSS) Conn request (C_MSS, SYN, seq=c_isn) SERVER (S_MSS) Use recv MSS Conn granted (MSS, SYN, seq=s_isn, ack=c_isn+1) Acknowledge (seq=c_isn+1,ack=s_isn+1) If (S_MSS<C_MSS) MSS = S_MSS; else MSS = C_MSS; time time Does not avoid fragmentation to occur WITHIN the network!! Transport Layer 3-20

TCP Connection Management:Summary Recall: TCP sender, receiver establish connection before exchanging data segments initialize TCP variables: seq. #s buffers, flow control info (e.g. RcvWindow) MSS client: connection initiator Socket clientsocket = new Socket("hostname","port number"); server: contacted by client Socket connectionsocket = welcomesocket.accept(); Three way handshake: Step 1: client host sends TCP SYN segment to server specifies initial seq # no data Step 2: server host receives SYN, replies with SYNACK segment server allocates buffers specifies server initial seq. # Step 3: client receives SYNACK, allocates buffer and variables,replies with ACK segment, which may contain data Per chiudere la connessione uno dei due estremi invia un messaggio con FIN flag a 1 Transport Layer 3-21 a cui l altro estremo della connessione risponde con ACK

Problema dei due eserciti L esercito rosso e globalmente più debole. Se le due pattuglie verdi attaccano insieme lo sconfiggono, altrimenti perdono. Possono scambiarsi messaggi relativi all orario in cui attaccheranno e di ACK di un messaggio ricevuto. I messaggeri che li portano possono pero essere catturati e quindi il messaggio può non arrivare correttamente a destinazione. Come fanno a mettersi d accordo per attaccare insieme? Transport Layer 3-22

Problema dei due eserciti L esercito rosso e globalmente più debole. Se le due pattuglie verdi attaccano insieme lo sconfiggono, altrimenti perdono. Possono scambiarsi messaggi relativi all orario in cui attaccheranno e di ACK di un messaggio ricevuto. I messaggeri che li portano possono pero essere catturati e quindi il messaggio può non arrivare correttamente a destinazione. Come fanno a mettersi d accordo per attaccare insieme? Pattuglia 1 Attacco alle 6 Pattuglia 2 Senza ACK 1 non Attacchera perche Non sa se 2 ha ricevuto Il messaggio Transport Layer 3-23

Problema dei due eserciti L esercito rosso e globalmente più debole. Se le due pattuglie verdi attaccano insieme lo sconfiggono, altrimenti perdono. Possono scambiarsi messaggi relativi all orario in cui attaccheranno e di ACK di un messaggio ricevuto. I messaggeri che li portano possono pero essere catturati e quindi il messaggio può non arrivare correttamente a destinazione. Come fanno a mettersi d accordo per attaccare insieme? Pattuglia 1 Pattuglia 2 Attacco alle 6 OK Attacco alle 6 Senza ACK del secondo Messaggio 2 non attacchera perche Non sa se 1 ha ricevuto il messaggio e sa che senza ACK del primo messaggio 1 non Attacchera Transport Layer 3-24

Problema dei due eserciti In generale: se N scambi di messaggi /Ack etc. necessari a raggiungere la certezza dell accordo per attaccare allora cosa succede se l ultimo messaggio necessario va perso? à E impossibile raggiungere questa certezza. Le due pattuglie non attaccheranno mai!! Transport Layer 3-25

Problema dei due eserciti: cosa ha a che fare con le reti e TCP?? Chiusura di una connessione. Vorremmo un accordo tra le due peer entity o rischiamo di perdere dati. A Connection Request B connected Accept Data connected Data Disconnection Request (FIN) A pensa che il secondo pacchetto sia stato ricevuto. La connessione e Stata chiusa da B prima che ciò avvenisse secondo pacchetto perso!!! Transport Layer 3-26

Quando si può dire che le due peer entity abbiano raggiunto un accordo??? Problema dei due eserciti!!! A B Connection Request connected Accept Data connected Data Disconnection Request Ack Ma se l ACK va perso???? Soluzione: si e disposti a correre piu rischi quando si butta giu una connessione di quando si attacca un esercito nemico. Possibili malfunzionamenti. Soluzioni di recovery in questi casi Transport Layer 3-27

TCP Connection Management (cont.) Since it is impossible to solve the proble use simple solution: two way handshake Closing a connection: client server client closes socket: clientsocket.close(); close FIN Step 1: client end system sends TCP FIN control segment to server ACK FIN closing Step 2: server receives FIN, replies with ACK. Closes connection, sends FIN. timed wait closed ACK Transport Layer 3-28

TCP Connection Management (cont.) Step 3: client receives FIN, replies with ACK. Enters timed wait - will respond with ACK to received FINs Step 4: server, receives ACK. Connection closed. closing client FIN ACK FIN server closing timed wait ACK closed closed Transport Layer 3-29

TCP Connection Management (examples) client server client server closing FIN closing FIN ACK FIN closing FIN ACK closing timed wait closed ACK FIN closed ACK FIN ACK closed Transport Layer 3-30

Connection states - Client Transport Layer 3-31

Connection States - Server Transport Layer 3-32

Header length Source port 6 bit Reserved checksum 32 bit Sequence number 32 bit acknowledgement number U R G A C K P S H R S T S Y N F I N Destination port Window size Urgent pointer RST (Reset) sent whenever a segment arrives and does not apparently belong to the connection typical RST case: connection request arriving to port not in use Sending RST within an active connection: allows aborting release of connection (versus orderly release) any queued data thrown away receiver of RST can notify app that abort was performed at other end Transport Layer 3-33

Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control Transport Layer 3-34

Principles of Congestion Control 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! Transport Layer 3-35

Causes/costs of congestion: scenario 1 two senders, two receivers Host A λ in : original data λ out one router, infinite buffers Host B unlimited shared output link buffers no retransmission large delays when congested maximum achievable throughput Transport Layer 3-36

Causes/costs of congestion: scenario 2 one router, finite buffers sender retransmission of lost packet Host A λ in : original data λ out λ' in : original data, plus retransmitted data Host B finite shared output link buffers Transport Layer 3-37

Causes/costs of congestion: scenario 2 always we want: λ = λ (goodput) in out Second step retransmission only when loss: λ in retransmission of delayed (not lost) packet makes (than second case) for same λ out > λ out λ larger in costs of congestion: more work (retrans) for given goodput Caso in cui ciascun pacchetto instradato Sia trasmesso mediamente due volte dal router unneeded retransmissions: link carries multiple copies of pkt Transport Layer 3-38

Causes/costs of congestion: scenario 3 four senders multihop paths timeout/retransmit Q: what happens as λ in and increase? λ in Host A λ in : original data λ' in : original data, plus retransmitted data finite shared output link buffers D Host B λ out D-B traffic high Transport Layer 3-39

Causes/costs of congestion: scenario 3 H o st A λ o u t H o st B Another cost of congestion: when packet dropped, any upstream transmission capacity used for that packet was wasted! Transport Layer 3-40

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 sender should send at Transport Layer 3-41