16952_lecture 35 36 37 tcp and udp and congestion control.ppt

23
TCP and UDP Facilitator: Parvesh Mor

Upload: sarbanons

Post on 16-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

TCP and UDPFacilitator: Parvesh Mor

Page 2: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

2

Transport Layer OverviewTransport Layer Overview

Transmission ControlProtocol (TCP)

User Datagram Protocol (UDP)

Transmission ControlProtocol (TCP)

User Datagram Protocol (UDP)

Application

Transport

Internet

Data-Link

Physical

Connection-Oriented

Connectionless

Page 3: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

3

TCP Segment FormatTCP Segment Format

Source Port (16) Destination Port (16)

Sequence Number (32)

HeaderLength (4)

Acknowledgment Number (32)

Reserved (6) Code Bits (6) Window (16)

Checksum (16) Urgent (16)

Options (0 or 32 if Any)

Data (Varies)

20Bytes

Bit 0 Bit 15 Bit 16 Bit 31

Page 4: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

4

Port NumbersPort Numbers

TCP

Port Numbers

FTP

TransportLayer

TELNET

DNS

SNMP

TFTP

SMTP

UDP

ApplicationLayer

2121 2323 2525 5353 6969 161161

RIP

520520

Page 5: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

5

TCP Port NumbersTCP Port Numbers

SourcePort

SourcePort

DestinationPort

DestinationPort ……

Host A

10281028 2323 ……

SP DP

Host ZTelnet Z

Destination port = 23.

Send packet to my

Telnet

application.

Page 7: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

7

Send SYN (seq = 100 ctl = SYN)

SYN Received

Send SYN, ACK (seq = 300 ack = 101 ctl = syn,ack)

Established(seq = 101 ack = 301 ctl = ack)

Host A Host B

1

2

3

SYN Received

TCP Three-Way Handshake/Open Connection

TCP Three-Way Handshake/Open Connection

Page 8: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

8

TCP Connection Establishment

• TCP uses a three-way handshake to open a connection:

(1) ACTIVE OPEN: Client sends a segment with– SYN bit set *– port number of client – initial sequence number (ISN) of client

(2) PASSIVE OPEN: Server responds with a segment with– SYN bit set *– initial sequence number of server– ACK for ISN of client

(3) Client acknowledges by sending a segment with:– ACK ISN of server (* counts as one byte)

Page 9: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

9

Opening & Closing Connection

Page 10: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

10

TCP States in “Normal” Connection Lifetime

SYN (SeqNo = x)

SYN (SeqNo = y, AckNo = x + 1 )

(AckNo = y + 1 )

SYN_SENT(active open)

SYN_RCVD

ESTABLISHED

ESTABLISHED

FIN_WAIT_1(active close)

LISTEN(passive open)

FIN (SeqNo = m)

CLOSE_WAIT(passive close)

(AckNo = m+ 1 )

FIN (SeqNo = n )

(AckNo = n+1)LAST_ACK

FIN_WAIT_2

TIME_WAIT

CLOSED

Page 11: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

TCP States

State Description

CLOSED No connection is active or pendingLISTEN The server is waiting for an incoming callSYN RCVD A connection request has arrived; wait for AckSYN SENT The client has started to open a connectionESTABLISHED Normal data transfer stateFIN WAIT 1 Client has said it is finishedFIN WAIT 2 Server has agreed to releaseTIMED WAIT Wait for pending packets (“2MSL wait state”)CLOSING Both Sides have tried to close simultanesouslyCLOSE WAIT Server has initiated a releaseLAST ACK Wait for pending packets

Page 12: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

12

Windowing

• Windowing in networking means the quantity of data segments which is measured in bytes that a machine can transmit/send on the network without receiving an acknowledgement

Page 13: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

13• Window Size = 1

Sender ReceiverSend 1

Receive 1

Receive ACK 2 Send ACK 2

Send 2Receive 2

Receive ACK 3Send ACK 3

Send 3Receive 3

Receive ACK 4 Send ACK 4

TCP Simple AcknowledgmentTCP Simple Acknowledgment

Page 14: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

14

TCP Sequence and Acknowledgment Numbers

TCP Sequence and Acknowledgment Numbers

SourcePort

SourcePort

DestinationPort

DestinationPort

……SequenceSequence AcknowledgmentAcknowledgment

10281028 2323

Dest.

11111111

Seq.

101101

Ack.

10281028 2323

Source Dest.

10101010

Seq.

100100

Ack.

102810282323

Source Dest.

11111111

Seq.

100100

Ack.

102810282323

Source Dest.

12121212

Seq.

101101

Ack.

I just got number11, now I need number 12.

I justsent number11.

Page 15: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

15

Windowing

There are two window sizes—one set to 1 and one set to 3. When you’ve configured a window size of 1, the sending machine

waits for an acknowledgment for each data segment it transmits before transmitting another

If you’ve configured a window size of 3, it’s allowed to transmit three data segments before an acknowledgment is received.

Page 16: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

16

Windowing

Page 17: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

17

Transport Layer Reliable Delivery

Page 18: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

18

Flow Control

Another function of the transport layer is to provide optional flow control.

Flow control is used to ensure that networking devices don’t send too much information to the destination, overflowing its receiving buffer space, and causing it to drop the sent information

The purpose of flow control is to ensure the destination doesn't get overrun by too much information sent by the source

Page 19: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

19

Flow Control

SEQ 1024

SEQ 2048

SEQ 3072

AB

30723

Ack 3073 Win 0

Ack 3073 Win

3072

Page 20: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

20

User Datagram Protocol (UDP)

User Datagram Protocol (UDP) is the connectionless transport protocol in the TCP/IP protocol stack.

UDP is a simple protocol that exchanges datagrams, without acknowledgments or guaranteed delivery. Error processing and retransmission must be handled by higher layer protocols.

UDP is designed for applications that do not need to put sequences of segments together.

The protocols that use UDP include: • TFTP (Trivial File Transfer Protocol) • SNMP (Simple Network Management Protocol) • DHCP (Dynamic Host Control Protocol) • DNS (Domain Name System)

Page 21: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

21

• No sequence or acknowledgment fields

UDP Segment FormatUDP Segment Format

Source Port (16) Destination Port (16)

Length (16)

Data (if Any)

1Bit 0 Bit 15 Bit 16 Bit 31

Checksum (16)

8Bytes

Page 22: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

22

TCP vs UDP

Page 23: 16952_Lecture 35 36 37 TCP and UDP and Congestion Control.ppt

Common UDP Application & Ports

• 53- Domain DNS

• 67,68 BOOTP & DHCP respectively

• 69 TFTP

• 161,162 SNMP

• 520,521 RIPv1,RIPv2

• 2049 NFS

23