IPv4 Packet Format:
IPv4 Packet Field Descriptions
- Version (4 bits)---Indicates the version of IP currently used (IPv4 → 0100 / IPv6 → 0110).
- IP Header Length (hlen) (4 bits) ---Indicates the datagram header length in 32-bit words.
- Type-of-Service (TOS) (8 bits)---Specifies how an upper-layer protocol would like a current datagram to be handled, and assigns datagrams various levels of importance. Note this is more recently referred to as the Differentiated Services (DS) field.
- Total Length (16 bits)---Specifies the length, in octets, of the entire IP packet, including the data and header.
- Identification (ID) (16 bits)---Contains an integer that identifies the current datagram. This field is used to help piece together datagram fragments, should they occur.
- Flags (3 bits)---Consists of a 3-bit field of which the two low-order (least-significant) bits control fragmentation.
- The left-most bit is reserved (and must be 0, i.e. MBZ).
- The middle bit specifies whether the packet can be fragmented (0 = may fragment, 1 = do not fragment).
- The right-most bit specifies whether the packet is the last fragment in a series of fragmented
packets (0 = last fragment, 1 = more fragments coming).
- Fragmentation Offset (13 bits)---Indicates the position of the fragment's data relative to the beginning of the data in the original datagram, which allows the destination IP process to properly reconstruct the original datagram.
- Time-to-Live (TTL) (8 bits)---Maintains a counter that gradually decrements down to zero, at which point the datagram is discarded. This keeps packets from looping endlessly.
- Protocol (8 bits)---Indicates which upper-layer protocol receives incoming packets after IP processing is complete.
- 1 = ICMP
- 2 = IGMP
- 6 = TCP
- 17 = UDP
- Header Checksum (16 bits)---Helps insure IP header integrity.
- Source Address (32 bits)---Specifies the IP address of the sending node.
- Destination Address (32 bits)---Specifies the IP address of the receiving node.
- Options---Allows IP to support various options, such as security.
- Data---Contains upper-layer information.