web analytics


  • Packets in the IPv4 layer are called datagrams.
  • A datagram is a variable-length packet consisting of two parts: header and data.
  • The IPv4 datagram format is below.
Version (VER) : 
  • 4-bit field defines the version of the IPv4 protocol
Header length (HLEN) : 
  • This 4-bit field defines the total length of the datagram header in 4-byte words. 
  • The length of the header is variable  i.e between 20 without options and 60 bytes with options. 
  • 8-bit field. 
  • It has two names  
    • Service type (Previously called)
    • now called Differentiated Services
  • Service Type
    • The first 3 bits are called precedence bits defines priority but never used.
    • The next 4 bits are called Type Of Service (TOS) bits, and the last bit is not used.
  • Application programs can request a specific type of service. The defaults for some applications are shown in Table
  • Differentiated Services
    • first 6 bits  – codepoint subfield
    • When the 3 rightmost bits are Os then the 3 leftmost bits are interpreted the same as the precedence bits in the service type interpretation.
    • When the 3 rightmost bits are not all Os, the 6 bits define 64 services based on the priority assignment by the Internet or local authorities according to Table 20.3

Total length

  • Length of data =total length – header length
  • The total length field defines the total length of the datagram including the header
  • used in fragmentation.
  • used in fragmentation (discussed in the next section).
Fragmentation offset
  • used in fragmentation 
Time to live 
  • Designed to hold a timestamp, which was decremented by each visited router.
  • The datagram was discarded when the value became zero.
  • Today used mostly to control the maximum number of hops (routers) visited by the datagram
  • Each router that processes the datagram decrements this number by 1.
  • If this value, after being decremented, is zero, the router discards the datagram.
  • This 8-bit field defines the higher-level protocol that uses the services of the IPv4 layer.
  • An IPv4 datagram can encapsulate data from several higher-level protocols such as TCP, UDP, ICMP, and IGMP. 
  • This field specifies the final destination protocol to which the IPv4 datagram is delivered

The value of this field for each higher-level protocol is shown in Table below.


 The checksum concept and its calculation are discussed later in this chapter.

Source address

 This 32-bit field defines the IPv4 address of the source. 

 This field must remain unchanged during the time the IPv4 datagram travels from the source host to the destination host.

Destination address 

 This 32-bit field defines the IPv4 address of the destination.

 This field must remain unchanged during the time the IPv4 datagram travels from the source host to the destination host.

  • In IPv4, a datagram can be fragmented by the source host or any router in the path although there is a tendency to limit fragmentation only at the source. 
  • The reassembly of the datagram, however, is done only by the destination host because each fragment becomes an independent datagram.
  • Fields Related to Fragmentation
    • Identification
    • Flags
    • Fragmentation Offset Fields
  • Identification 
    • This 16-bit field identifies a datagram originating from the source host.
  • Flags
    • This is a 3-bit field. 
    • The first bit is reserved. 
    • The second bit is called the do not fragment bit.
  • Fragmentation offset
    • This 13-bit field shows the relative position of this fragment with respect to the whole datagram. 
    • It is the offset of the data in the original datagram measured in units of 8 bytes.


  • The header of the IPv4 datagram is made of two parts: 
    • a fixed part and
    • a variable part.
  • The fixed part is 20 bytes long and
  • The variable part comprises the options that can be a maximum of 40 bytes.
  • Used for network testing and debugging. 
  • the taxonomy of options in Figure 20.14 

No Operation

  • A no-operation option is a 1-byte option used as a filler between options.

End of Option

  • An end-of-option option is a 1-byte option used for padding at the end of the option field. 
  • It, however, can only be used as the last option.

Record Route

  • A record route option is used to record the Internet routers that handle the datagram.
  • It can list up to nine router addresses. 
  • It can be used for debugging and management purposes.

Strict Source Route

  • A strict source route option is used by the source to predetermine a route for the datagram as it travels through the Internet. 
  • Dictation of a route by the source can be useful for several purposes.

Loose Source Route

  • A loose source route option is similar to the strict source route, but it is less rigid. 
  • Each router in the list must be visited, but the datagram can visit other routers as well.
  • A timestamp option is used to record the time of datagram processing by a router.
  • The time is expressed in milliseconds from midnight, Universal time, or Greenwich Mean Time.

Related Posts

Leave a Reply

Your email address will not be published.