Internet Protocol
obsoletes
- rfc-760 — DoD standard Internet Protocol
updated by
- rfc-1349 — Type of Service in the Internet Protocol Suite
- rfc-2474 — Definition of the Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers
- rfc-6864 — Updated Specification of the IPv4 ID Field
also
- std-5
Extracted elements (30)
Each internet datagram is treated as a completely independent entity with no connection state. There are no virtual circuits. This makes routing decisions per-datagram and allows different paths through the internet, simplifying gateways and improving resilience.
IP provides no reliability, acknowledgment, flow control, or sequencing by design. These are intentionally left to higher-level protocols (such as TCP), keeping the IP layer minimal and allowing it to exploit whatever services each underlying network offers.
The 576-octet minimum reassembly datagram size was chosen to allow a 512-octet data block plus up to 64 octets of combined headers, accommodating a 60-octet maximum IP header and leaving room for higher-level protocol headers.
The header checksum intentionally does not cover the data payload. This allows applications that can tolerate occasional data bit errors but not retransmission delay (e.g., real-time voice) to use IP without being forced into data integrity checking at the network layer.
The TTL field is measured in seconds but in practice functions as a hop count because every forwarding module must decrement it by at least one regardless of actual processing time. This bounds the maximum datagram lifetime and prevents routing loops from keeping datagrams alive indefinitely.
Fragment data must be broken on 8-octet boundaries (except the last fragment). The 13-bit Fragment Offset field supports up to 8192 fragments of 8 octets each, for a theoretical maximum reconstructed payload of 65,536 octets consistent with the 16-bit Total Length field.
Implementations must be conservative in sending and liberal in receiving: send only well-formed datagrams, but accept any datagram that can be interpreted, not objecting to technical errors where the meaning remains clear. This Robustness Principle is load-bearing for interoperability across independently developed implementations.
All hosts must be prepared to accept datagrams of up to 576 octets, whether arriving whole or in fragments. It is recommended that hosts send datagrams larger than 576 octets only if they have assurance the destination can accept them.
Every internet destination must be able to receive a datagram of 576 octets either in one piece or as reassembled fragments.
Every internet module must be able to forward a datagram of 68 octets without further fragmentation, since an internet header may be up to 60 octets and the minimum fragment is 8 octets.
Every module that processes a datagram must decrease the TTL by at least one, even if it processes the datagram in less than a second. If TTL reaches zero, the datagram must be destroyed.
If a datagram marked with the Don't Fragment (DF) bit cannot be delivered to its destination without fragmentation, it must be discarded rather than fragmented.
IP options must be implemented by all IP modules (hosts and gateways); their presence in any particular datagram is optional, but every module must be able to parse and act on every option. The Security option is required when classified, restricted, or compartmented traffic is passed.
The internet header checksum must be recomputed whenever the internet header changes, such as when the TTL is decremented, options are modified, or fragmentation occurs.
The internet module must verify that the source address supplied in a SEND call is one of the legal addresses for the sending host; multi-homed hosts may have multiple legal source addresses.
IPv4 addresses are fixed 32-bit values in three classes: Class A (bit 0 = 0, 7-bit network, 24-bit host), Class B (bits 0-1 = 10, 14-bit network, 16-bit host), Class C (bits 0-2 = 110, 21-bit network, 8-bit host). The 111 prefix is reserved for extended addressing mode.
The Header Checksum is the 16-bit one's complement of the one's complement sum of all 16-bit words in the header, with the checksum field treated as zero during computation. It protects only the header; the data portion has no IP-level error check.
The Identification field (16 bits) is set by the originating module to a value unique for the source-destination-protocol triple for the datagram's active lifetime, enabling reassembly logic to associate fragments with the correct original datagram.
The Protocol field (8 bits) identifies the next-layer protocol carried in the datagram payload (e.g., ICMP=1, TCP=6, UDP=17), with specific values assigned in 'Assigned Numbers'. It also serves as part of the fragment reassembly key.
Source Routing options (LSRR and SSRR) allow a datagram originator to dictate the forwarding path; SSRR requires each hop to be on a directly connected network, while LSRR permits intermediate hops. These features can be used to bypass routing controls or reach otherwise-inaccessible hosts.
The Security option (Type=130) enables DoD hosts to attach classification levels (Unclassified through Top Secret), compartmentation codes, and handling restriction markings to datagrams. Networks handling classified traffic are responsible for controlling access to and use of high-precedence and security designations.
IP fragmentation procedure: if TL <= MTU, submit datagram for forwarding; if DF=1, discard; otherwise split on an 8-octet boundary — first fragment gets MF=1 with original FO, remainder gets FO incremented by NFB and inherits original MF. Options not flagged for copying are omitted from the remainder fragment. Procedure recurses on the remainder.
IP reassembly procedure: fragments are keyed by (source, destination, protocol, identification). Received data is placed in a buffer at the position indicated by FO*8. A fragment block bit table tracks received coverage. When MF=0 is received and the entire bit range is set, the datagram is forwarded. A reassembly timer (recommended initial: 15 seconds) releases buffer resources on expiry.
Loose Source and Record Route (LSRR, Type=131) and Strict Source and Record Route (SSRR, Type=137) options contain a length octet, a pointer to the next address to process, and a series of 32-bit internet addresses. The current destination is replaced by the next route address at each hop and the recorded address written in its place.
The Flags field is 3 bits: bit 0 reserved (must be zero), bit 1 is DF (Don't Fragment), bit 2 is MF (More Fragments). The Fragment Offset field is 13 bits measured in units of 8 octets; the first fragment has offset zero.
The Internet Timestamp option (Type=68, max length 40) contains a Pointer, 4-bit Overflow count, 4-bit Flag (0=timestamps only, 1=address+timestamp pairs, 3=prespecified addresses), and 32-bit timestamps in milliseconds since midnight UT. High-order bit set indicates non-standard time source.
The IPv4 header contains: Version (4 bits), IHL (4 bits, minimum 5), Type of Service (8 bits), Total Length (16 bits), Identification (16 bits), Flags (3 bits), Fragment Offset (13 bits), TTL (8 bits), Protocol (8 bits), Header Checksum (16 bits), Source Address (32 bits), Destination Address (32 bits), followed by variable-length Options padded to a 32-bit boundary.
The Record Route option (Type=7) contains a length, a pointer, and a pre-allocated area for recording 32-bit internet addresses inserted by each forwarding module. The option size does not change; if full, the datagram is forwarded without recording but no error is raised unless there is partial space.
The Security option (Type=130, Length=11) carries a 16-bit Security classification field (16 levels including Unclassified, Confidential, Secret, Top Secret), a 16-bit Compartments field, a 16-bit Handling Restrictions field, and a 24-bit Transmission Control Code (TCC) for DoD closed user group segregation. Must be copied on fragmentation.
The Type of Service field (8 bits) encodes Precedence in bits 0-2 (8 levels: Routine through Network Control), Delay in bit 3, Throughput in bit 4, Reliability in bit 5, with bits 6-7 reserved for future use.