module a panko and panko business data networks and security, 9 th edition © 2013 pearson

28
More on TCP Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Upload: janis-lang

Post on 15-Jan-2016

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

More on TCPModule A

Panko and PankoBusiness Data Networks and Security, 9th Edition© 2013 Pearson

Page 2: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

TCP is reliable.◦ IP packets carrying TCP segments may arrive out

of order.

◦ TCP must put the TCP segments in order.

2

TCP

3 4 2 15

© 2013 Pearson

Page 3: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

TCP is reliable.◦ Each correct TCP segment is acknowledged by the

receiver.

3

TCP

SourceTransportProcess

SourceTransportProcess

DestinationTransportProcess

DestinationTransportProcess

TCP SegmentTCP Segment

ACKACK

© 2013 Pearson

Page 4: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Each TCP segment sent by a side must have a sequence number.◦ Simplest approach to sequence numbers:

1,2,3,4,5,6,7, and so on

◦ To detect lost or out-of-sequence messages

◦ (TCP uses a more complex approach than this, as we will see)

4

TCP Segment

11 44 22 55

3?

© 2013 Pearson

Page 5: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

TCP header has a 32-bit sequence number field.

5

TCP Sequence Numbers

Source Port # (16) Destination Port # (16)

Sequence Number (32 bits)

Acknowledgement Number (32 bits)

Hdr Len(4) Flags (6) Window Size (16)

Options (if any) PAD

Reserved (6)

TCP Checksum (16) Urgent Pointer (16)

Data Field

© 2013 Pearson

Page 6: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Initial Sequence Number is randomly selected by the sender; say, 79.

Sent in the sequence number field of the first TCP segment.

6

TCP Sequence Numbers

79TCP Data Field

TCP Header

Sequence Number Fieldwith Initial Sequence Number (79)

© 2013 Pearson

Page 7: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Data octets in data fields of all segments in a connection are viewed as a long string.

TCP Segment 1 79 TCP Segment 2 80

8182

TCP Segment 3 8384

7

TCP Sequence Numbers

3 Octets in Data Field

2 Octets in Data Field

ISN

© 2013 Pearson

Page 8: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Supervisory segments, which contain a header but no data, are treated as carrying a single octet of data.

TCP seg 1 898899

TCP seg 2 900 TCP seg 3 901

902…

8

TCP Sequence Numbers

Supervisory Segment

Carries Data

Carries Data

© 2013 Pearson

Page 9: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Sequence number field gets the value of the first octet in the data field.

TCP 1 79 TCP 2 80

8182

TCP 3 8384

9

TCP Sequence Numbers

80 is SeqNum Field Value

83 is SeqNum Field Value

79 is SeqNum Field Value

© 2013 Pearson

Page 10: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Acknowledgement must indicate which TCP segment is being acknowledged.

10

TCP Acknowledgements

SourceTCP

Process

SourceTCP

Process

DestinationTCP

Process

DestinationTCP

Process

TCP SegmentTCP Segment

ACKACK

© 2013 Pearson

Page 11: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

TCP header contains a 32-bit Acknowledgement Number field to designate the TCP segment being acknowledged.

11

TCP Acknowledgements

Source Port # (16) Destination Port # (16)

Sequence Number (32 bits)

Acknowledgement Number (32 bits)Hdr Len

(4) Flags (6) Window Size (16)

Options (if any) PAD

Reserved (6)

TCP Checksum (16) Urgent Pointer (16)

Data Field

© 2013 Pearson

Page 12: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Acknowledgement Number field contains the next byte expected—the last byte of the segment being acknowledged, plus one.

TCP 1 79

TCP 2 808182

TCP 3 8384

12

TCP Acknowledgment Numbers

83 is AckNum Field Value

85 is AckNum Field Value

80 is AckNum Field Value

© 2013 Pearson

Page 13: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Quiz: A TCP segment contains the following data octets:◦ 567, 568, 569, 570, 571, 572, 573, 574

What will be in the sequence number field of the TCP segment delivering the data?

What will be in the acknowledgement number field of the TCP segment acknowledging the TCP segment that delivers these octets?

13

TCP Acknowledgement Number

© 2013 Pearson

Page 14: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Flow Control

◦ One TCP process transmits too fast.

◦ Other TCP process is overwhelmed.

◦ Receiver must control transmission rate.

◦ This is flow control.

14

TCP Flow Control

TCP Process TCP Process

Too MuchData

Flow Control Message

© 2013 Pearson

Page 15: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

A TCP segment has a Window Size field.◦ Used in acknowledgements

15

TCP Flow Control

Source Port # (16) Destination Port # (16)

Sequence Number (32 bits)

Acknowledgement Number (32 bits)

Hdr Len(4) Flags (6) Window Size (16)

Options (if any) PAD

Reserved (6)

TCP Checksum (16) Urgent Pointer (16)

Data Field

© 2013 Pearson

Page 16: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

A TCP segment has a Window Size field.◦ Tell how many more octets the sender can send

beyond the segment being acknowledged

16

TCP Flow Control

TCP Process TCP Process

Data

Acknowledgement with Window Size Field

© 2013 Pearson

Page 17: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Example

◦ TCP segment contained octets 45–89

◦ Acknowledgement number for TCP segment acknowledging the segment is 90

◦ If Window Size field value is 50, then

◦ Sender may send through octet 140

◦ Must then stop unless the window has been extended in another acknowledgement

17

TCP Flow Control

© 2013 Pearson

Page 18: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Each Acknowledgement extends the window of octets that may be sent.◦ Called a sliding window protocol

18

TCP Flow Control

1–44 45–79 80–419 420–630

400May send through 480

1–44 45–79 80–419 420–630

500May send through 920

© 2013 Pearson

Page 19: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

TCP Segments have maximum data field sizes.◦ (Size limit details are discussed later.)◦ What if an application layer message is too large?

19

TCP Fragmentation

TCP HeaderTCP Data Field Max

Application Layer Message

© 2013 Pearson

Page 20: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Application layer message must be fragmented.◦ Broken into several pieces◦ Delivered in separate TCP segments

20

TCP Fragmentation

TCP HeaderTCP Data Field Max

App Frag 1 App Frag 2 App Frag 3

© 2013 Pearson

Page 21: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Note that, in TCP fragmentation, the TCP segment is not fragmented.◦ The application layer message is fragmented.

21

TCP Fragmentation

TCP HeaderTCP Data Field Max

App Frag 1 App Frag 2 App Frag 3

© 2013 Pearson

Page 22: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Transport layer process on the source host does the fragmentation.◦ Application layer on the source host is not

involved◦ Transparent to the application layer

22

TCP Fragmentation

Application

Transport

Internet

Application Message

TCP Segment TCP Segment

© 2013 Pearson

Page 23: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Transport layer process on the destination host does the reassembly.◦ Application layer on the destination host is

not involved; gets original application layer message.

23

TCP Fragmentation

Application

Transport

Internet

Application Message

TCP Segment TCP Segment

© 2013 Pearson

Page 24: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

What is the maximum TCP data field size?◦ Complex

Maximum Segment Size (MSS)◦ Maximum size of a TCP segment’s data field

◦ NOT maximum size of the segment as its name would suggest!!!

24

TCP Fragmentation

© 2013 Pearson

Page 25: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

MSS Default is 536 octets.◦ Maximum IP packet size any network must

support is 576 octets. Larger IP packets MAY be fragmented

◦ IP and TCP headers are 20 octets each if there are no options.

◦ This gives the default MSS of 536.

◦ Smaller if there are options in the IP or TCP header.

25

TCP Fragmentation

© 2013 Pearson

Page 26: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

MSS Default is 536 octets.

◦ Suppose the application layer process is 1,000 octets long.

◦ Two TCP segments will be needed to send the data.

◦ The first can send the first 536 octets.

◦ The second can carry the remaining 464 octets of the application layer message.

26

TCP Fragmentation

© 2013 Pearson

Page 27: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

Each side may announce a larger MSS.

◦ An option usually used in the initial SYN message it sends to the other.

◦ If announces MSS of 2,048, this many octets of data may be sent in each TCP segment.

◦ 536 is only the default—the value to use if no other value is specified by the other side.

27

TCP Fragmentation

© 2013 Pearson

Page 28: Module A Panko and Panko Business Data Networks and Security, 9 th Edition © 2013 Pearson

28© 2013 Pearson