Computer Network-Understanding of IP Datagram Structure

Insert picture description here
Recently, the computer network has talked about the network layer, and the knowledge about the IP part is lacking, so I will record it here to strengthen my memory.

IP datagram structure issues

The structure diagram of the IP datagram is as follows:
Insert picture description here

1. Why the maximum length of the header is 60 bytes, and the total length is up to 2 16 − 1 2^{16}-12161 byte?

The unit of the header length field and the unit of the total length field are different.

  • The unit of the header length field is the number of rows of the IP datagram, which can represent 2 4 − 1 2^4-1241 row, that is, 15 rows. As can be seen from the figure, a row has 32 bits, that is, 4 bytes. Therefore, the maximum length of the header is 60 bytes.
  • The unit of the total length field is directly the number of bytes. This field occupies 16 bits. Therefore, the maximum value that can be represented is 2 16 − 1 2^{16}-12161 byte.

2. What do the logos and logos mean? ?

Translated in Chinese here, the meaning is very similar. It is better to look at English directly. The English of the logo is (identification), and the logo is flag. It can be seen that the identification (identification) is used to identify the identity, and the mark is the flag of something. After Shuo Wen Jie Zi is finished, let's take a look at the specific meaning.

  • Identification: Since identification is used to identify identity, what identity is it used to identify? We know that when a datagram exceeds the length limit (MTU), it must be fragmented. When multiple datagrams are assembled together, how to determine which fragment belongs to which datagram? This time we need to rely on our identity , and fragments from the same datagram have the same identity.
    So how can the same datagram have the same identity?
    At this time, the counter on the PPT wakes me up. The generator of the IP datagram will execute a counter. Each datagram has its own unique identifier .

  • Flag: This flag has only two meanings, which are used to mark MF and DF respectively. MF=1 means there are fragments after it, and MF=0 means the last fragment. When DF=0, fragmentation is allowed. The function of MF is equivalent to \0 in our string.
    At this time, a new problem arises again. IP datagram reception is not received in order, so how does it assemble different pieces together? At this time, you need to understand the film offset.

The example in the following PPT can actually help us understand the above concepts very well.
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43403605/article/details/109399356