Computer Network-IP Datagram Header

Insert picture description here
The IP datagram consists of two parts: the header (header) and the data.
The header can be divided into:
fixed part/fixed length part (20 bytes) + optional part/variable length part (40 bytes);
Note:
(1) Each line in the figure consists of 32 bits/bit (4 bytes) byte), each cell is called a field/field;
(2) The number in parentheses indicates the number of bits occupied.
Explanation:
1. Version: occupies 4 bits;
2. Header length field: occupies 4 bits, the value is in the unit of 4 bytes (that is, it can only be a multiple of 4), and the minimum decimal number is 5 (5x4= 20 bytes), the IP datagram header has only a 20-byte fixed part; the maximum decimal value is 15 (15x4=60 bytes), which means that the IP datagram header contains a 20-byte fixed part and a maximum of 40-byte variable part .
3. Optional fields/options: The length ranges from 1 byte to 40 bytes , used to support troubleshooting, measurement and security measures (optional fields increase the function of IP datagrams, and also make IP The length of the header of the datagram becomes variable, which increases the cost of each router to process IP datagrams, so it is rarely used in practice).
4. Padding field: ensure that the header length is an integer multiple of 4 bytes (because the optional field length ranges from 1 to 40), use all 0s for padding.
5. Differentiated services: 8 bits are used to obtain better services.
6. Total length: occupies 16 bits, indicating the total length of the IP datagram (header + data payload), the maximum value is 65535 in decimal, in bytes.
(According to the total length of the datagram and the length of the header, the length of the data part can be calculated.)
Data length = total length of the datagram = header length x4
7. Identification: 16 bits, used to provide uniqueness for the data of the data fragment Logo.
8. Flag: occupies 3 bits, used to indicate whether the IP datagram is allowed to be fragmented and whether it is the last one.
9. Fragment Offset / Fragment Offset: for 13-bit, which is described in the original datagram is fragmented datagram region it belongs offset , for each of the recombinant host for the purpose of fragmentation provide sequential basis. The offset is in units of 8 bytes (64 bits).
10. Time to live: occupies 8 bits, indicating the time to live of the datagram in the network.
11. Protocol: occupies 8 bits, determines the upper layer protocol of the datagram when sending, and indicates the protocol encapsulated by the IP datagram.
(IP uses the protocol number to specify the transmission protocol)
12. Header checksum: occupies 16 bits, and performs fault-tolerant check in the IP datagram header.
13. Source address: occupies 32 bits, indicating the IP address of the source host (the original sender ).
14. Destination address: occupies 32 bits, indicating the IP address of the destination host ( ultimate recipient ).

Guess you like

Origin blog.csdn.net/m0_46015143/article/details/105917341
Recommended