Understanding TCP/IP Packet Format
Advertisement
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 bytes | Field type | Description | Header type |
---|---|---|---|
1-6 | DA | Destination address | Ethernet Header |
7-12 | SA | Source Address | Ethernet Header |
13-14 | Type | Type Field (0x800 - IP, 0x806 - ARP) | Ethernet Header |
15 | Ver | Ver=4, No. of 4 byte words in the header | IP header |
16 | Type | Type of Service (typically 0) | IP header |
17-18 | T-len | Total length of packet in bytes including IP header | IP header |
19-20 | ID | Unique Identification of packet | IP header |
21 | Flags | 3 bits (0-DF-MF) DF=0 May fragment, MF=0 last fragment | IP header |
21-22 | Offset | Fragment offset in 64 bit blocks | IP header |
23 | TTL | Time to live | IP header |
24 | Protocol | Upper layer protocol carried in data (TCP/UDP) | IP header |
25-26 | Checksum | Checksum of the header | IP header |
27-30 | IP SA | IP source address | IP header |
31-34 | IP DA | IP destination address | IP header |
35-36 | S-port | Source port | TCP header |
37-38 | D-port | Destination port | TCP header |
39-42 | Seq. Num. | Sequence Number | TCP header |
43-46 | ACK | Acknowledgement number | TCP header |
47 | Len | 4 bit size of TCP header in 4 byte words | TCP header |
47-48 | Reserved | 6 bits not used | TCP header |
48 | Flags | UAPRSF (U=Urgent, A=Ack, P=Push, R=Reset, S=Sync, F=Fin) | TCP header |
49-50 | Window | TCP Window (for flow control) | TCP header |
51-52 | Checksum | Checksum for header and data | TCP header |
53-54 | Urgent | Urgent pointer | TCP header |
55 to N | DATA | TCP Data | Data Payload |
N+1 | FCS | CRC (4 byte) | Ethernet Header |