Understanding TCP/IP Packet Format

tcp/ip
packet
ethernet
ip address
network

This tutorial provides a comprehensive overview of networking fundamentals, covering topics ranging from circuit switching and packet switching to the intricacies of the TCP/IP protocol. We’ll explore the fields within TCP/IP packets, delve into the ARP/RARP protocols, and clarify the concepts of IP addresses and MAC addresses. Furthermore, we will examine various networking devices, including hubs, switches, bridges, routers, gateways, and firewalls.

This page focuses specifically on the TCP/IP packet format, detailing the fields present in the Ethernet header, IP header, and TCP header.

Topics Covered

  • Circuit Switching vs Packet Switching
  • LAN vs WAN vs MAN
  • What is an IP address
  • What is a MAC Address
  • Basics of OSI and TCP-IP Layers
  • What is Hub
  • What is Switch
  • What is Bridge
  • What is Router
  • What is Gateway
  • Firewall basics
  • TCP-IP Packet format
  • ARP Protocol format

TCP/IP Packet Structure

The following table breaks down the fields within a typical TCP/IP packet, including their sizes, types, and descriptions.

No. of bytesField typeDescriptionHeader type
1-6DADestination addressEthernet Header
7-12SASource AddressEthernet Header
13-14TypeType Field (0x800 - IP, 0x806 - ARP)Ethernet Header
15VerVer=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
47Len4 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-54UrgentUrgent pointerTCP header
55 to NDATATCP DataData Payload
N+1FCSCRC (4 byte)Ethernet Header

Comprehensive Networking Training Course Overview

Explore our detailed networking training course, covering basics to advanced concepts like IP addresses, OSI model, Gigabit Ethernet, and key protocols. Ideal for beginners and experienced professionals.

networking
ethernet
protocols