TCP / IP detailed four-layer protocol architecture, common protocols, corresponding equipment

Before talking about the TCP / IP protocol architecture, let ’s first take a look at the earliest OSI seven-layer reference model, from bottom to top are the physical layer, data link layer, network layer, transport layer, session layer, presentation layer, application layer .

The following figure shows the process from the OSI seven-layer reference model to the TCP / IP architecture.

The advantages of the TCP / IP architecture:
(1) Simplify the structure of the computer network. The original seven layers are used to direct the current four layers, but their functions have not been reduced.

(2) Each layer is independent and connected. The independence is because if there is a problem in that layer, it will not affect the work of other layers. The connection is because the upper layer protocol uses the services provided by the lower layer protocol.

It can also be seen from the top that the TCP / IP protocol family is a four-layer protocol system, from bottom to top are the data link layer, network layer, transport layer, and application layer. Each layer completes different functions through several protocols. The upper layer protocol uses the services provided by the lower layer protocol. Next, I will talk about the functions and common protocols of each layer.

1. Data link layer

Function: A network driver that implements a network card interface to handle the transmission of data on physical media (such as Ethernet, Token Ring, etc.).

Corresponding equipment: network cable, network bridge, hub, switch

Commonly used agreements:

(1) ARP (Address Resolution Protocol): It realizes the conversion of IP address to physical address (usually MAC address, popular understanding is network card address).

(2) RARP (Reverse Address Resolution Protocol): As the name implies, it is the opposite of ARP, it is the conversion from physical address to IP address.

Then someone will ask what their purpose is? ? ?

ARP usage: The network layer uses IP addresses to find a machine, while the data link layer uses physical addresses to find a machine. Therefore, the network layer must first convert the IP address of the target machine into a physical address before using the data link layer. service provided.

RARP uses: RARP protocol is only used for some diskless workstations on the network. Because of the lack of storage devices, diskless workstations cannot record their own IP addresses, but you can see the mapping from physical addresses to IP addresses through RARP.

2. Network layer

Function: realize the routing and forwarding of data packets.

Corresponding equipment: router

Commonly used agreements:

(1) The IP protocol (Internet protocol) determines how to send it to the target host according to the destination IP address of the data packet. If the data packet cannot be sent directly to the target host, the IP protocol finds a suitable next-hop router for it, and forwards the data packet to the router for forwarding. .

(2) The ICMP protocol is another important protocol at the network layer. It is an important supplement to the IP protocol and is mainly used to detect network connections.

8-bit type: ICMP messages are divided into two categories: one is error messages, such as target unreachable (type value 3) and redirection (type value 5); the other is query messages, use To query network information.

Some ICMP messages also use 8-bit code fields to subdivide different conditions. For example, the code value 0 indicates network redirection, and the code value 1 indicates host redirection.

16-bit checksum: Cyclic redundancy check (CRC) is performed on the entire message (including header and content).

Note: The ICMP protocol is not strictly a network layer protocol, because it uses the services provided by the IP protocol at the same layer, and generally speaking, the upper layer protocol uses the services provided by the lower layer protocol.

3. Transport layer

Function: Provide end-to-end communication for applications on two hosts. Unlike the hop-by-hop communication method used by the network layer, the transport layer only cares about the start and destination of the communication, and does not care about the transfer process of the data packet.

Main agreement:

(1) TCP protocol (Transmission Control Protocol): Provides reliable, connection-oriented and streaming services for the application layer.

(2) UDP protocol (User Datagram Protocol): provides unreliable, connectionless and datagram services for the application layer. (The detailed explanation and difference of TCP and UDP protocols will be discussed in the next article)

(3) SCTP protocol (Stream Control Transmission Protocol) It is designed to transmit telephone signals on the Internet, and will not be elaborated here.

4. Application layer

Function: Responsible for processing application logic, such as file transfer, name query and network management.

Note: The data link layer, network layer, and transport layer replicate the processing of network communication details, so these parts must be stable and efficient, so they are all implemented in kernel space (see Figure 2 above), and the application layer is implemented in user space because it Responsible for many logics, if implemented in the kernel, it will make the kernel very huge. There are also a few server programs that are implemented in the kernel, so that the code does not need to switch back and forth between user space and kernel space (mainly the copying of data) to improve work efficiency.

Commonly used agreements:

(1) OSPF (Open Shortest Path First) protocol: It is a dynamic routing update protocol used for communication between routers to inform each other of their respective routing information.

(2) DNS (Domain Name Service) protocol: provides conversion of machine domain names to IP addresses. (For example, if you convert www.baidu.com to Baidu's IP, you can enter it directly by entering the domain name. Because the IP address is too troublesome to remember, just like everyone is uniquely identified by the ID card, but it is for easy remembering Name. DNS is a process of mapping names to ID cards)

(3) The telnet protocol is a remote login protocol that enables us to complete remote tasks locally.

(4) HTTP protocol (Hypertext Transfer Protocol) is a stateless, application-layer protocol based on request and response mode, often based on TCP connection.

Published 23 original articles · Like 11 · Visits 30,000+

Guess you like

Origin blog.csdn.net/weixin_42279584/article/details/98736354