IP is a Network layer (Layer 3) protocol that contains addressing information and some control information that enables packets to be routed. IP is documented in RFC 791 and is the primary network layer protocol in the Internet protocol suite.
IP header format:
Version: 4 bits: The Version field indicates the format of the internet header.
IHL : 4 bits : Internet Header Length is the length of the internet header in 32 bit words (4 bytes) , and thus points to the beginning of the data. Note that the minimum value for a correct header is 5 (min 4*5 = 20 bytes).
Type of Service (ToS): 8 bits : The 8-bit ToS uses 3 bits for IP Precedence, 4 bits for ToS with the last bit not being used. The 4-bit ToS field, although defined, has never been used.
- IP Precedence— A 3-bit field used to identify the level of service a packet receives in the network.
- Differentiated Services Code Point (DSCP)—A 6-bit field used to identify the level of service a packet receives in the network. DSCP is a 3-bit expansion of IP precedence with the elimination of the ToS bits.
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.
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.
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”
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.
Source Address: 32 bits : Source IP address of the device which originated the datagram.
Destination Address: 32 bits : Destination IP address of the device for which datagram is destined to.
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
Let us review the IP header fields in the below capture:
- Fragment offset is zero which means it is the first fragment and as the flag bits are also zero, the packet is not fragmented.
- Protocol is ICMP (1) which says that this packet contains data related to ICMP.
- Identification field identifies the packet that sender transmitted. In case of fragmentation, ID field is same for all the fragments.
The internet protocol implements two basic functions:
- Addressing : The internet modules use the addresses carried in the internet header to transmit internet datagrams toward their destinations. The selection of a path for transmission is called routing.
- Fragmentation : In the routing of messages from one internet module to another, datagrams may need to traverse a network whose maximum packet size is smaller than the size of the datagram. To overcome this difficulty, a fragmentation mechanism is provided in the internet protocol.
To be continued...