Internet Protocol (IP, Internet Protocol)

zhaozj2021-02-08  293

Internet Protocol (IP) is a major protocol for open system interconnect models, also a complete part of TCP / IP. Although the word "Internet" appears in the name of the protocol, it exceeds the Internet. In fact, all systems on the Internet are used or compatible with IP, but IP can be used in relation to the Internet. Online networks. Quantitatively, as long as it is necessary to effectively connect a number of machines, use IP is very suitable, although IP is now facing some competitors, such as Novell NetWare IPX for small and medium network microcomputers.

What job does IP do? Its main task has two: First, addressing, the second is to manage the DataGrams. The transmission data is very reliable with IP, which determines the target of data sheets, and other paths are selected when the transmission channel is problematic.

The second important feature of IP is often used as a case where the network is not ideal, such as the data sheet transport delay, the transmission path error, the data is erroneously or the like. However, IP does not guarantee that the information is accurately received because it only detects the header information, which does not detect data of the data, which is the work of other layers (this point, IP handle the earlier transmission) Not appropriate, it only guess which of the surrounding nodes, but can't guarantee that the node is the fastest and most effective). Part of the IP defines how the gateway manages the data, when and how to generate an error message, and how to recover errors.

The front has been referred to how data is split and reorganized. The package provided by IP is 65,535 bytes. This is not most of the network processing, so IP will automatically divide the data in the case of it. Smaller data sheets.

When the first small data divided from the large data sheet reaches the destination, the IP layer of the recipient begins to restructuring the data, the order of the reorganization data in accordance with the IP title. If you do not receive all data sheets within a predetermined time, the recipient will discard the received data sheet. Therefore, theoretically a complete chance of successfully sends a larger than one divided data, which is why many procedures avoid split data.

IP does not pay attention to which node passes through the data sheet, and ignores who is a sender or receiver, which handles the transfer path of the packet with a 32-bit (binary bit) network address. In a new version of a version number 6 or a second generation IP, IP can handle a larger title, and the details will be described later.

Internet protocol data tablet title (The Internet Protocol DataGram HEADER)

IP and hardware networks, such as Ethernet (Ethernet), the maximum difference is: The title of the Ethernet contains the hardware address, the IP title contains IP addresses. When the Ethernet receives the IP packet, a header is added in front of the partitioned data sheet, which is called a package. The transformation between the two is done by the address decision agreement (ARP, ADDRESS RESOLUTION protocol).

Note: The package is here refers to some other data before and after the data, and the additional data contains detailed information.

The data sheet is a unit of IP transmission, sometimes called network data sheets or IP data sheets. In the IP specification (most other TCP / IP protocols is also the same as "word" terminology to define titles and end. Each word 32 bit is the most common situation, but some operating systems are different (such as some small machines or more high-level systems with 64-bit words), generally 8-bit bytes, 4 bytes One word. When all available domains are used, the length of the IP title is 6 32-bit words (a total of 24 bytes), the shortest IP title uses 5 words (a total of 20 bytes). To understand all IP title domains, it is best to remember: IP does not rely on hardware, while considering all versions of IP software (downward compatibility). The following figure is a schematic diagram of the IP title.

Figure 3-1

Version Number

This domain contains the IP version information used by the software, and the length is 4 digits. This domain is a must, it is related to the decoding of other parts of the title, because each version of the title is not the same. The most wide version is 4, the latest version 6 has not received wide support.

The definition of IP ensures that the software must detect the version number before analyzing the data sheet, if the software does not process the IP version of the data, the receiver IP layer ignores the contents of the data.

Header Length

4-bit describe the domain of the header length, specifying as a 32-bit word as unit. In order to correctly decode, IP must know the position of the end of the title, which is the role of this domain (there is no mark in the data start position, the length of the title is the basis for calculating the start position of the data block). As mentioned earlier, the shortest title is 5 characters (20 bytes), up to 6 words (24 bytes).

Type of service

The service type domain is 8 bits (1 bytes), which means how to handle the data sheet, and the title of 6 words contains this domain. The specific correspondence of each bit of this domain is shown below. The first three points indicate the priority of the data sheet, the value is from 0 (ordinary) to 7 (network control), the higher the number, the higher the priority, and at least in theory, the faster the data will arrive, but actually This domain will be ignored in most cases.

Each of the three bits is a separate marker, namely the delay, throughput and reliability of the data sheet. 0 is a normal state, 1 corresponds to each bit represents a low delay, high throughput, and high reliability, and the last two bits are not used. As with priority domains, this domain is usually set to the same value and is not subject to it.

Typically, all bits of the service type domain are set to 0, because in addition to some special networks, the domain is actually useless.

Data sheet length or packet length domain (DataGram Length or Packet LENGTH)

This domain describes the total length of the data sheet in bytes, including the title, which is subtracted from the length of the title. This domain is 16 bits because the length of the data (including the title) is 655,35 bytes.

Identification

This domain is used to save the unique identifier created by the sending node, which is required because it is used to ensure that the data is not confusing.

Mark domain (Flags)

The labeling domain length is 3, and the first bit of the left is useless, and the remaining two bits are called DF (Don't fragment) and MF (more Fragments), which is marked whether the data is split. When the value of DF is 1, it is not possible to split the data, and if the local IP layer software must split the value of the data sheet, the data sheet will be regarded as invalid, and an error message will be returned To send information.

If the value of the MF is 1, it means that the current data sheet is split, and there are other data sheets (also called sub-data sheets), and must be reorganized to get complete information. The last MF value of the continuous data sheet is set to 0 (complete), so that the recipient knows when stopping.

Debris offset (FRAGENT OFFSET)

If the value of the MF (More Fragments) flag is 1 (description This is part of a large data slice), the fragmentation offset will indicate that the position of the subchannel piece in the full information, and the ip can recombine the fragments in the correct sequence.

The offset is always relative to the beginning of information, and this domain length is long, the calculation of the offset is in units of 8 bytes, and the maximum length of the corresponding floor is 65,535 bytes. The receiver belongs to that information by identifying the domain judgment data, and then recombaches the complete information by fragment offset.

Life Cycle (Time to Live)

This domain gives a second-unit time, and if the time of the data sheet stays in the network exceeds this limit, it will be regarded as invalid. This domain is set by the send node, generally taken 15 to 30 seconds.

TCP / IP standard specifies that the node of each processing packet minimizes life cycle domain, although it may be less than 1 second. When the gateway receives the data sheet, it records its arrival time, and if the data sheet is handled immediately, the reciprocal is started according to the life cycle field. If the gateway exceeds the load and cannot process the data in time, the lifecycle counter will expire until the data is invalid.

If the lifecycle field is 0, the node discards the data sheet and gives a message to the sender, let the sender turn the data sheet. The purpose of designing life cycle is to prevent the IP package from cycling in the network.

Transport Protocol

This domain describes the identification number of the transfer protocol used by the packet, which is formulated by the Network Information Center (NIC, Network Information Center). It is now probably defined for 50 protocols. The most important thing is the Internet control information protocol (ICMP, number 1) and transmission control protocol (TCP, number 6), if you need a list of all numbers, see about RFC literature (fact There is no need to do it, because most of the agreement is almost never used).

Header Checksum

The number of this domain is the IP title domain and corrected (not a data domain), and the effect is to increase the processing speed. Since there is a change in lifecycle, there is a change in a node, and the correction will change.

Sending Address and Destination Address

This domain contains 32-bit sender IP addresses and target IP addresses. This domain is set when the data is created, and cannot be changed.

Options (options)

This domain is optional, consisting of a number of variable lengths. If the data is used for more than one option, they will appear in the IP title in a continuous manner. All options are controlled by one byte, this byte is usually divided into three parts: 1 binary copy mark (CPY FAG), two binary option classes (option class), and 5 binary options Option Number. The copy mark is used to specify how the gateway will handle the option. When the value is 0, only the option to the first divided data sheet; if the value is 1, copy options to each divided data sheet. . The option class and option numbers indicate the type of option and its exact meaning. There are only two sets of option classes (4 sets of two binary locations). When the value is 0, the option is applied to the data sheet or network control, and the value 2 shows the option for debugging or management, 1 and 3 are useless . The common values ​​for the option class and option numbers are shown in the table below.

Option Class Option Number Description

0 0 Options list NOTE

0 1 No option (used as filling)

0 2 Security Options (Military Use only)

0 3 Source Source Selection

0 7 Flexible selection option (additional field)

0 9 strict source selection

2 4 Timestamp is effective (additional domain)

Padding

The content of the fill option depends on the options that have been selected, and the use is to ensure the complete data tablet title.

Data

In order to understand how IP and other TCP / IP layers wrapped data sheets and transfer it to another machine, let's take a look at the route walking by a typical data sheet. The application sends a data sheet to pass through the following steps: First, the application constructs an IP data sheet within a particular length, calculates its and correction (checksum), then constructs the IP title; the second step is to determine the data transfer route. The first stop, if the data sheet is sent to the local network, that is, the data is transmitted to a machine that the target nearest path, the opposite is to the Internet, is the gateway. For important data, you also need to add options in its title; finally, send a data sheet.

Data sheets check it along each gateway through the network. After the network layer of the gateway, the IP layer calculates and corrects the integrity of the data sheet, and the data sheet will be abandoned if the calibration does not match, and the data sheet will be given up. Transmit party. Next, the measurement lifecycle (TTL domain) of the data sheet is detected, and the timeout data sheet is given, and the error message is returned to the sender. Calculating correct, recalculate the data sheet and correcting the lifecycle, according to the target of the data, to analyze the designated selection option in the target address or datasheet IP title, determine the next step.

The divided data sheet will be correctly reorganized, including the timestamp, the selection, and then sent to the network.

When the data sheet finally reaches the target device, the system will calculate and correct to determine if there are other parts. If you need more information, you need more information, the system enters the waiting state, and runs a timer to ensure that other data sheets arrive at reasonable time. One of the more extremes is that the system receives all data debris, but cannot be reorganized correctly before the timer timeout, and the data is considered invalid and returns an error message to the sender. Finally, the IP title is peeled off, re-get the original data and send it to a higher-level application, and if you need your feel, you have to reply to the sender.

转载请注明原文地址:https://www.9cbs.com/read-1010.html

New Post(0)