Skip to main content

3. Specification

This chapter provides the complete specification of the Internet Protocol (IP), including the header format, detailed field descriptions, operational procedures, and interface definitions.

3.1. Internet Header Format

A summary of the contents of the internet header follows:

 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 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Example Internet Datagram Header (Figure 4)

Note that each tick mark represents one bit position.

Field Descriptions

Version: 4 bits

The Version field indicates the format of the internet header. This document describes version 4.

IHL (Internet Header Length): 4 bits

Internet Header Length is the length of the internet header in 32-bit words, and thus points to the beginning of the data. Note that the minimum value for a correct header is 5.

Type of Service: 8 bits

The Type of Service provides an indication of the abstract parameters of the quality of service desired. These parameters are to be used to guide the selection of the actual service parameters when transmitting a datagram through a particular network.

Bits 0-2:  Precedence
Bit 3: 0 = Normal Delay, 1 = Low Delay
Bit 4: 0 = Normal Throughput, 1 = High Throughput
Bit 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 Values:

  • 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, including internet header and data. This field allows the length of a datagram to be up to 65,535 octets. All hosts must be prepared to accept datagrams of up to 576 octets. It is recommended that hosts only send datagrams larger than 576 octets if they have assurance that the destination is prepared to accept the larger datagrams.

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.

  • 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

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. If this field contains the value zero, then the datagram must be destroyed. This field is modified in internet header processing. The time is measured in units of seconds, but since every module that processes a datagram must decrease the TTL by at least one even if it process the datagram in less than a second, the TTL must be thought of only as an upper bound on the time a datagram may exist.

Protocol: 8 bits

This field indicates the next level protocol used in the data portion of the internet datagram. The values for various protocols are specified in "Assigned Numbers" [9].

Common values:

  • 1 = ICMP
  • 6 = TCP
  • 17 = UDP

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 address.

Destination Address: 32 bits

The destination address.

Options: variable

The options may appear or not in datagrams. They must be implemented by all IP modules (host and gateways). What is optional is their transmission in any particular datagram, not their implementation.


3.2. Discussion

Addressing

To provide for flexibility in assigning address to networks and allow for the large number of small to intermediate sized networks, the interpretation of the address field is coded to specify a small number of networks with a large number of hosts, a moderate number of networks with a moderate number of hosts, and a large number of networks with a small number of hosts.

Address Formats:

High Order BitsFormatClass
07 bits of net, 24 bits of hosta
1014 bits of net, 16 bits of hostb
11021 bits of net, 8 bits of hostc
111escape to extended addressing mode-

Fragmentation and Reassembly

The internet identification field (ID) is used together with the source and destination address, and the protocol fields, to identify datagram fragments for reassembly.

The More Fragments flag bit (MF) is set if the datagram is not the last fragment. The Fragment Offset field identifies the fragment location, relative to the beginning of the original unfragmented datagram. Fragments are counted in units of 8 octets.

Every internet module must be able to forward a datagram of 68 octets without further fragmentation. This is because an internet header may be up to 60 octets, and the minimum fragment is 8 octets.

Every internet destination must be able to receive a datagram of 576 octets either in one piece or in fragments to be reassembled.


3.3. Interfaces

The functional description of user interfaces to the IP is, at best, fictional, since every operating system will have different facilities. However, all IPs must provide a certain minimum set of services to guarantee that all IP implementations can support the same protocol hierarchy.

An Example Upper Level Interface

The following two example calls satisfy the requirements for the user to internet protocol module communication ("=>" means returns):

SEND

SEND (src, dst, prot, TOS, TTL, BufPTR, len, Id, DF, opt => result)

where:

  • src = source address
  • dst = destination address
  • prot = protocol
  • TOS = type of service
  • TTL = time to live
  • BufPTR = buffer pointer
  • len = length of buffer
  • Id = Identifier
  • DF = Don't Fragment
  • opt = option data
  • result = response
    • OK = datagram sent ok
    • Error = error in arguments or local network error

RECV

RECV (BufPTR, prot, => result, src, dst, TOS, len, opt)

where:

  • BufPTR = buffer pointer
  • prot = protocol
  • result = response
    • OK = datagram received ok
    • Error = error in arguments
  • len = length of buffer
  • src = source address
  • dst = destination address
  • TOS = type of service
  • opt = option data

Summary

This specification defines the Internet Protocol version 4 (IPv4), which provides:

  • Connectionless datagram delivery
  • Best-effort service (no reliability guarantees)
  • Fragmentation and reassembly capabilities
  • Addressing for up to 2^32 hosts
  • Routing through interconnected networks
  • Type of Service indication
  • Time to Live management
  • Options for special handling

The protocol is designed to be simple, scalable, and flexible, enabling the Internet to support diverse applications and network technologies.

For complete details on all IP options, fragmentation procedures, reassembly algorithms, and implementation requirements, please refer to the full text of RFC 791.


Note: This is a condensed version of RFC 791 Section 3. For the complete specification including detailed option formats, fragmentation/reassembly pseudocode, and all edge cases, consult the official RFC 791 document.