IP datagram format

Source: Internet
Author: User

1. IP datagram format

2.

(1) version

The version of the IP protocol. Both parties must use the same IP protocol version. Recently, the widely used IP protocol version is 4 (IPv4 ). IPv6 is still in its infancy.

(2) Header Length

The maximum decimal value that can be expressed is 15. Note that the unit of the number expressed by the header length field is 32 characters (the length of one 32-bit character is 4 bytes). Therefore, the minimum value of the header length field is 5 (0101), which is equivalent to 5 × 4 = 20 bytes of the IP header length. When the header length is 1111 (that is, decimal 15 ), that is, 60 bytes. when the length of the IP Group's header is not an integer multiple of 4 bytes, it must be filled with the last filling Field. Therefore, the data always starts at an integer multiple of 4 bytes, which makes it easier to implement the IP protocol. The disadvantage of the header length limit of 60 bytes is that it may not be enough. The purpose is to minimize the overhead. The most common header length is 20 bytes (that is, the header length is 0101), and no option is used.

(3) Differentiated Services

Eight Places for better services. This field is called a service type in the old standard, but it has never been used. In 1998, IETF renamed this field differentiatedservices ). This field takes effect only when differentiated services are used.

(4) total length

The total length refers to the length of the sum of capital and data, in bytes. Because the total length field is 16 bits, the maximum length of the datagram is 2 ^ 16-1 = 65 535 bytes. Each data link layer under the IP layer has its own frame format, including the maximum length of the data field in the frame format, that is, the maximum transmission unit MTU (maximum transfer unit ). When a datagram is encapsulated as a link layer frame, the total length of the datagram (that is, the header plus the data part) must not exceed the MTU value of the following data link layer.

(5) Identification

16. The IP software maintains a counter in the memory. Each time a datagram is generated, the counter is incremented by 1 and the value is assigned to the identification field. However, this "ID" is not a serial number, because the IP address is a connectionless service, and the datagram is not received in order. When a datagram must be sharded because its length exceeds the MTU of the network, the value of this identification field is copied to all the identification fields of the datagram. The value of the same identification field enables the parts of the datagram to be correctly reloaded into the original datagram.

(6) Flag

Three, but currently only two are meaningful.

The watermark bit in the flag field is marked as MF (more fragment ). Mf = 1 indicates the datagram with "sharding. Mf = 0 indicates that this is the last of several datagram slices.

The one in the middle of the sign field is marked as DF (don't fragment), meaning "fragment is not allowed ". Fragment is allowed only when df = 0.

(7) slice offset

Takes 13 places. After a long group is split, a part is located in the relative position of the original group. That is to say, where the starting point of the user data field starts from. The part offset is in 8 bytes. This means that the length of each part must be an integer multiple of 8 bytes (64-bit.

(8) survival time

TTL (time to live), which represents the lifetime of a datagram in the network. Set this field by the source point of the sent datagram. The purpose is to prevent undeliverable data packets from entering the Internet without restrictions, so network resources are consumed in vain. The initial design was to use seconds as the unit of TTL. Each time a router passes through, the TTL is subtracted from the time the datagram is consumed by the router. If the time consumed by the data packet on the vro is less than 1 second, the TTL value is reduced by 1. When the TTL value is 0, the datagram is discarded.

(9) Protocol

The protocol field indicates the protocol used for the data carried by the datagram, so that the IP layer of the target host can know which processing process the data part should be handed over.

Protocol name ICMP IGMP IP TCP EGP IGP UDP IPv6 ESP OSPF
Protocol Field Value 1 2 4 6 8 9 17 41 50 89

(10) First inspection

16. This field only checks the header of the datagram, but does not include the data part. This is because every time a datagram passes through a vro, it must re-calculate the capital inspection and (some fields, such as the survival time, logo, and slice offset, may change ). If the data is not verified, the computing workload can be reduced.

(11) Source Address

32

(12) Destination Address

32

 

Header Length20 bytes = (4 + 4 + 8 + 16 + 16 + 3 + 13 + 8 + 8 + 16 + 32 + 32)/8 = 160/8 bytes

 

 

 

 

 

 

 

 

 

 

 

IP datagram format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.