1. Introduction to the IP Protocol
IP, short for Internet Protocol, functions at the network layer of the OSI model. It is responsible for ensuring data reaches the correct destination and managing routing. IP uses a connectionless transmission approach, meaning it transmits data packets independently without establishing a dedicated end-to-end connection. Regardless of the protocol utilized by the transport layer, data transmission and reception are dependent on IP.
IP provides a connectionless transmission mechanism, meaning each data packet on the network is treated as an independent unit. IP does not maintain the connection details between the server and the client.
IP cannot guarantee the reliability of data transmission. However, this does not mean that packets are ignored without any rule, but data loss occurs only when there’s a network failure.
Let’s introduce the format of an IP datagram:
The IP datagram format is shown in Figure 1,
- Version: The version of IP used for data transmission, 4 bits in size;
- Header Length: Specifies the length of the header;
- Service Type: Sets the priority or precedence of data transmission, 8 bits in size;
- Total Length: Indicates the total length of the datagram, with datagram total length = header length + data length, 16 bits in size;
- Identification: Identifies all the fragments, 16 bits in size;
- Fragment Flags: Determines whether a datagram can be fragmented and indicates if there are more fragments, 3 bits in size;
- Fragment Offset: Used by the destination computer to help locate the fragment’s position within the entire datagram, 13 bits in size;
- Time to Live: Sets the maximum number of routers the datagram can pass through. It is 8 bits long;
- Protocol: Specifies the upper-layer protocol used to create the data in the field, 8 bits in size;
- Checksum: Checks the integrity of transmitted data, 16 bits in size;
- Source Address: Source IP address, 32 bits in field length;
- Destination Address: Destination IP address, 32 bits in field length;
- Options: Not a required field, the field length depends on the IP options chosen;
- Data: Contains the data transmitted within the network, the IP datagram also includes header information of the upper layer protocol;
2. Detailed Decoding
Capture IP packets using Colasoft Network Analyzer for detailed decoding as shown in Figure 2,
(Figure 2 Detailed decoding of IP packets in Colasoft Network Analyzer)
Figure 2 shows the detailed decoding of IP packets in the Colasoft Network Analyzer. Now, let’s explain the decoding information of the IP packet:
Version: 4, indicating that the network currently uses IPv4;
Header Length: 4, indicating that the IP header length is 5×4=20 bytes;
Service Type: 0, indicating that the service type field is not used in the current IP packet;
Total Length: 40, indicating that the total length of the datagram is 40 bytes;
Identification: indicates the identification of this datagram as 0x41AB (hexadecimal);
Fragment Flags: The second bit is 1, indicating the datagram cannot be fragmented,
Fragment Offset: Since it is not fragmented, the fragment offset is 0;
Time to Live: Indicates that the datagram can pass through a maximum of 128 routers;
Upper Layer Protocol: 6 represents the TCP protocol;
Checksum: The checksum of the datagram is 0x36A8 (correct), indicating that the datagram is complete;
Source IP Address: 192.168.0.208;
Destination IP Address: 192.168.0.92;
Options: Indicates that there is no option field in the datagram;