Ethernet TCP IP Packet Format and header fields

Introduction : In today’s high-speed digital world, efficient and reliable data communication hinges on understanding how information travels across networks. Whether you’re streaming a video, browsing a website, or syncing files in the cloud, your data moves through multiple layers. The data packets go through the link layer, moving through the network layer and then the transport layer. At each of these layers an essential structure called the header carries metadata that governs routing, addressing, integrity, segmentation and delivery. In this page, we explore in depth the header fields of Ethernet, IP (Internet Protocol) and TCP (Transmission Control Protocol). We will explain the purpose of each field, how the fields interplay across layers.

TCP/IP Packet Structure & header fields

The following table breaks down the fields within a typical TCP/IP packet, including their sizes, types, and descriptions. Following are as per old RFCs.

No. of bytesField typeDescriptionHeader type
1-6DADestination addressEthernet Header
7-12SASource AddressEthernet Header
13-14TypeType Field (0x800 - IP, 0x806 - ARP)Ethernet Header
15Ver,IHLVer=4, No. of 4 byte words in the headerIP header
16TypeType of Service (typically 0)IP header
17-18T-lenTotal length of packet in bytes including IP headerIP header
19-20IDUnique Identification of packetIP header
21Flags3 bits (0-DF-MF) DF=0 May fragment, MF=0 last fragmentIP header
21-22OffsetFragment offset in 64 bit blocksIP header
23TTLTime to liveIP header
24ProtocolUpper layer protocol carried in data (TCP/UDP)IP header
25-26ChecksumChecksum of the headerIP header
27-30IP SAIP source addressIP header
31-34IP DAIP destination addressIP header
35-36S-portSource portTCP header
37-38D-portDestination portTCP header
39-42Seq. Num.Sequence NumberTCP header
43-46ACKAcknowledgement numberTCP header
47Len (Data Offset)4 bit size of TCP header in 4 byte wordsTCP header
47-48Reserved6 bits not usedTCP header
48FlagsUAPRSF (U=Urgent, A=Ack, P=Push, R=Reset, S=Sync, F=Fin)TCP header
49-50WindowTCP Window (for flow control)TCP header
51-52ChecksumChecksum for header and dataTCP header
53-54Urgent*Urgent pointerTCP header
55 to NDATATCP DataData Payload
N+1FCSCRC (4 byte)Ethernet Header
  • After “*Urgent Pointer” Options field will follow as per latest RFC of TCP header ( RFC 9293).
  • If DF (Don’t Fragment) = 1 and the packet encounters a link with too small an MTU, the packet must be dropped rather than fragmented
  • When fragmentation occurs: MF (More Fragments) = 1 for all fragments except the last one, which has MF = 0 This ‘MF’ bit, when set to 0, indicates that this packet is not followed by more fragments of the same original datagram — i.e., it’s either the only fragment or the last fragment.

Example (FTP upload with fize size of 2020 bytes)

Assume there are two hosts, i.e. client (Host#1) and server (Host#2) communicating using FTP protocol. As per Old RFC, we have IP header of 20 bytes size and TCP header of 20 bytes size. We are left with (1500-40)=1460 bytes of payload data in packet-1. Rest of the payload data i.e. 2020-1460 = 560 bytes are carried by packet#2. Following table mentions actual values for this example for both the packets.

  • On a standard Ethernet network, the MTU (Maximum Transmission Unit) at the IP layer is typically 1500 bytes.

Ethernet Header

FieldsPacket-1 (Client->Server , first data chunk)Packet-2 (Client->Server, second & final data chunk)
Destination address66:77:88:99:AA:BB66:77:88:99:AA:BB
Source address00:11:22:33:44:5500:11:22:33:44:55
Type Field0x08000x0800

IP Header

FieldsPacket-1Packet-2
IP version (4 bits)44
Header length (4bits) (IHL)5 (20 Bytes)5
Type of Service00
Total Length1500 bytes (20 bytes IP header, 20 bytes tcp header, 1460 tcp data)600 bytes (20 + 20 + 560 )
Identification0x1A2B0x1A2C
Flags (DF,MF)DF=1, MF = 1DF=1, MF = 0
Fragment Offset00
Time to Live6464
Protocol66
Header ChecksumcomputedComputed and placed
Source IP10.0.0.110.0.0.1
Destination IP172.16.0.10172.16.0.10

TCP Header

FieldsPacket-1Packet-2
Source Port4915249152
Destination Port2121
Sequence Number100000 (initial assumed)101460
Ack number200000200000
Data Offset5 (indicates 20 bytes)5
Flags (SYN, ACK, FIN, RST, PSH, URG)ASK=1, PSH=1ACK=1, PSH = 1
Window size6553565535
ChecksumCalculated and placedCalculated & placed
Urgent Pointer00
OptionsNoneNone

During Connection Establishment (Three-way Handshake)

Following flags are set during initial tcp/ip connection establishment process.

  1. Client → Server: SYN = 1, ACK = 0, other flag bits (FIN, RST, PSH, URG) = 0
  2. Server → Client: SYN = 1, ACK = 1, other flag bits (FIN, RST, PSH, URG) = 0
  3. Client → Server: ACK = 1, other flag bits (SYN, FIN, RST, PSH, URG) = 0

For both the example, packets during data phase following are the setting of 6 flags.

  1. Packet 1 (data): SYN=0, ACK=1, FIN=0, RST=0, PSH=1, URG=0
  2. Packet 2 (data): SYN=0, ACK=1, FIN=0, RST=0, PSH=1, URG=0

If the receiver sends an ACK only (no data) back to the sender, flags are set as follows.

  • ACK packet: SYN=0, ACK=1, FIN=0, RST=0, PSH=0, URG=0

TCP Header as defined in RFC9293

TCP Header Image Courtesy (IETF) : RFC 9293

Following are the changed fields compared to previous RFCs.

Data Offset (4 bits) :

  • Indicates the size of the TCP header in 32‐bit words. In other words, it tells where the data payload begins. Minimum value is 5 (i.e. 20 bytes) for a header with no options.

  • Example : If data offset = 5, then header is 5 × 32 bits = 160 bits = 20 bytes.

  • Because of this field, the header may include optional fields (so header length can vary).

Options (variable length, optional):

  • Immediately follows the fixed header fields. Because the Data Offset field sets the header length, options may or may not be present and may be of varying length.
  • Options must align on 32‐bit word boundaries (padding may be required) so that the header ends at a 32‐bit boundary.
  • The maximum header length (with options) is typically 60 bytes. For which, data offset maximum value can be 15 (15 × 4 = 60 bytes).

Conclusion: From the source and destination MAC addresses in the Ethernet header, to the version, protocol identifier and TTL in the IP header, and onward to the ports, sequence and acknowledgment numbers in the TCP header; these fields together ensure that data is delivered, in order, intact and to the right place.