IP protocol Detailed

Source: Internet
Author: User

This article is reproduced from the blog post agreement Forest 05 I try (IP protocol detailed). This blog post is very interesting, special reprint!

Comparison of IPv4 and IPv6 head

We have already introduced in the IP relay, an IP packet is divided into the header (header) and the data (Payload/data) two parts. The head is the additional information necessary to implement IP communication, and the data is the information to be transmitted by IP communication.

  

   Yellow area (region with the same name)

We see that three yellow areas span the IPv4 and IPV6. Version (4-bit) is used to indicate IP protocol versions, IPV4 or IPV6 (IPv4, version=0100; IPV6, version=0110). The Source adrresss and destination address are the IP addresses of the issuing and destination respectively.

Blue Area (the area of the name change)

Time to Live Lifetime (Hop Limit in IPv6). Time to live initially represents the maximum lifetime of an IP packet: If the IP packet is in transit longer than live, the IP packet is invalidated. Later, this area of IPv4 records an integer (such as 30), indicating that the IP packet relay process up to 30 route relay, if more than 30 routing relay, then this IP packet is void. IP packets each pass through a router, the router will give time to live minus one. When a router discovers that time to live is 0 o'clock, the IP packet is no longer sent. The Hop limit zone in IPv6 also records the maximum number of routing relays, which is the same as the IPV4 function. Time to Live/hop limit avoids the infinite relay of IP packets in the Internet.

Type of service (traffic Class in IPv6). The Type of service is initially used to prioritize IP packets, such as voice calls that require real-time, so its IP packets should have a higher priority than the IP packets of the Web service. However, this initial good idea was not adopted by Microsoft. The IP packets generated under Windows are the same highest priority, so in the case of Linux and Windows hybrid networks, the IP transport of Linux is slower than Windows (just because Linux is more disciplined!). )。 Later, the Type of service was actually divided into two parts: differentiated Service Field (DS, top 6) and explicit congestion Notification (ECN, 2-bit), The former is still used to differentiate service types, while the latter is used to indicate traffic conditions routed by IP packet routes. IPV6 's traffic class is also divided into two parts. The idea of providing different services through IP packets, and the notion of different optimizations for services, has been taking place for a long time, but the practice does not form a recognized agreement. such as the ECN area, which is used to indicate the traffic condition of the IP packet passing through the path. If the receiver receives an ECN area showing a very congested path, the receiver should make an adjustment. In practice, however, many recipients ignore the information that the ECN contains. Traffic control is often implemented by higher-level, such as the TCP protocol.

Protocol protocol (Next Header in IPv6). Protocol is used to describe the protocol that the IP packet payload part follows, that is, what the protocol on top of the IP packet is. It illustrates what the IP packet encapsulates as a high-level protocol packet (TCP? UDP?).

Total length, and the discussion of payload Length in IPV6 are to be put together with the IHL area, which we are about to discuss.

Red Area (the area removed in IPv6)

Let's take a look at the length information of IPv4 and IPV6. IPv4 the length of the head. At the end of the head is the options. Each option has 32 bits and is an optional area. A IPv4 head can have no options area at all. Regardless of options, the entire IPv4 head has a bytes (4 bytes per action). However, due to the existence of options, the overall length of the head is variable. We use the IHL (Internet Header length) to record the total length of the head, and to record the length of the entire IP packet with the full length. IPV6 has no options, its head is fixed length of bytes, so IHL area is not needed in IPv6. Payload length is used to represent the lengths of the data portion of the IPV6. The entire IP packet is bytes + Payload Length.

There is also a header checksum area in the IPv4. This checksum is used to verify the header information of the IP packet. The checksum is not the same as the CRC algorithm mentioned earlier in the trumpet. IPv6 There is no checksum area. The validation of the IPV6 package relies on a high-level protocol to complete, with the benefit of eliminating the time required to perform the checksum checksum and reducing network latency (latency).

identification, flags, and fragment offset, these three packages are for fragmentation (fragmentation) services. Fragmentation means that a router splits the received IP packets into multiple IP packet transfers, and the routers or hosts that receive these "fragments" need to regroup the fragments (reassembly) into an IP packet. The Maximum transmission unit (MTU, Maximum Transportation unit) supported by different LANs is different. If the size of an IP packet exceeds the MTU supported by the local area network, it is necessary to fragment the transmission when entering the LAN (as if the dough is too large to be broken into a bowl). Fragmentation can put a heavy burden on routers and networks. It is best to avoid fragmentation by detecting the size of the smallest MTU,IP packet on the entire path before the IP packet is emitted, without exceeding the minimum MTU. The IPV6 is designed to avoid fragmentation. The MTU of each IPV6 LAN must be greater than or equal to bytes. The default send IP packet size for IPv6 is bytes.

  

Painful fragmentation.

   Green Zone (IPv6 new area)

The Flow label is the new area in IPv6. It is used to remind the router to reuse the previous relay path. This allows the IP packet to automatically maintain the order of departure. This is useful for applications such as streaming media. Further use of the Flow label is still under development.

"I tried."

IP protocol is a loose network when it is generated, which is connected by each university's local area network and maintained by a group of geek that meet the scale. So the IP protocol thinks its environment is unreliable (unreliable): Things like broken routers, lab fires, a PhD kicking off a cable can happen at any time.

  

A network that is not reliable

In such a dangerous environment, the IP protocol delivers only the "I Try" (best effort) type. So-called "I try my best", the subtext is that if things go wrong don't blame me, I just promised to try, but there is no guarantee. So, if there is an error in the IP packet transmission (such as checksum, such as traffic is too busy, such as more than time to Live), according to the IP protocol, your IP packet will be discarded directly. Game over, there will be no further effort to fix the error. Best effort keeps the IP protocol in a very simple form. More quality control is given to high-level protocols, and the IP protocol is only responsible for efficient transmission.

(How irresponsible the postal system)

"Efficiency first" is also reflected in the order of IP packets. The IP protocol does not guarantee the order in which IP packets arrive, even if the origin and destination remain the same. We already know that the IP relay is based on routing table to determine the relay route. If the routing table update (for example, a new shortcut appears) during a continuous IP packet transmission, then the IP packet is chosen to take a different relay route. If the new path is transferred faster, then the IP packets that are emitted are likely to come first. It's like a multi-lane highway, where every car keeps changing lanes and eventually all the lanes are crammed with cars. This will allow the maximum utilization of the highway.

  

Queue

The flow label in IPV6 can advise the router to keep some IP packets in the same relay path. However, this is only a "recommendation" and the router may ignore the recommendation.

Header Checksum algorithm

The Header checksum area has 16 digits. It is obtained from the header to obtain 0/1 sequences other than checksum, such as:

9194 8073 0000 4000 4011 C0A8 0001 c0a8 00c7 (hex hex, this is a header designed to demonstrate the operation process)

Splits the entire sequence by 16-bit (that is, 4-bit hex). Adds the cumulative sum of the 4-bit hex pieces after the split. If more than 16 digits appear, the rounding is added to the last 16-bit result:

  Binary                Hex  1001000110010100      9194 1000000001110011       8073  ----------------10001001000000111     11207+                1   ----------------  0001001000001000      1208

The above calculation is called one ' s complement sum. All 16 digits are calculated and

One ' s complement sum (4500, 0073, 0000, 4000, 4011, C0A8, 0001, c0a8, 00c7) = 1433

Then, take each of the 1433 (0->1, 1->0), get the CHECKSUM:EBCC

In this way, our header is:

9194 8073 0000 4000 4011 EBCC c0a8 0001 c0a8 00c7

The receiver of the IP packet, after receiving the IP packet, can ask for each of the above 16-digit one's complement sum, which should be FFFF. If it is not FFFF, then the header is incorrect and the entire IP packet is discarded.

(Again, the IP header used by the example is not the actual header, it is just the function of the demo algorithm)

Summarize

The formation of each network protocol has its historical reasons. The IP protocol, for example, is designed to connect disparate lab networks together. Because of the small network at that time, the total address of IPv4 (IPv4 generation and 70 's) was 4 billion. Although it was thought to be a big number, the digital wave quickly brought an address depletion crisis. The main purpose of IPV6 is to increase the address capacity of the IPv4, but at the same time improve it based on the experience of the IPV4 and the technological advances of the new era, such as avoiding fragmentation, such as cancelling checksum (due to the widespread use of TCP in high-level protocols). The network protocol is not technically complex, and more considerations are policy.

IP protocol is "best Effort" type, IP transmission is unreliable. However, this design achieves the efficiency of the IP protocol.

IP protocol Explanation (RPM)

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.