Introduction to network layering thought and data encapsulation and decapsulation

Introduction to network layering thought and data encapsulation and decapsulation

1. The layered thinking of the network

What is stratification and what is the purpose of stratification?
For the layering of the network, many novices may not understand why layering is required.
In fact, network data transmission as we know it is a very complicated thing, and we are now in an era of rapid network development. Sometimes, once there is a problem with network transmission, it is necessary to find out where the problem is.
At this time, someone proposed the idea of ​​layering, which is to decompose the complex network data transmission process into several single small processes with relatively simple functions.
Such layering not only makes the entire network transmission process more clearly presented in the eyes of the public, but also makes it easier to discover and deal with network problems that occur in daily life.

2. The concept of OSI layered model

2.1. What is the OSI layered model?
The OSI layered model is the Open System Interconnection (OSI) reference model issued by the International Organization for Standardization (ISO) in 1984. This reference model divides network transmission into seven levels.
Insert picture description here

2.2. What is the meaning of each layer?
We will briefly explain from bottom to top:

  • Physical layer:

The main function of the physical layer is to complete the bit stream transmission. Simply put, the physical layer is a layer that establishes, maintains, and terminates physical transmission.

  • data link layer:

The data link layer is a layer that integrates logical connections, hardware address (physical address) addressing, and error checking.
This layer uses physical address addressing, which is the common MAC address. The switches used in this layer are also called Layer 2 switches because they are on the second layer.
At this layer, the transmission content is on the same network segment for data communication, and the MAC address is recognized, but the IP address is not recognized.

  • Network layer:

The network layer uses routers for logical address addressing to realize path selection between different networks, so as to transfer data from the source to the destination.

  • Transport layer:

The transport layer is a protocol port number that defines the transmission data, as well as the layer for flow control and error checking.
To put it simply, what protocols the receiving end user needs to identify the received transmission data depends on this layer.

  • Session layer:

The session layer is the layer that establishes, manages, and terminates sessions between users on different machines.

  • Presentation layer:

The main function of the presentation layer is the presentation, security and compression of data.
Simply put, it is this layer that allows the received data that is not standard coded by your own machine to be displayed on your own machine with standard coding, and it also involves data encryption, decryption, compression, and decompression.

  • Application layer:

The application layer is an interface between network services and end users.
Simply put, it is to convert computer codes into various applications that are familiar to users.
2.3. What is the difference between a switch and a router?
In the above layering, we see that the second layer of data link layer uses switches, but the third time we use routers, what is the difference between them?
Difference 1:
Switch: It realizes data communication on the same network segment.
Router: It realizes the data communication of different network segments.
Difference 2: The
switch implements MAC address forwarding based on the MAC address.
The router implements routing and forwarding according to the routing table.

3. About TCP/IP model and protocol cluster

3.1. What is the TCP/IP model?
We learned about the OSI model above, and then let's take a look at the TCP/IP model.
Insert picture description here
Here, we can find that the difference between the TCP/IP model and the OSI model is that the TCP/IP model combines the upper three layers together and is called the application layer.
3.2. What are the components of the TCP/IP protocol cluster?
About the composition of TCP/IP protocol cluster:

  • Application layer: HTTP, FTP, TFTP, SMTP, SNMP, DNS
  • Transport layer: TCP, UDP
  • Network layer: ICMP, IGMP, TP, ARP, RARP
  • Data link layer and physical layer: protocols defined by the underlying network

3.3. Briefly introduce common protocols

  • Network layer protocol:
  • ICMP: Internet Control Message Protocol. The main function is for network communication detection and information feedback.
  • IGMP: International Group Management Protocol, the main function is multicast.
  • ARP: Address Resolution Protocol. Mainly used when transmitting data, the target IP is known, but the target MAC is unknown.
  • RARP: Reverse Address Resolution Protocol. Mainly used when transmitting data, the target MAC is known, but the target IP is unknown.
  • Transport layer:
  • TCP: Transmission Control Protocol. The transmission security and reliability of the TCP protocol is high, but the relative delay is relatively long.
  • UDP: User Datagram Protocol. The transmission efficiency of the UDP protocol is higher, and the relative delay is less.
  • Application layer: The
    application layer has many common protocols, such as HTTP (Hypertext Transfer Protocol), FTP (File Transfer Protocol), DNS (Domain Name System), etc.

4. Encapsulation and decapsulation of data

4.1. What is data encapsulation?
What exactly is the data encapsulation like?
Insert picture description here
As you can see, this is a top-down process.
Let me give you an example to explain briefly. For example, a community in a certain district of Nanjing has found a patient with new coronary pneumonia and needs to report to Beijing. Then the upper data is the patient in a certain community, and when the TCP header is to report upward, it needs to be reported first. To a certain district government in Nanjing, the IP header will report to the Nanjing municipal government after reporting to the district government. The MAC header will then report to the Jiangsu provincial government and finally to Beijing.
4.2. Decapsulation Decapsulation
is the reverse of encapsulation.
Insert picture description here
Let me give you an example to explain briefly. For example, Beijing received a report that a community in a certain district of Nanjing found a patient with new coronary pneumonia, and provided isolation measures, then it would first be sent to the provincial government, and then the provincial government would send it to Nanjing. The government then sent it to a certain district in Nanjing, and finally reached a certain district in Nanjing, thus receiving quarantine measures layer by layer.

Guess you like

Origin blog.csdn.net/Lucien010230/article/details/111182441
Recommended