IP is the abbreviation of Internet Protocol and is the network layer protocol in the TCP/IP system.
The purpose of designing IP is to improve the scalability of the network: ## Solve Internet problems and achieve interconnection of large-scale, heterogeneous networks; The second is to separate the coupling relationship between top-level network applications and underlying network technologies to facilitate the independent development of both. According to the end-to-end design principle, IP only provides a connectionless, unreliable, best-effort datagram transmission service to the host.
IP is the core of the entire TCP/IP protocol suite and the foundation of the Internet.IP is located in the network layer of the TCP/IP model (equivalent to the network layer of the OSI model), and can carry information on various protocols of the transport layer, such as TCP, UDP, etc.; Next, IP information packets can be placed at the link layer and transmitted through various technologies such as Ethernet and Token Ring networks.
In order to adapt to heterogeneous networks, IP emphasizes adaptability, simplicity and operability, and makes certain sacrifices in reliability. IP does not guarantee the delivery time and reliability of packets. The transmitted packets may be lost, duplicated, delayed or out of order.
IP mainly includes three aspects: IP addressing scheme, packet encapsulation format and packet forwarding rules.Forwarding rules of IP packets
The router only forwards based on the network address. When an IP data packet is forwarded via a router, if the target network is directly connected to the local router, the data packet is delivered directly to the target host, which is called direct delivery; Otherwise, the router looks up routing information through the routing table, And forward the data packet to the specified next-hop router, which is called indirect delivery. During indirect delivery, if the router has a route to the target network in the routing table, it will deliver the data packet to the next-hop router specified in the routing table;
If there is no route, but there is a default route in the routing table , the datagram is delivered to the specified default router; if neither is found, the datagram is dropped and an error is reported.
IP FragmentationAn IP packet may need to pass through multiple different physical networks to be transmitted from the source host to the destination host. Since the data frames of various networks have a maximum transmission unit (MTU) limit, for example, the MTU of an Ethernet frame is 1500; Therefore, when the router is forwarding IP packets, if the size of the data packet exceeds When the maximum transmission unit of the egress link is exceeded, the IP packet will be decomposed into many fragments that are small enough to be transmitted on the target link. These IP fragments re-encapsulate an IP packet for independent transmission and are reassembled when it reaches the destination host.
IP packet structureAn IP packet consists of header and data. The first 20 bytes of the header are required by all IP packets and are also called fixed headers. Following the fixed part of the header are some optional fields, the length of which is variable.
The above is the detailed content of The main function of the network layer of the tcp/ip protocol stack is completed through which protocol?. For more information, please follow other related articles on the PHP Chinese website!