TCP Header Format
Total 13 Field
Learn acronym
HSDDDO Acche SE UR WINNER RE PAD FLAG—UPARSF
What goes into option field of TCP.
MSS value, SACK,Windows scaling, irtt time etc.
Can you set or change MSS?
Yes by using tcp mss adjust command.
Source Port: 16 bits
The source port number.
Destination Port: 16 bits
The destination port number.
Sequence Number: 32 bits
The sequence number of the first data octet in this segment (except when SYN is present). If SYN is present the sequence number is the initial sequence number (ISN) and the first data octet is ISN+1.
Acknowledgment Number: 32 bits
If the ACK control bit is set this field contains the value of the next sequence number the sender of the segment is expecting to receive. Once a connection is established this is always sent.
Data Offset: 4 bits
The number of 32 bit words in the TCP Header. This indicates where the data begins. The TCP header (even one including options) is an integral number of 32 bits long.
Reserved: 6 bits
Reserved for future use. Must be zero.
Control Bits: 6 bits (from left to right):
URG: Urgent Pointer field significant The URG bit if set prioritizes the data meaning thereby instead of waiting for the entire byte stream to be transmitted which is ahead of the “Urgent” data, the urgent data will be sent on urgent basis and will not wait for the entire byte stream to be transmitted which is ahead of it. When the URG bit is set the Urgent Pointer is also set (in the TCP header Options field: 16 bit). ACK: Acknowledgment field significant PSH: Push Function RST: Reset the connection SYN: Synchronize sequence numbers FIN: No more data from sender URG flag and urgent pointer will always set together.
Window: 16 bits
The number of data octets beginning with the one indicated in the acknowledgment field which the sender of this segment is willing to accept.
Checksum: 16 bits
The checksum field is the 16 bit one’s complement of the one’s complement sum of all 16 bit words in the header and text. If a segment contains an odd number of header and text octets to be check summed, the last octet is padded on the right with zeros to form a 16 bit word for checksum purposes. The pad is not transmitted as part of the segment. While computing the checksum, the checksum field itself is replaced with zeros.The checksum also covers a 96 bit pseudo header conceptually prefixed to the TCP header.This pseudo header contains the Source Address, the Destination Address, the Protocol, and TCP length.This gives the TCP protection against misrouted segments.This information is carried in the Internet Protocol and is transferred across the TCP/Network interface in the arguments or results of calls by the TCP on the IP. The TCP Length is the TCP header length plus the data length in octets (this is not an explicitly transmitted quantity, but is computed), and it does not count the 12 octets of the pseudo header.
Urgent Pointer: 16 bits
The URG pointer tell how many bytes of the data is urgent in the segment that has arrived. (Example if the data size is 100 bytes and only firs 50 bytes is urgent, the urgent pointer will have a value of 50).
Options: variable
Note that the list of options may be shorter than the data offset field might imply. The content of the header beyond the End-of-Option option must be header padding (i.e., zero). A TCP must implement all options. Currently defined options include (kind indicated in octal):
Kind Length Meaning —- —— ——- 0 – End of option list. 1 – No-Operation. 2 4 Maximum Segment Size. If this option is present, then it communicates the maximum receive segment size at the TCP which sends this segment. Option field parameter (MSS ,EOL RTT etc ) must be send with the syn flag only during TCP initialization.
Padding: variable
The TCP header padding is used to ensure that the TCP header ends and data begins on a 32 bit boundary. The padding is composed of zeros.