Graduation Design path (4)-ipprotocol

Source: Internet
Author: User

Continue to look at concepts.

IP protocol

The IP protocol is the core of the TCP/IP protocol stack. It provides services such as data transmission, encapsulation of multiple upper-layer protocols, routing and transmission information, and information reporting and exchange technologies.

The following describes the services.

  • Data Transmission: The IP protocol provides a connectionless and unreliable data transmission. It cannot guarantee that the other party can receive the data successfully, nor maintain the continuity between the front and back of the data, that is, the data is not sorted. The IP protocol has nothing to do with the underlying link layer protocol or the physical layer. During the transmission process, the IP protocol also supports segmentation and re-Assembly. For example, if the IP packet length is greater than MTU, you can use the IP packet segmentation method for cross-media transmission.
  • Encapsulate multiple upper-layer protocols: The IP protocol is the carrier of the upper layer protocol. TCP, UDP, ICMP, IGMP and other protocols are transmitted in the form of IP packets. Each IP packet can only contain one upper-layer protocol, and one message in the header of the IP packet is the type of the Upper-layer protocol. The same protocol is always used for data exchange between connected nodes, so you do not need to specify the source and target protocols.
  • Provide routing and transmission information: The IP protocol is a routing protocol. The IP header contains information for transmitting information, such as the destination IP address and source IP address, because the IP address contains information such as the network address and node address, therefore, it can realize data transmission and routing in a very good way. In addition, it also has the information about the number of routes-the survival time, which is used to limit the number of routes.
  • Information Exchange Technology: The IP address may report the route. There may be several paths from node 1 to node 2. The data sent from node 1 to node 2 may arrive at different times, but the order is messy. In this case, the combination of the IP router and the ICMP protocol can reduce this problem. The ip mtu is related to the underlying protocol. For example, the Ethernet protocol is 1500 bytes, The FDDI protocol is 4352 bytes, and the frame relay protocol is 1600 bytes. During cross-media transmission, IP addresses can be transmitted in segments, that is, when large MTU to small MTU are transmitted over the network, IP addresses of large MTU are divided into several small mtu ip addresses for transmission. Because segment transmission occupies a lot of resources, it is basically not used in embedded applications. The general method is to set the MTU value to a small value so that it can be used in any network interface protocol.
  • IP Datagram: IP packets are composed of headers and loads. The header length ranges from 20 ~ 60 bytes, valid range: 8 ~ 65515 bytes.
  • IP Header: It is now divided into version 4th and version 6th. Version 6th has not yet been fully promoted, so we will introduce version 4th's ipprotocol.

The IP address report structure is as follows:

  • VersionThe length is 4 bits, indicating the version number of the IP. Currently, the standard IP version 4th is used. That is, IPv4.
  • IP header lengthThe length is 4 bits, indicating the size of the IP header. The value range is 0x5 ~ 0xf, which is a value that represents a multiple of 4. If the minimum IP header length is 20, it can be expressed as 0x5. The maximum IP header length is 60, which can be expressed as 0xf. The IP header size is always a multiple of 4.
  • Service TypeThe length is 1 byte, indicating the Quality of Service used when the router transmits data reports. The service type is also called TOS, 5th ~ 7 bits indicate priority, and different values indicate different priority. The default value is 000; the value 4th is latency; the value 0 is normal; the value 1 is low latency (that is, less latency ), it is generally used for the propagation of sound images and interactive data transmission; 3rd bits are the throughput, 0 is the normal mode, and 1 is the high throughput mode (that is, a large amount of data ), at this time, the router will select a high-bandwidth path for transmission; 2nd bits are reliability; 0 is normal mode; 1 is high reliability; when data is congested, the router first drops the data of 0, and finally the data of 1. The first is the cost. 0 is the normal mode, and 1 is the low cost. If it is 1, the router will not choose expensive transmission methods such as satellite lines; 0th bits are reserved BITs, which are 0. Generally, this field is 0x00 by default.
  • Total Length: The length is 2 bytes, indicating the total length of the IP packet (IP header + payload ). It can be expressed as a maximum of 65535 bytes, which is related to the MTU of the IP address. For example, the maximum value of Ethernet is 1500 bytes, and the maximum value of FDDI is 4352 bytes.
  • IdentifierThe length is 2 bytes, indicating the number reported by the IP address. It is a random number, but the continuous IP datagram identifier is increasing. It can also be used to identify the segment of the IP datagram.
  • Identifier: The length is 3 bits. They are all related to segments, so they are also called segments. The maximum bit is the Reserved Bit, Which is 0, and the 2nd bit is the segmentation flag bit, also known as DF. 0 is the segmentation, and 1 is not the segmentation. The forward bit is a multi-segment flag, also known as the MF bit. If it is set to 1, it indicates that the segment has not ended. The next IP datagram still belongs to a packet of this segment, when the IP address data report is 0, the segment ends. In fact, segmentation is a very resource-consuming process. We should avoid segmentation as much as possible. We can use the ICMP protocol to obtain the MTU of the network IP address. In this way, we can limit the packet size so as to avoid segmentation.
  • Segment offsetThe length is 13 BITs, which is also related to segments. Its value is equal to the starting position of the segmented data to the complete data frame. For example, for a long IP data frame, the payload is 1500 bytes, but it must be segmented into three segments. The first segment is 500 in length, and its offset is 0, df = 0, mf = 1; the second segment is also 500; its offset is changed to 500, df = 0, mf = 1; the third segment is still 500, its offset is changed to 1000, df = 0, mf = 0. note that the identifiers of the three segments are equal.
  • Life Cycle: The length is 1 byte. It is also called TTL, which indicates the number of IP routers that can be forwarded before an IP datagram is discarded. This value is not forwarded once minus 1. When TTL is set to 0, IP datagram is discarded. After the IP router is discarded, an ICMP timeout is returned. To prevent IP datagram transmitted over the Internet, you must ensure that the TTL is greater than the number of IP routers that pass through the router.
  • Protocol: The length is 1 byte, which indicates the type of the Upper-layer protocol contained in the Server Load balancer, for example, TCP is 6, UDP is 7, ICMP is 1, IGMP is 2, and so on.
  • Information header checksum: The length is 2 bytes. It only checks the IP header. It regards the entire IP header as composed of multiple 16-bit data (for example, the IP header is 28 bytes, which is equal to 14 16 data records ), and then sum the binary anticode. The result is the information header checksum. Before verification, the information header is checked and cleared by 0. The TTL is reduced by 1 when each IP router passes through. Therefore, the information header verification and re-calculation are required.
  • Source IP Address: The length is 4 bytes, indicating the IP address of the current node.
  • Target IP Address: The length is 4 bytes, indicating the IP address of the target node.
  • IP Option and fill character. The length is increased by 4 bytes. The specific length is not fixed. The general length is 0.

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.