TCP Mechanisms

Figure 2-9 displays the TCP header format.

Figure 2-9 TCP Header Format

Source Port

Destination Port

Sequence Number

Acknowledgment Number

Data Offset

Reserved

Flags

Window

Checksum

Urgent Pointer

Options (+ Padding)

Options (+ Padding)

Data (Variable)

The following descriptions summarize the TCP packet fields illustrated in Figure 2-9:

• Source Port and Destination Port—Identifies points at which upper-layer source and destination processes receive TCP services (16 bits in length). Common destination ports include 23 for Telnet, 21 for FTP, and 20 for FTP data.

• Sequence Number—Usually specifies the number assigned to the first byte of data in the current message. In the connection-establishment phase, this field can also identify an initial sequence number to be used in an upcoming transmission.

• Acknowledgment Number—Contains the sequence number of the next byte of data that the sender of the packet expects to receive.

• Data Offset—Indicates the number of 32-bit words in the TCP header.

• Reserved—Remains reserved for future use.

• Flags—Carries a variety of control information, including the SYN and ACK bits used for connection establishment, and the FIN bit used for connection termination.

• Window—Specifies the size of the sender's receive window (that is, the buffer space available for incoming data).

• Checksum—Indicates whether the header was damaged in transit.

• Urgent Pointer—Points to the first urgent data byte in the packet.

• Options—Specifies various TCP options.

• Data—Contains upper-layer information.

A number of mechanisms are used by TCP to ensure the reliable delivery of data, including the following:

• Acknowledgments

• Sequences numbering

NOTE The Flags field is critical in a TCP segment. The field's various options include the following:

• URG (U) (Urgent)—Informs the other station that urgent data is being carried. The receiver will decide what to do with the data.

• ACK (A) (Acknowledge)—Indicates that the packet is an acknowledgment of received data, and the acknowledgment number is valid.

• PSH (P) (Push)—Informs the end station to send data to the application layer immediately.

• RST (R) (Reset)—Resets an existing connection.

• SYN (S) (Synchronize)—Initiates a connection, commonly known as established.

• FIN (F) (Finished)—Indicates that the sender is finished sending data and terminates the session.

To best describe how TCP is set up and established, consider a Telnet request from a PC to a Cisco router and follow the flags, acknowledgments, sequence, and windowing options.

Figure 2-10 displays a typical Telnet session between a PC and a Cisco router. The PC initializes a Telnet request using destination port 23 and an initial sequence number.

Figure 2-10 Telnet (TCP) Packet Flow

Step 1

PC requests Telnet session. Flags U A P R S F 0 0 0 0 0 0 Destination Port is 23 or Telnet. Initial sequence is 14810532. Ack set to 0.

Ethernet Segment

Step 3

Flags U A P R S F 0 1 0 0 0 0 Sequence is 14810533. Ack set to 364639619.

Step 5

Step 8

PC acknowledges request.

Connection Request (SYN)

Connection Reply (ACK and SYN)

PC acknowledges Router (ACK)

Step 4 Data Flow-

PC tears down session (FIN)

0 0

Post a comment