Section G.1. IP Datagram Header

This description is taken from pages 11 to 15 of RFC 791, Internet Protocol.

Internet Header Format 

                                     

    0                   1                   2                   3    

    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1  

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 

   |Version|  IHL  |Type of Service|          Total Length         | 

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 

   |         Identification        |Flags|      Fragment Offset    | 

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 

   |  Time to Live |    Protocol   |         Header Checksum       | 

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 

   |                       Source Address                          | 

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 

   |                    Destination Address                        | 

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 

   |                    Options                    |    Padding    | 

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 

 

  Version:  4 bits 

 

    The Version field indicates the format of the internet header.  

    This document describes version 4. 

 

  IHL:  4 bits 

 

    Internet Header Length is the length of the internet header in 32 

    bit words.  The minimum value for a correct header is 5. 

 

  Type of Service:  8 bits 

 

    The Type of Service indication the quality of service desired. 

    The meaning of the bits is explained below. 

 

      Bits 0-2:  Precedence. 

      Bit    3:  0 = Normal Delay,      1 = Low Delay. 

      Bits   4:  0 = Normal Throughput, 1 = High Throughput. 

      Bits   5:  0 = Normal Reliability 1 = High Reliability. 

      Bit  6-7:  Reserved for Future Use. 

 

         0     1     2     3     4     5     6     7 

      +-----+-----+-----+-----+-----+-----+-----+-----+ 

      |                 |     |     |     |     |     | 

      |   PRECEDENCE    |  D  |  T  |  R  |  0  |  0  | 

      |                 |     |     |     |     |     | 

      +-----+-----+-----+-----+-----+-----+-----+-----+ 

 

        Precedence 

 

          111 - Network Control 

          110 - Internetwork Control 

          101 - CRITIC/ECP 

          100 - Flash Override 

          011 - Flash 

          010 - Immediate 

          001 - Priority 

          000 - Routine 

 

  Total Length:  16 bits 

 

    Total Length is the length of the datagram, measured in octets  

    (bytes), including internet header and data. 

 

  Identification:  16 bits 

 

    An identifying value assigned by the sender to aid in assembling 

    the fragments of a datagram. 

 

  Flags:  3 bits 

 

    Various Control Flags.  The Flag bits are explained below: 

 

      Bit 0: reserved, must be zero 

      Bit 1: (DF) 0 = May Fragment,  1 = Don't Fragment. 

      Bit 2: (MF) 0 = Last Fragment, 1 = More Fragments. 

 

          0   1   2 

        +---+---+---+ 

        |   | D | M | 

        | 0 | F | F | 

        +---+---+---+ 

 

  Fragment Offset:  13 bits 

 

    This field indicates where in the datagram this fragment belongs. 

    The fragment offset is measured in units of 8 octets (64 bits). 

    The first fragment has offset zero. 

 

  Time to Live:  8 bits 

 

    This field indicates the maximum time the datagram is allowed to 

    remain in the internet system.  

 

  Protocol:  8 bits 

 

    This field indicates the Transport Layer protocol that the data 

    portion of this datagram is passed to.  The values for various 

    protocols are specified in the "Assigned Numbers" RFC. 

 

  Header Checksum:  16 bits 

 

    A checksum on the header only.  Since some header fields change 

    (e.g., time to live), this is recomputed and verified at each 

    point that the internet header is processed.  The checksum 

    algorithm is: 

 

      The checksum field is the 16 bit one's complement of the one's 

      complement sum of all 16 bit words in the header.  For purposes 

      of computing the checksum, the value of the checksum field is 

      zero. 

 

  Source Address:  32 bits 

 

    The source IP address.  See Chapter 2 for a 

    description of IP addresses. 

 

  Destination Address:  32 bits 

 

    The destination IP address.  See Chapter 2 for a description of IP 

    addresses. 

 

  Options:  variable 

 

    The options may or may not appear in datagrams, but they must be 

    implemented by all IP modules (host and gateways).  No options

    were used in any of the datagrams examined 



in Chapter 13.