Header fields in IPv4 datagram Flashcards
Identifies the version of IP used to generate the datagram. For IPv4, this is the number 4. This field ensures compatibility between devices that may be running different versions of IP. In general, a device running an older version of IP will reject datagrams created by newer implementations, under the assumption that the older version may not be able to interpret the newer datagram correctly.
Version (4 bits)
Specifies the length of the IP header, in 32-bit words. This includes the length of any options fields and padding. The normal value of this field when no options are used is 5 (5 32-bit words = 5*4 = 20 bytes).
Internet Header Length (IHL) (4 bits)
A field designed to carry information to provide quality-of-service features, such as prioritized delivery for IP datagrams. This had not been as widely used as originally defined, and its meaning had been redefined for use by a technique called Differential Services (DS).
Type of Service (ToS) (8 bits)
Specifies the total length of the IP datagram, in bytes. Since this field is 16 bits wide, the maximum length of an IP datagram is 65,535 bytes, though most are much smaller.
Total Length (TL) (16 bits)
This field contains a 16-bit value that is common to each of the fragments belonging to a particular message; for datagrams originally sent un-fragmented, it is still filled in so it can be used if the datagram must be fragmented by a router during delivery. The recipient uses this field to reassemble messages without accidentally mixing fragments from different messages. This is needed because fragments may arrive from multiple messages mixed together, since IP datagrams can be received out of order from any device.
Identification (16 bits)
Three of these exist, two of which are used to manage fragmentation, and one that is reserved.
Flags (3 bits)
When fragmentation of a message occurs, this field specifies the offset, or position, in the message where the data in this fragment goes in units of eight bytes (64 bits). The first fragment has an offset of 0.
Fragment Offset (13 bits)
This specifies how long the datagram is allowed to live on the network, in router hops. Each router decrements the value of this field prior to transmitting it. If this field drops to zero, the datagram is assumed to have taken too long a route and is discarded.
Time To Live (TTL) (8 bits)
Identifies the higher-layer protocol (generally either a transport layer protocol or encapsulated network layer protocol) carried in the datagram.
Protocol (8 bits)
A checksum is computed over the header to provide basic protection against corruption in transmission. This is not the more complex cyclic redundancy check (CTC) code that’s typically used by data link layer technologies such as Ethernet; it’s just a 16-bit checksum. It is calculated by dividing the header bytes into words (a word is two bytes) and then adding them together. Only the header is checksummed; not the data. At each hop, the device receiving the datagram does the same checksum calculation, and if there is a mismatch, it discards the datagram as damaged.
Header Checksum (16 bits)
This is the 32-bit IP address of the originator of the datagram. Note that even though intermediate devices such as routers may handle the datagram, they do not normally put their address in this field – the address is always that of the device that originally sent the datagram.
Source Address (32 bits)
This is the 32-bit IP address of the intended recipient of the datagram. Again, even though devices such as routers may be the intermediate targets of the datagram, this field is always used to specify the ultimate destination.
Destination Address (32 bits)
One or more of several types of options may be included after the standard headers in certain IP datagrams.
Options (Variable)
If one or more options are included, and the number of bits used for them is not a multiple of 32, enough 0 bits are added to make the header length to a multiple of 32 bits.
Padding
This is the data that will be transmitted in the datagram. It is either an entire higher-layer message or a fragment of one.
Data (Variable)