Internet layer protocol (transfer)

zhaozj2021-02-16  101

Internet layer protocol

The physical layer and the data link layer do not belong to the TCP / IP protocol, which only implements frame transmissions within the same physical network. In order to achieve network interconnection, the router must be used to interconnect each other. The router should be able to provide links between networks without changing the network structure of the connected subnets, providing routing and data submission capabilities for the process of connecting to different networks. The TCP / IP protocol implements internet interconnection, which consists of a set of protocol clusters, which is the Internet Protocol (IP) and Transmission Control Protocol (TCP).

In order to deliver IP datagrams on the Internet, first solve the addressing problem on the Internet. The addressing method between various networks is often different. The physical address is related to the interface hardware in the same network. When the interface moves to the new machine or replaces the failed hardware interface will change the physical address of the machine. Two parties that need to communicate cannot depend on incompatible physical addresses that may change at any time. To this end, the TCP / IP protocol uses an IP address scheme.

1.IP address

TCP / IP uses a 32-bit binary number as a general machine identifier called an IP address (Internet Protocol Address). 32-bit IP addresses are divided into two parts of the prefix (prefix) and suffix. The prefix indicates the physical network accessed by the computer, and the suffix represents a particular host on the physical network.

In order to meet the needs of different sizes of physical networks to address the address, divide the IP address into five categories. Among them, Class B, Class C, and Class C are used as host address, called primary classes, and distribute the IP address of the corresponding category according to the network scale; the D class is multicast address; E The class is reserved for future use.

For easy understanding, the representation of the IP address is indicated by dotted decimal notation, that is, the decimal number of decimers per 8-bit binary value, and each amount is separated from one point.

In order to ensure that the allocated IP address is unique in the Internet, the Internet No. Assigned Number Authority has final control over the assigned encoding. When an organization adds to the Internet, you can get the network address from the Internet Network Information Center INTERNIC (Internet NetWork Information Center).

The IP address is a network connection. Therefore, each of the multi-address hosts and the router has an address. In addition to the address pointing to the connection, IP has the following special address:

a. Network address: IP All bits of the host number are "0" address to the network itself; b. Directed Broadcast Address: IP all bit of the host is "1" The address is specified as a directional broadcast address; a limited broadcast address (Limited Broadcast Address): consists of 32 "1", which is only broadcasting local network; D. This host address: 32 "0 "Composition, only allow usage when the system is started, and will never be a valid destination address; e. Return Address (loopback): Used to detect network application software, allow communication tests on a computer, it can never be in a network The appearance appears. 2. Bundle Agreement Address

The allocation of the IP address is independent of the physical hardware address of the machine. In order to transmit the packet on the physical network (which can be a destination or another router), the next hop address must be converted to the physics it corresponds to it. Address and this frame is transmitted with this physical address.

The process resolution of the corresponding hardware address is determined by the IP address, and the address resolution algorithm can be divided into the following three basic types. A. Table Lookup: Bundles the protocol address to a table of the corresponding physical address into the memory, when the address is resolved, the software is found in the table. B. Tight-form computation: The protocol address assigned to the computer is carefully selected according to its physical address, so that the physical address of the computer can be calculated from its protocol address through basic logic and arithmetic operations. C. Information exchange (Message Exchange): Computer located in the same physical network performs address resolution by switching information.

The TCP / IP protocol contains the address resolution protocol (ARP). The ARP standard defines two basic information types: request and response. When a host requests to convert an IP address, it broadcasts an ARP request containing the IP address, if the request matches the IP address of a machine, the machine issues a response to the required physical address. The response is to send the machine to broadcast the request.

A cache is retained on a computer using ARP to store the recently obtained IP address to the physical address binding. When sending a packet, the computer is first to the cache to find the required binding, if not, An ARP request. The recipient is updated before processing the ARP packet, first updates the IP address of the sender to the physical address of the sender to the physical address, and respond or discard it.

3. IP Datasheet and Data Transfer A packet called IP Datip (DataGram) transmitted on TCP / IP internet, each datagon contains a head and subsequent data. The IP address is used in the source and destination address of the data report header.

Each router located on the datagram transfer path extracts the destination address from the data report header, and finds the next hop address sent to the destination in the route of the router, and then the router will pass the datagram to the next hop. Until to the destination.

The routing table has three basic fields: the destination network address field, the address mask field of the destination network address, and the next hop field to the destination network. The destination address of the data report is always the final destination address of the datagram. The destination address is the network address of the network where the destination address host is located. Then, according to this network address, the next hop address is determined, and the data will be sent to the next hop by a specific connection. The IP Data Newspaper is included in the following: a. Version Number (VERS), contains version information of the IP protocol generated by the datagram, which is used to confirm the sender, the receiver, and all routers between the sender, the recipient, and all routers between them agree. Report format. B. Header length field, gives the head length of the 32-bit word length. C. Service type field, contain 5 subfields, 3 bits of priority dry fields indicate the priority of this datagram, allowing the sender to indicate the importance of this datagram. The value of the priority is from 0 (normal priority) to 7 (network control), the D, T and R bits indicate the type of transportation desired by this data. When the value of these bits is 1, D represents low delay, T requirement High throughput, R requires high reliability. D. Total Length field, give the IP datagram length in an 8-bit group. E. Life To Live Field, setting the time (second) of the datagram to allow the existing time (second) or the number of routers that are allowed. It is an integer between 1 to 255. F. Header Checksum field to ensure the integrity of the header data. The calculation of IP checksum is to see the head as a 16-bit integer sequence, calculate its binary counter code for each integer, then add, then calculate the binary inverse inverse code. In order to calculate the checksum, it is assumed that the header checksum field is 0. G. Source IP Address and Destination Station Address field, contains a data report (original) sender and (final) 32-bit IP address of the recipient. H. Options (IP Options) field, add the flexibility of IP datagrams. - I. Packing field, dependent on the option, which fills "0" to ensure that the length of the datagram is 32-bit integer times.

4. IP package, fragmentation and reorganization

Data reported as a physical frame package within a particular physical frame, through the transmission of the data, through the transmission of the data. The destination address of the data frame head is the physical address of the data reported to the next hop of the destination.

The datagram is encapsulated in the source station, transmitting the physical frame to the next hop, the recipient extracts the data from the data area in the physical frame, throws the frame of the frame, and then encapsulates the next physical network frame format. Give the next jump until the destination.

MTU (Maximum Transmission Unit) refers to the maximum amount of data of a physical frame allowed by a particular network. When the router receives a data report that is greater than the MTU of the network to be forwarded, the router must divide this data into the network. Data report, each piece is still using the format of the datagram, and retain the identifier of the original datagram, but only partial data of the original data newspaper. When needed, the data report can be shard again.

On a TCP / IP Internet, once the data is divided, each piece is sent as a separate datagram, and it is reorganized after the host arriving at the destination network. The host of the destination point can verify that the slice of the same datagram is verified by the identifier of the data newspaper header, and control fragmentation and reorganization depending on the blanket offset and flag. When the target host receives a piece of fragmentation of a certain data, start a timer. If the timer is timeout before receiving all slice, the receiver is discarded, and the data is not processed. 5. Error Reporting Mechanism In order to let the router in the Internet error or provide information about accidental conditions, the designer joined a special-purpose packet mechanism in TCP / IP, called Internet Control Packet Protocol (ICMP).

ICMP defines five types of error messages and four report information.

a. Source station suppression: When the router receives most of the datagrams, the router is abandoned when the router is abandoned, and the ICMP source suppression packet reports congestion to the initial source network, and requests it to reduce Slow current datagram transmission rate. b. Data Report Time: When a router minimizes the value of a datagram to zero, the router discards the datagram and sends a timeout information; when a host is closed for a certain datagram, The diversity is not allowed to reach all, and the host gives the shard and sends a timeout information. C. Destination is not arrival: When a router detects a datagram that cannot be sent to it, the router sends a destination to be unreachable. D. Redirection: When the router detects that a host uses a non-optimization route, it sends a redirected ICMP message to the host, requesting the host to change the route and put the initial data to its destination station forwarding. E. Split request: If the router receives a datagram that does not allow fragmentation, it is greater than the MTU of the forwarding network that must pass, then the router gives up the datagram, and sends a fragment request information. F. Retiles Request / Answer: A return request information can be sent to any computer ICMP software. In response to a return request, the ICMP software needs to send an ICMP return response information, response, and request delivery to pass the same data. G. Address Mask Request, Appearance: A host broadcasts an address mask request when the system is booted. Receive a request to send a 1-bit mask for the network where the computer is located.

ICMP packets are transmitted in the data area of ​​the IP datagram, and there are three fixed length fields in the beginning of the packet: type fields, code fields, and checksum fields. The message type field determines the format of the remainder and its meaning.

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

New Post(0)