Brief description of IP datagram format

Source: Internet
Author: User

Datagram plays a very important role in the Internet. In order to improve the internal functions of network programming, it is necessary to gain a deeper understanding of IP datagram.

Version: The four digits indicate the Protocol version used by the datagram. You can use the vro version to determine how to interpret the rest of the IP datagram.

Header Length: Because IPv4 datagram can contain some optional items (included in the datagram header), you need to use these four digits to determine where the data part of the IP datagram actually starts.

Service type: the service type allows different types of IP data to be differentiated from each other. For example, real-time datagram (IP phone number, etc.) and non-real-time traffic (FTP) are separated.

Datagram length: the total length of the IP datagram (header + data), in bytes. This field is 16 characters in length, so the theoretical maximum length of IP datagram is 65 535 bytes. However, there are few more than 1500 bytes of data.

Identifier, flag, and slice offset: these three fields are related to IP fragment. IPv6 cannot be sharded on a vro.

Lifetime: Time-to-live, TTL field is used to ensure that the datagram will not always cycle on the network. Each time a router passes through, this field value is reduced by one. If the field is reduced to 0, the datagram must be discarded.

Protocol: this field is used only when an IP datagram reaches its final destination. This field specifies the transport layer protocol to which the IP data part should be handed over.

First check: the first check is used to help the router detect the bit errors in the IP datagram. The first check and calculation: each two bytes in the first are treated as a number, and the inverse code is used to sum the numbers. The anti-code of this sum is stored in the test and field. The router calculates the first check for each received IP datagram and checks whether an error occurs based on the test carried in the Data header and the calculated test. Routers generally discard the detected data packets.

Source and Destination IP addresses: when the source host generates a data report, it inserts its IP address in the source IP field and the destination IP address in the destination IP field. The destination address is usually determined by the source host through DNS lookup.

Option: The option field allows expansion of the IP header. IPv6 is no longer used.

Data: The data field contains the transport layer packet segment (TCP or UDP) to be delivered to the destination ). Data fields can also carry other types of data (ICMP packet segments ).

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.