What Is a Packet and What Does It Look Like?
Regardless of their architecture, topology, and the protocol used, networks are built for one primary purpose: to share information and resources. In most cases the information must be divided in separate, smaller pieces before it can be transmitted over a network. Those smaller, individual pieces are called packets. Each protocol has its own definition of a packet: how one is created, how long it can be, what type of information is contained in it, and so on. To better illustrate, this section examines the packets used by the most common protocol, IP. IP packets are often also referred to as datagrams.
As shown in Figure 3.5, IP packets have two main sections: the header and the data section (sometimes called the payload). The header section contains all of the information needed to describe the packet:
What kind of packet it is (protocol version number)
How big the header of the packet is (packet header length)
How to handle this packet (type of service telling the network whether to use the following options: minimize delay, maximize throughput, maximize reliability, and minimize cost)
How big the packet is (overall length of packet; as this is a 16-bit field, the maximum size of an IP packet is 65,535 bytes, but in practice most packets are around 1,500 bytes)
A unique identifier so this packet can be distinguished from other packets
Whether this packet is part of a longer data stream and should be handled relative to other packets
A description of where this packet fits into the data stream relative to other packets (the fragment offset)
A checksum of the packet header (to minimize the potential for data corruption during transmission)
Where the packet is from (source IP address such as 10.10.10.5)
Where the packet is going (destination IP address such as 10.10.10.10)
Option flags governing security and handling restrictions, whether to record timestamps, whether to record the route this packet has taken, and whether to use strict or loose source routing
The information this packet carries
Figure 3.5 Format of an IPv4 packet.