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 in the datagram, which is calculated in 64 bits, and the offset of the first segment 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 a 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 Timestamp