ELO-3091 Escenarios en conexiones TCP Contenidos Algunos recorridos del diagrama de estado TCP.

Post on 24-Jan-2016

219 views 0 download

Tags:

Transcript of ELO-3091 Escenarios en conexiones TCP Contenidos Algunos recorridos del diagrama de estado TCP.

ELO-309 1

Escenarios en conexiones TCP

ContenidosAlgunos recorridos del diagrama de

estado TCP

ELO-309 2

Establecimiento y Término de Conexión

Active participant(client)

Passive participant(server)

SYN, SequenceNum = x

SYN + ACK, SequenceNum = y,

ACK, Acknowledgment = y + 1

Acknowledgment = x + 1

ELO-309 3

Diagrama de Estado de TransmisiónCLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open Close

Send/SYNSYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACK

Close/FIN

FIN/ACKClose/FIN

FIN/ACKACK + FIN/ACK Timeout after two segment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

ELO-309 4

Escenario 1: Establecimiento de una conexión

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor Cliente

ELO-309 5

Escenario 1: El servidor debe prepararse parra recibir conexionesLa aplicación solicita abrir un socket (o punto de conexión en un puerto)

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor Cliente

6

Escenario 1: Un cliente pide abrir un socket y envía un SYN pidiendo establecimiento de conexión

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor Cliente

SYN open

7

Escenario 1: Un servidor recibe un SYN y responde con un ACK y SYN

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor Cliente

SYN

SYN + ACK

open

8

Escenario 1: El cliente recibe el SYN + ACK y para él queda establecida la conexión

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor Cliente

SYN

SYN + ACK

ACK

open

9

Escenario 1: El servidor recibe su ACK y queda establecida la conexión para él.

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor Cliente

SYN

SYN + ACK

ACK

Intercambio de mensajes

open

10

Escenario 2: Cierre de la conexión por el servidor.

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor ClienteIntercambio de mensajes

11

Escenario 2: La aplicación en el servidor solicita un close del socket.

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor ClienteIntercambio de mensajes

FINClose

12

Escenario 2: El cliente recibe el FIN y envía acuse de recibo.

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor ClienteIntercambio de mensajes

FINClose

ACK

13

Escenario 2: El servidor recibe el acuse y queda a la espera del cierre por parte del cliente.

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor ClienteIntercambio de mensajes

FINClose

ACK

14

Escenario 2: El cliente decide cerrar conexión, envía su FIN.

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor ClienteIntercambio de mensajes

FINClose

ACK

CloseFIN

15

Escenario 2: El servidor recibe el FIN y acusa su recibo.

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor ClienteIntercambio de mensajes

FINClose

ACK

CloseFIN

ACK

16

Escenario 2: El cliente recibe el ACK de su FIN y cierra la conexión.

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor ClienteIntercambio de mensajes

FINClose

ACK

CloseFIN

ACKLa conexión es cerrada

17

Escenario 2: El cliente recibe el ACK de su FIN y cierra la conexión.

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Servidor ClienteIntercambio de mensajes

FINClose

ACK

CloseFIN

ACKLa conexión es cerrada

Luego de un tiempo el servidor cierra su socket también

ELO-309 18

Iniciador de CierreCLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open Close

Send/SYNSYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACK

Close/FIN

FIN/ACKClose/FIN

FIN/ACKACK + FIN/ACK Timeout after two segment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Diagrama recorrido por quien inicia el cierre

ELO-309 19

Receptor del cierre (Me colgó el muy $ # % @ & !!!)CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open Close

Send/SYNSYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACK

Close/FIN

FIN/ACKClose/FIN

FIN/ACKACK + FIN/ACK Timeout after two segment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Secuencia seguida por quien recibe el cierre de su par no habiendo iniciado él el cierre

ELO-309 20

Diagrama de Estado de Transmisión

Los distintos caminos dependen de si hay cierre en ambos lados o no y si los FIN se cruzan en el camino.

CLOSED

LISTEN

SYN_RCVD SYN_SENT

ESTABLISHED

CLOSE_WAIT

LAST_ACKCLOSING

TIME_WAIT

FIN_WAIT_2

FIN_WAIT_1

Passive open

Close

Send/SYN

SYN/SYN + ACK

SYN + ACK/ACK

SYN/SYN + ACK

ACKClose/FIN

FIN/ACKClose/FIN

FIN/ACK

ACK + FIN/ACK

Time after twosegment lifetimes

FIN/ACK

ACK

ACK

ACK

Close/FIN

Close

CLOSED

Active open/SYN

Intercambio de mensajes

FINClose

ACK

CloseFIN

ACK

Intercambio de mensajes

FINClose

ACK

CloseFIN + ACK

ELO-309 21

Algoritmo ventana deslizante

• NS: Network simulator es un simulador de redes bastante evolucionado y de libre disposición.Ref: http://www.isi.edu/nsnam/ns/

• Invito a los interesados a verlo. Ojo no es un programa trivial, por lo cual se escapa al alcance de este curso.

• A través de este simulador se puede estudiar los fenómenos de ventana deslizante y otros.