|
IP packets consist of the data from upper
layers plus an IP header. The IP header consists of the following:
- Version – Indicates the version of
IP currently used; four bits. If the version field is different than
the IP version of the receiving device, that device will reject the
packets.
- IP header length (HLEN) – Indicates
the datagram header length in 32-bit words. This is the
total length of all header information, accounting for the two
variable-length header fields.
- Type-of-service (TOS) – Specifies the
level of importance that has been assigned by a particular
upper-layer protocol, eight bits.
- Total length – Specifies the length
of the entire packet in bytes, including data and header, 16 bits.
To get the length of the data payload subtract the HLEN from the
total length.
- Identification – Contains an integer
that identifies the current datagram, 16 bits. This is the sequence
number.
- Flags – A three-bit field in which
the two low-order bits control fragmentation. One bit specifies
whether the packet can be fragmented, and the other specifies
whether the packet is the last fragment in a series of fragmented
packets.
- Fragment offset – Used to help piece
together datagram fragments, 13 bits. This field allows the previous
field to end on a 16-bit boundary.
- Time-to-live (TTL) – A field
that specifies the number of hops a packet may travel. This number
is decreased by one as the packet travels through a router. When the
counter reaches zero the packet is discarded. This prevents packets
from looping endlessly.
- Protocol – indicates which
upper-layer protocol, such as TCP or UDP, receives incoming packets
after IP processing has been completed, eight bits.
- Header checksum – helps ensure IP
header integrity, 16 bits.
- Source address – specifies the
sending node IP address, 32 bits.
- Destination address – specifies the
receiving node IP address, 32 bits.
- Options – allows IP to support
various options, such as security, variable length.
- Padding – extra zeros are added to
this field to ensure that the IP header is always a multiple of 32
bits.
- Data – contains upper-layer
information, variable length up to 64 Kb.
While the IP source and destination
addresses are important, the other header fields have made IP very
flexible. The header fields are the information that is provided to
the upper layer protocols defining the data in the packet.
|