IP protocol specification

zhaozj2021-02-08  437

Internet Protocol 1. Introduce 1.1. Generation IP protocol is used to connect multiple package switched networks, which transmits a datagram called a datagram before the source address and destination address, it also provides Re-assembly of data sizes to accommodate different networks for packet size. 1.2. The responsibility of the range IP is to transfer data from the source to the destination. It is not responsible for ensuring transfer of reliability, stream control, package order, and other services for hosts to host protocols. 1.3. Interface This protocol is called by the host to the host protocol, and this protocol is responsible for calling the local network protocol to transfer the Data report to the following gateway or destination host. For example, TCP can call the IP protocol, transmit the destination address and source address as parameters, IP formation data, and call the local network (protocol) interface transmission data report. 1.4. Operation IP implementation two basic functions: addressing and segmentation. The IP can send the data report to the destination address according to the destination address included in the datagram, in which the IP is responsible for selecting the transmission of the transmission, which is called routing function. If some networks can only transmit small datagrams, IP can raise datagrams and indicate in the header field. These basic functions include these basic functions in the IP module that exists on each host and gateway in the network, and these modules (especially on the gateway) have routing and other service functions. For IP, there is no connection between datagrams, what connection or logical links are not good to IP. IP uses four key technologies to provide services: service type, survival time, options, header check code. Service type refers to the quality of service you want. The service type is a parameter set, which is the representative of the Internet to provide services. This type of service is used by the gateway, used to select the actual transmission parameter on a specific network, or for the next network to be passed, or the next gateway to route this datagram. The survival time is the time limit of the datagram to survive. It is set by the sender and is processed by the route. If the survival time is zero, discard this datagram. Options for control functions are important, but it does not exist for usual communication. Options include timestamp, security, and special routes. The header check code guarantees the correct transmission of the data. If the verification error is abandoned. IP does not provide a reliable transmission service, it does not provide end-to-end or (routing) node to the (routing) node confirmation, there is no error control on the data, it only uses the header's check code, it does not provide retransmission and flow control. If an error can be reported by ICMP, ICMP is implemented in the IP module. 2. Total Overview 2.1. Contact with other protocols The graph shows the location of the IP protocol in the protocol system. There are two interfaces on the IP, one is an interface with the host and host protocol, the other is an interface with the local network, and the local network can be a small network or a large network, may be confirmed. 2.2. Operation mode The example below can see what the model is used. We assume that the transfer is to pass through the intermediate gateway. The transfer process calls the local IP module to transmit data while transmitting destination addresses and other parameters as call parameters. The IP layer prepares the data header and adds it before the data that needs to be transmitted. The IP module determines a local network address for this network address, here is the gateway address. IP transmitted datagrams and local network addresses to network interfaces. The local network interface creates a local network header to send it on a datagram and then send it to the local network. After adding the local network header to the gateway, the local network interface removes this head and transmits the result to the IP module on the gateway. This IP module determines the primary local network address determined, and then transmits the data to the local network interface as described above. This local network interface creates a local network header to send the data to the destination host.

On the destination host, the local network interface removes the local network head on the datagram, and will be handed over to the IP module. The IP module determines which application is transmitted to which application will be reported, and the system will issue a system call, the IP module returns the source address and other parameters. 2.3. Function Description IP The function is to transmit the datagram on the interconnected network to achieve the purpose of transmitting the datagram to the destination module. There are IP modules on each host and gateway in the network. Denual report is transmitted to the destination address between a routing network address between one module. Therefore, the network address is important for IP protocols. As mentioned earlier, since the data report on each network may be different, it is necessary to segment a large datagram. The address of the address, the address, and the route are different. The name is what we are looking for. The address pointed out where the name is, the route solves the problem there. IP is the problem of processing addresses. Maping the name and address is completed by the upper protocol. The IP module maps the address and local network addresses, and mapping local network addresses and routing is the task of low-level protocols. The address is 32-bit, and the network number and the local address are constituted. The address has three categories: the highest bit of the A class is 0, the post 7 represents the network number, the other 24 bits represent the local address; the first two digits of the class B is 10, and the time 14 represents the network address, and the other 16 indicates the local address; c The class three is 110, and the latter 21 is the network number, and the other 8 represents the local address. When mapping the network address and the local network address, some hosts may use several different IP addresses (we can understand the local network address as a MAC address). We must be able to handle a host has several processing ports, while each port has several logical IP addresses. Segmentation For different networks, where the packet size transmitted may not be the same, so the function of the large package is required. Data reports can also be marked as "inseparable", if a datagram is marked, then it is not allowed to segment it under any circumstances. If you can't get your destination, you will abandon the package in the half road. The re-segmentation and reorganization of the local network is invisible to the IP module, which can also be used. The local network segment and the reorganization add the reorganized segments, and the recipient uses these markers to distinguish different segments. Segment offset domain tells the recipient where to put this paragraph, multi-segment mark indicates the last paragraph, using different domains to be fully restruized a datagram. The marker domain is used for unique tag datagram, which is the initial sender setting, and to ensure that the datagram is unique in it in the entire process of network transmission. The initial sender sets the multi-segment tag to zero, and the segment offset is set to zero. We assume that the IP module divides a large data to two small, the IP module first acquires the data header, and then dividing the data into two copies, adding the data header on two data. When data is separated, in 8 bytes, the second paragraph is not necessarily 8 bytes, but the first must be. We refer to the 8-bit byte number in the first paragraph as a parameter number (NFB). The newly generated first datagnet is the first paragraph of data, setting multi-segment tags 1; the newly generated second data report is the second segment data generated, multi-segment mark is equal to the value in the original data report, The segment offset is equal to the value in the original datagram plus NFB. The above process can be extended from 2 to N. The restructuring of the segment requires the same value as the following four fields: tag, source address, destination address, and protocol. Different datagrams are re-combined according to their own belt offset as new segment, and the offset of the first segment is 0, and the multi-segment mark of the last segment is 0. 2.4. The gateway gateway transmits the datagram between different networks, the gateway also implements the gateway to the gateway protocol (GGP), which is used to transmit routing and other control information. The high-level protocol in the gateway does not need to be implemented, and the functionality of the GGP can be implemented within the IP module.

3. Description 3.1. Internet Baotou Format Package Format is as follows: Version: 4 This domain indicates the format of the header. We now explain the IP version 4. IHL: 4-bit Internet Baotou length is a header length tagged in 32-bit, pointing to the start of the data, the minimum legality value of this domain is 5. Service Type: 8 Bits It is some parameters indicating service quality, which is used to indicate the services required at a particular network. Some networks will provide priority services. The basic principles of choice are the trade-offs of the following: low delay, high reliability and high throughput. 0-2: Priority 3: 0 = usually delay 1 = low delay 4: 0 = usual throughput 1 = high throughput 5: 0 = usual reliability 1 = High reliability 6-7: Keep priority Description: 111 - Network Control 110 - InternetWork Control 101 - Critic / ECP 100 - Flash Override 011 - Flash 010 - Immediate 001 - Priority 000 - Routine If delay (D), throughput (T), and reliability R) Options can increase service quality. This is different from different networks, there is no versatility. In addition to very special cases, up to two parameters is enough. The type of service is used to indicate how the datagram to be transmitted in the network. The network control priority is originally used in a network, but actually applies to each network. Interconnection control is used for gateway control. If these parameters are implemented only in a network, the network must control access to them within their own range. Total length: 16-bit total length refers to the length of the datagram, by bytes, including data and headers. Allow the size of the data to be 64K. Such a big data report is not applicable to most hosts and networks. However, all hosts must be able to receive datagrams greater than 576 bytes, regardless of them, or segmented. If you know that the opponent's host can receive a datagram than 576 bytes, it is best not to send less than 576 bytes of datagrams when sending. Select 576 is because 576 = 512 (data) 64 (header). The header does not exceed 60 bytes, usually 20 bytes. Identification: 16-bit tags are sent to help recombine segments. Tag: 3 digits 0: Reserved, must be 0 1: (df) 0 = can be segmented, 1 = 不 segment bit 2: (mf) 0 = The last paragraph, 1 = more paragraph

0 1 2 0 DF MF Segment Offset: 13 This domain indicates what location should be in the datagram, which calculates 64-bit, and the first paragraph is zero. Survival: 8 bit This domain Description Data reported the maximum time to survive in the Internet system. If the value of this domain is zero, discard this datagna. This domain is also processed while processing a header. Time is subject to second, but each processing unit will minimize TTL, even if the time is less than one second. Protocol: 8 This domain indicates the next layer protocol for the data newspaper data. Headat code: 16-bit check code is only at the head, so the head domain will change when processing, so the head will change frequently. This verification method is relatively easy to calculate, and the experiment proves that it is also applicable, but it may be replaced by the CRC verification process in the future. Source address and destination address: 32 digits, please see below. Options: The length may have an option in the datagram or no, but the IP module must have the ability to process options. In some cases, the security option is necessary. Its length is not necessarily, and there is no way. Options have two formats: 1: One option Type byte 2: A option type byte, one option length byte, and actual option data byte option length is the length of the option type, the length itself, and the length of the data. Option types can be seen as 3 domains: 1 bit copy tag 2-bit option class 5-bit option number Copy tag Refers to this option to exist in all segments. 0 = No copy 1 = Copy option class is: 0 = Control 1 = Reserved 2 = Scheduling and Measurement 3 = Reserved The following is the specific option:

Class Number Length Description 0 0 - The option table ends. Only one byte, no length byte 0 1 - no operation. Only one byte, no length byte 0 2 11, safe, used to transfer security, Compartmentation, User Group (TCC), and DOD Rules Compatible Process Limit Code 0 3 Transfer Length Source Address Routing, Source Address Information Provided Performing a routing 0 9 becomes longer source address routing, the information provided by the source address is used to route 0 7 to the long record routing, the route 0 8 4 stream ID used for the data report, used to transfer stream tag 2 4 becoming the intenet Timestamp Specific Option Definition Option Table End -------- | 00000000 | ------ Type = 0 This option indicates the end of the option table, it does not have to match the end of the header It is used to indicate the end of the option table instead of the end of each option, only when the selected item end position and the header end position are inconsistent. It can be copied, introduced, or deleted at segments. No operation -------- | 00000001 | -------- TYPE = 1 This option can be used in the option, which can be copied, introduced, or deleted when segmented. Safety This option provides a host to send security, compartmentation, processing restrictions, and TCC parameters. The format of this option is as follows: Type = 130 Length = 11 Security (S Domain): 16-bit security a total of 16 levels, 8-level reservation. 00000000 00000000 - not categorized 1,111,000,100,110,101 - Confidentiality 01111000 10011010 - EFTO 10111100 01001101 - MMMM 01011110 00100110 - PROG 10101111 00010011 - limited 1,101,011,110,001,000 - The Secret 0,110,101,111,000,101 - Absolute confidentiality 0,011,010,111,100,010 - Reserved 1,001,101,011,110,001 - Reserved 0,100,110,101,111,000 - Reserved 0,010,010,010,111,101 - 保 00010011 01011110 - Reserved 10001001 10101111 - Reserved 11000100 11010110 - Reserved 11100010 01101011 - Reserved Compartments: 16-bit total 0 represents the transmitted information is non-Compartment. Processing restrictions (H domain): 16-bit control values ​​and version tags are composed of letters and numbers. For details, please refer to other information. Transmission control code (TCC field): 24 bits provide a method of controlling traffic. The value of the TCC is a triple mapping, which is described in HQ DCA Code 530. It must be copied in segmentation. Songyuan address and record routing ------ -------- ------ ------- // ----- --- | 10000011 | Length | Pointer | ROUTE DATA | -------- -------- ------ -------- - // -------- Type = 131 Songyuan Address and Record Routing (LSRR) can provide routing information by the source address and record routing information. This option starts with the option type code.

The second bit is the length of the option, the third is a pointer, pointing to the source address to be processed in the routing data, its minimum value is 4. Routing data consists of a series of addresses, each address is 32 bits. If the pointer is greater than the length, the source route is empty (the recorded route is full), and the route is to be performed according to the destination address field. If the destination address has reached, the pointer is not greater than the length, the next address in the source rout instead of the address in the destination address domain, and the used source address is used instead of the destination address domain, and the pointer is used to add the pointer 4. This process of recorded routing replacement source means option (and IP head as a whole as an overall) datagram, retains a fixed length after processing in the network. It is called a loose source address route because the gateway or host IP can use multiple intermediate gateways when the next address reaches the route. It must be copied in segmentation. Tight source address and record routing ------ -------- ------ ------- // ----- --- | 10001001 | Length | Pointer | ROUTE DATA | -------- -------- ------ -------- - // -------- Type = 137 Tight Supply Address and Record Routing (SSRR) options can provide routing information by the source address and record routing information. This option starts with the option type code. The second bit is the length of the option, the third is a pointer, pointing to the source address to be processed in the routing data, its minimum value is 4. Routing data consists of a series of addresses, each address is 32 bits. If the pointer is greater than the length, the source route is empty (the recorded route is full), and the route is to be performed according to the destination address field. If the destination address has reached, the pointer is not greater than the length, the next address in the source rout instead of the address in the destination address domain, and the used source address is used instead of the destination address domain, and the pointer is used to add the pointer 4. This process of recorded routing replacement source means option (and IP head as a whole as an overall) datagram, retains a fixed length after processing in the network. It is called a tight source address route because the gateway or host IP can use the intermediate gateway when the next address reaches the route. It must be copied in segmentation. Record route -------- -------- --------------- // -------- | 00000111 | Length | Pointer | ROUTE DATA | -------- -------- ------ --------- // - ------- Type = 7 This option provides a method of recording data reporting routes. This option starts with the option type code. The second bit is the length of the option, the third is a pointer, pointing to the source address to be processed in the routing data, its minimum value is 4. The recorded route is composed of a series of IP addresses, each IP address of 32 bits. If the pointer is greater than the length, the record routing data field is full. The source host must assign a large enough space for this option. The space is not increased by the addition of the address. The initial content must be 0. When the IP module handles the datagram, it checks if there is a log routing option, if so, it puts its own IP address into the record routing address space, and points the needle value plus 4. If the address space is full, the module does not add his IP address; if the space is not full, it is not enough to join, the module will think that the source data is wrong and abandon it. In both cases, the ICMP parameter information message is sent to the source host. Do not copy when segmented, but only exist in the first segment.

Biography 10001000 00000010 Flow ID Type = 136 Length = 4 This option provides a method of transmitting a 16-bit SATNET stream tag in a network that does not support stream. You must copy when segmented. Internet Timestamp 01000100 Length Pointer OFLW Tag IP Address Time Stamp ... Type = 68 Option Length is the size of the type, length, pointer, and overflow / tagbie byte in the option. The pointer is added from the start to the end of the timestamp. The minimum is 5. When the pointer is greater than the length, the timestamp is full. Overflow (OFLW) (4 bits) is an IP module number, which cannot register the timestamp due to default space. Its value is: 0 - only timestamp, saved in a continuous 32-bit word; 1 - There are IP addresses of the registration unit before each timestamp; 3 - IP address domain is pre-specified, If the address of the IP module is consistent with the next specified IP address, register your own timestamp. The timestamp is calculated from UT at midnight time, if the time is not calculated in milliseconds, or can not provide UT midnight based benchmark, then what time can be used, as long as the highest bit of timestamp is set to 1, indicating this is not A standard value is OK. The source host must assign a large enough space for this option. The space is not increased by the addition of the address. The initial value must be zero or IP address / zero such an occasion. If the space is full, the module does not add a timestamp when the data is transmitted, but the overflow count is still plus one. If the remaining space cannot be added with a complete timestamp, or overflow count overflow, the source data is reported and abandoned. The ICMP parameter information message will be sent to the source host. This option does not copy when segmented, only appears in the first paragraph. Fill: The growth header field is filled to ensure that the header is 32-bit multiple. The fill is 0. 3.2. Discussion The implementation of the agreement must be strong, and each implementation must ensure compatibility with other people. Usually a policy that implements a comparative conservative strategy should be complied with a comparative conservative policy. That is to say, sending a good package to receive the package that can be interpreted (some errors will also be). The basic Interent service is a datagram, and can provide a datagram in the gateway and a restructuring service at the destination host. Of course, it is also possible to segment and recombine in a network or in a network of private agreements, as this is transparent to IP protocols and high-level protocols. This transparent segment is called a network-based segmentation, which is not discussed here. The IP address is the source address and destination address at the primary level. Addressing In order to make flexible control of network size, IP addresses provide several types of addresses, and one class is a network that can accommodate more hosts. A small number of hosts is relatively small. What kind of Class A, which we have heard? , Class B addresses, Class C addresses are proposed for networks of different sizes. Here are some address formats:

The highest format class 0 7-bit network, 24 hosts A 10 14-bit network, 16 hosts B 110 21-bit network, 8-bit host C111 expand address mode If the network is zero means this network This mode is only used in a particular ICMP message; the extended address model is not defined. The local address specified by the local network must take into account a single host to be used as a different network host. That is, mapping must be performed between the network host address and the network / host interface, which allows several IP addresses to correspond to one interface. At the same time, it should also take into account that a host has multiple processing interfaces. For information received from different reception, it should be seen from the same IP address. Segmentation and recombinant Internet Tag Domain (ID) and source addresses, destination addresses, and protocols are used to confirm the data report segment and reorganization. If the datagram is not the last paragraph, set a multi-segment bump (MF). Segment offset domain tag segment position, it is relative to the datagram that is not segmented. The segment is in 8 bytes, such a segmentation strategy enables unsubgraded datagrams with all zero segmentation information (MF = 0, segment offset = 0). If segmented, the boundary must be a multiple of 8 bytes. This format allows 2 13th (8192) 8-by-segment, and the maximum length of a datagon is just the same as the data indicated by the length domain. Some options are copied when segmented, and some will not. Each IP module must be able to transmit 68-byte datagrams in vans. This is because the IP header will reach 60 bytes, while the minimum data segment is 8,68 = 60 8; and it must also be able to receive 576 bytes of data, regardless of whether this data is not segmented or segmentation. The domains that will be affected by the segmentation include: (1) Segment domain (2) Multi-segment tag (3) block (4) Internet Baotou length Domain (5) Total length domain (6) Package check code If set no Segment mark (DF), it is not possible to segment, even if the data is reported therefore abandoned. This bit needs to be set if the receiving host cannot be reorganized. When we do a diskless boot, we need to set this bit. This process will be described below by example. Where #ging is not equal to, X to Y refer to all data including x, without including Y. The maximum data that can be transmitted in the next network is reported to the maximum transmission unit (MTU). If the length of the data is less than or equal to MTU, the next step is performed; otherwise it is divided into two segments, the size of the first segment is equal to the MTU, and the second section is the remaining length, transmitting the first segment, if the second segment is still greater than the MTU, then Repeat the segmentation process until it can be sent.

Below we give a definition: FO - segment offset IHL - Internet Baotou length DF - OD segment mark MF - Multi-segment tag TL - Total length OFO - Main Offset OIHL - Original Internet Baotou Length OMF - Original multi-segment mark OMF - Original multi-segment tag otl Original length NFB - Segment number MTU - Maximum Transmission Unit Process: IF TL <= MTU THEN Submit this Detailed stage ELSE IF DF = 1 THEN Abandon Data News ELSE Generation 1: (1) Copy Source Internet Baotou; (2) OiHl <- IHL; OTL <- TL; OFO <- fo; OMF <- MF; (3) NFB <- (MTU-IHL * 4) / 8; (4) Additional NFB * 8 data bytes; (5) Correction Baotou: MF <- 1; TL <- (ihl * 4) (NFB * 8); recalculate the check code; (6) Submit the data segment to the next datagram Stage; if you want to generate a second segment: (7) Selectively copy the Internet header; (8) Additional residual data; (9) Correct Baotou: IHL <- (((OiHL * 4) - (Unproduced Option Length )) 3) / 4; TL <- OTL - NFB * 8 - (OIHL-IHL) * 4); FO <- OFO NFB; MF <- OMF; recalculate the check code; (10) Tell this paragraph Submit segmentation; end. In the last paragraph, other segments have reached the size of the MTU, and various implementations are different, as long as the segments that can be less than or equal to the MTU. Recombination process examples for each datagram, the buffer tag is confirmed by the source address, destination address, protocol, and tag domain. If the data is not segment, no need to be reorganized, and the process is processed in the next phase. The data structure required by the recombination is: data buffer, clasp buffer, segment block bit, data length domain, and counter. The data in the segment is placed in the respective position according to segment offset and length, and the corresponding position in the block standard table is set according to the received segment block. If it is the first paragraph (the segment offset is 0), the header is placed on the head buffer; if it is the last segment (multiple spectrum is 0), the total length of the data is calculated. If the entire datagram is received, the next processing phase is performed; if there is no reception, the set counter value is one of the current counter and the time saved in this segment, the restructuring function waives the control. If all buffers are released for timeout. The initial value of the counter is the lower limit of the restructuring waiting time. Because if the survival time in the arrival segment is greater than the reality of the counter current value, if it is less than, it will not be reduced. The maximum time of the counter can reach the maximum survival time (approximately 4.25 points). If it is set to 15 seconds, it may be better, of course, this value may change as practices. The selection of this value is related to the size of the buffer, and the transfer speed is multiplied by the counter value equal to the buffer size. Definition: FO - Segment Offset IHL - Internet Palm Length MF - Multi-Segment Tag TTL - Survival Time NFB - Segment Number TL - Total TDL - Total Data Length BUFID - Buffer Tag RCVBT - Segment Receive Bit TLB - Counter Lower Limit Process : If the data in the data segment arriving is partially or all the same, the above process uses the latest version of the data. The tag tag is to provide a unique tag to a segment of a particular datagram.

If the datagram has the same source address, destination address, protocol, and tag, IP module will identify them as the same data. Any of the selection is held by the sender. The Send Protocol module needs to keep a tag table, and each destination address holds an entry. However, the marking domain allows 65,536 different values, and some hosts can not consider the destination still achieving the unique purpose. The high-level protocol can also be marked. Service Type Service Type (TOS) is the choice of network service quality. The service type is a combination of priority, delay, throughput, and reliability determined by abstract parameters. These parameters correspond to some actual network services. For what is delay, what is the definition of throughput and the like. The survival time survival time is set by the sender, which is the longest survival time in the network, if the timeout will abandon the datagram. Each node in the network process will process the living time existing in the header. The minimum amount of this domain is 1, and the unit is second. Therefore, the longest survival time is 255 seconds. Each processing module must be reduced to TTL 1, even if the time used is less than one second. The high-level reliable connection protocol is based on the original duplicate datagram that will not arrive after a specific time, and TTL is to satisfy such assumptions. The datagram in the option option is optional, but must be in the implementation. Does any options are that the sender has said that each IP module must be able to analyze each option, each option domain has multiple options. The option may not reach a 32-bit boundary, and it is not enough to fill the multiple of 32 bits. Check code If the header changes must recalculate the header check code, the check code can prevent transmission errors to a certain extent. Some applications allow data to be erroneous in the datagram, if IP emphasizes the correctness of the data, similar applications are not used. Error IP protocol error can be reported by ICMP protocol. 3.3. The description of the interface interface is functional, and the specific implementation mechanism of this description will vary depending on the operating system. Different IP implementations have different user interfaces. However, at least a subset is all implementation must be supported. This section will describe this basic subset. The IP protocol has two interfaces, one is for local network, and the other is for high-level protocols or applications, we call the latter interface as users. Although the IP protocol is a datagram protocol, there is little resource (memory) for saving status. Below is a high-level interface example: Send (SRC, DST, PROT, TOS, TTL, BUFPTR, LEN, ID, DF, OPT => Result): SRC = Source Address DST = Destination Address Prot = Protocol TOS = Service Type TTL = Survival BUFPTR = Buffer Pointer LEN = Buffer Length ID = Mark DF = No Segment OPT = Option Data Result = Response, Response Divided into OK and Error; OK = Send Success Error = Parameter Error or Local Network error priority and security parameters are transmitted in the options. RECV (Bufftr, Prot, => Result, SRC, DST, TOS, LEN, OPT) above: BUFPTR = Buffer pointer prot = protocol Result = Response, response is divided into OK and Error; OK = Send Success Error = Parameter Error LEN = Buffer Length SRC = Source Address DST = Target Address TOS = Service Type OPT = Option Data When the user sends a data report, he executes the send command. The IP module checks the transferred parameters and ready to send data when the call is received. If the parameter is legal and the local network receives data normally, it returns success.

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

New Post(0)