Introduction to OSI model and network protocols

1. OSI seven-layer model

1.1 What is the OSI seven-layer model?

We need to understand that the essence of the Internet is a series of network protocols. This protocol is called the OSI protocol (Open System Interconnection), which is defined by ISO (International Organization for Standardization).

So for OSI, people artificially divide OSI into seven layers according to different functions and division of labor. In fact, these seven levels do not exist, that is to say, there are no such concepts, and the seven-level concepts we mentioned today are just artificial divisions. The purpose is just to give everyone a better understanding of what these are used for.

Please add image description

1.2 What exactly does this network model do?

In short, it encapsulates data and is a standard. Everyone designs with reference to this standard.

The programs (or software) we usually use generally access the network through the application layer. The data generated by the program will be transmitted layer by layer until the final network interface layer is sent to the Internet through the network cable. . Every time the data goes down a layer, it will be packaged by the protocol of this layer. By the time it is sent to the Internet, it has four more layers of packaging than the original data. The entire data encapsulation process is like a Russian matryoshka doll.

When another computer receives the data packet, it will be transmitted layer by layer from the network interface layer. Each layer of transmission will be unpacked, until the final application layer, the most original data will be obtained. This is the data that the program will use.

The process of packaging the data is actually adding a flag (a data block) to the head of the data, indicating that the data has passed through this layer and I have processed it. The process of unpacking data is exactly the opposite, which is to remove the mark in the header of the data and let it gradually reveal its original shape.

  • Data encapsulation process
    Please add image description

Encapsulation (L7-L1 downward encapsulation)
upper data application layer

Translation and compression presentation layer

Create session session layer

Define transport rules (TCP): upper data encapsulation protocol transport layer

Encapsulated IP header (PC1-IP, PC2-IP) Network layer

Encapsulated MAC header (PC1-M, PC2-M) Data link layer

Binary data, physical transmission physics

  • Data decapsulation process

Please add image description

2. TCP/IP protocol

The currently used network model is the TCP/IP model, which simplifies the OSI model and only contains four layers. From top to bottom, they are the application layer, transport layer, network layer and link layer (network interface layer). Each layer contains several protocols.

The TCP/IP model includes hundreds of interrelated protocols such as TCP, IP, UDP, Telnet, FTP, SMTP, HTTP, and Telnet. Among them, TCP and IP are the two most commonly used underlying protocols, so they are collectively called " TCP/IP protocol suite".

3. Common Agreements

Common protocols include the following

(1) HTTP protocol (Hypertext Transfer Protocol) is a member of the TCP/IP protocol family. The HTTP protocol belongs to the application layer.

(2) HTTPS protocol (Hypertext Transfer Protocol Secure)

(3)TCP protocol (Transmission Control Protocol) is a protocol mainly used for inter-network transmission. It divides and processes messages and transmits the result packets to the IP layer, and receives and processes the data packets that have been transmitted by IP.

(4)IP protocol (network interconnection protocol)

(5)FTP protocol (File Transfer Protocol)

(6)SMTP protocol (Simple Mail Transfer Protocol)

(7) Telnet protocol Telnet is an application protocol in TCP/IP that can provide support for terminal emulation.

There are others, you can look them up by yourself when you come across them.

4. IoT communication protocol and MQTT

4.1 Seven major communication protocols for the Internet of Things

The seven major communication protocols of the Internet of Things are: REST/HTTP (loosely coupled service call), CoAP protocol, JMS, XMPP protocol (instant messaging), AMQP protocol (interoperability), DDS protocol (high reliability, real-time), MQTT protocol (low bandwidth).

1. REST stands for Representational State Transfer, which is a communication style developed based on the HTTP protocol. The main purpose is to simplify the system architecture in the Internet, quickly realize loose coupling of the interaction between the client and the server, and reduce the interaction delay between the client and the server.

2. CoAP (Constrained Application Protocol), a constrained application protocol, is used in protocols in wireless sensor networks. It is suitable for resource-constrained communications in IP networks.

3. JMS (Java Message Service), that is, message service, which is the famous message queue protocol in the JAVA platform. The Java Message Service Application Program Interface is an API for message-oriented middleware (MOM) in the Java platform. It is used to send messages between two applications or in a distributed system for asynchronous communication.

4. XMPP (Extensible Messaging and Presence Protocol) is an extensible communication and presentation protocol, a network instant messaging protocol produced by an open source organization.

5. AMQP (Advanced Message Queuing Protocol), advanced message queuing protocol, is used for data exchange in business systems such as PLM, ERP, MES, etc.

6. DDS (Data Distribution Service for Real-Time Systems), a data distribution service for real-time systems.

7. MQTT (Message Queuing Telemetry Transport), message queue telemetry transmission, an instant messaging protocol developed by IBM, is a communication protocol that is more suitable for Internet of Things scenarios.

At present, MQTT has gradually become the most popular protocol in the IoT field and the most mainstream transmission protocol for major IoT platforms at home and abroad. Many devices on the Alibaba Cloud IoT platform are accessed through MQTT
.

4.2 MQTT features

The MQTT protocol is a protocol designed for communication with a large number of remote sensors and control devices with limited computing power and working on low-bandwidth, unreliable networks. It has the following main characteristics:

  • Use the publish/subscribe messaging model to provide one-to-many message publishing and decouple applications;
  • Message transmission with masked payload content;
  • Provide network connectivity using TCP/IP;
  • There are three message publishing quality of services:
  • Small transfers with very little overhead (fixed-length header is 2 bytes) and protocol exchanges minimized to reduce network traffic;
  • A mechanism to notify appropriate parties of client aborts using the Last Will and Testament attributes.

Guess you like

Origin blog.csdn.net/qq_39813400/article/details/129162153