Introduction to the OSI seven-layer model

Network reference model

Insert picture description here

One, the physical layer

First of all, the physical layer considers how to transmit the bit stream in the medium connected to the computer . There are many types of hardware devices and transmission media in existing computer networks, and there are many different ways of communication. The role of the physical layer is to shield these differences in transmission media and communication means as much as possible, so that the data link layer cannot feel these differences.
Function 1: Define interface characteristics

  • Mechanical properties
  • Electrical characteristics
  • Features
  • Procedure characteristics

Function 2: Define the transmission mode.
Channel: refers to the medium that transmits information in a certain direction. A communication circuit often includes a transmission channel and a reception channel. From the perspective of the way of information interaction between the two parties, there are three basic ways:

  • Simplex communication
  • Duplex communication
  • Duplex communication

Function 3: Bit encoding

  • Non-return to zero
  • Manchester code
  • Differential Manchester Coding

Second, the data link layer

The link layer provides data transmission services for the network layer

Main functions: encapsulation into framing, transparent transmission, error detection

1. Packaging into frames

Encapsulation into a frame is to add a header and a tail respectively before and after a piece of data, thus forming a frame. After receiving the bit stream handed over by the physical layer, the receiving end can identify the start and end of the frame according to the header and tail markers.
Insert picture description here

2. Transparent transmission

Since the start and end marks of the frame are represented by a special character sequence, the transmitted data must not have the same code as the delimitation control character of the frame, otherwise frame delimitation errors will occur.
Insert picture description here
In order to solve the problem of the transmitted data and the frame When the delimiting characters are the same, we usually use the " character padding " method. If delimiters such as "SOH" and "EOT" appear in the transmitted data, the data link layer of the sender will insert the escape character "ESC" before the "SOH" and "EOT" in the data (the binary code is 00011011). After receiving the data frame, the receiver first removes the frame header and frame end, and then removes the escape character in the data.
At this time you may have to ask: What if the sequence of escape characters is the transmitted data?
If so, the data link layer of the sender will also insert an "ESC" in front of the escape character "ESC", and the receiving end will delete the previous one if it receives two consecutive escape characters.

Insert picture description here
Typical data link layer protocol: PPP, STP, CSMA/CD, CSMA/CA

3. Error detection

During data transmission, bit errors may occur: 1 becomes 0, and 0 becomes 1, which is called bit error . For this reason, CRC cyclic redundancy check technology is widely used in the data link layer of the recipient to detect whether there is a bit error (a lot of information on the Internet, I will not repeat it here)

In addition, the data link layer defines the physical address, which is used to uniquely identify the device in the network, that is, the MAC address
has functions such as sequence control and flow control

Third, the network layer

The main task is to transfer packets from the source to the destination

Function 1: routing selection
The routing selection algorithm (RIP, OSPF) is used to select the most appropriate path for the message or packet to pass through the communication subnet

Function 2: Flow Control
Coordinates the data transmission speed of each host in the network. Unlike the transport layer flow control, this is mainly to avoid network congestion

Function 3: Congestion control
If all nodes are too late to receive packets and discard a large number of packets, the network will be in congestion. The network layer will take response measures to alleviate congestion

Typical network layer protocols: IP, ICMP, IGMP, ARP, RARP, RIP, OSPF

Fourth, the transport layer

Responsible for the communication between the two processes in the host , that is, end-to-end communication. The transmission unit is a segment or user datagram

Function 1: Reliable transmission, unreliable transmission The
transport layer provides two services, "connection-oriented" and "connection-oriented" for higher layers on the basis of the network layer.

Function 2: Error Control
If packet loss or data errors occur during transmission, the transport layer will deal with these problems. Such as timeout retransmission and other mechanisms

Function 3: Flow Control
Match the sending and receiving speed of the sending end and the receiving end to avoid problems such as the sender sending too fast and the receiving end too late to receive

Typical transport layer protocol: TCP, UDP

Five, the session layer

Provides methods for establishing and using connections to the presentation layer of two entities. The connection of the presentation layer between different entities is called a session . Therefore, the task of the session layer is to organize and coordinate the communication between the two session processes , and to manage the data exchange.

  • The two sessions do not affect each other. For example, when the browser accesses Baidu, the browser and the Baidu server establish a session. Then you visit the NetEase webpage, the browser and the NetEase server also establish a session. When accessing the Baidu page and data interaction with the Baidu server, the session with the NetEase server will not be affected.

Six, presentation layer

Used to handle the representation of information exchanged between two communication systems (simply understood as two PCs)

Function 1: Data format conversion (translator)

  • For example, convert the sequence of...0101001... into a picture or a voice

Function 2: Data encryption and decryption

  • For example, use WeChat to send a text "My payment password is 123456". In order to prevent the password from being captured by the packet, the presentation layer will encrypt this paragraph and transmit it. Similarly, because the same presentation layer protocol is used, the presentation layer at the receiving end will decrypt this piece of information using the same method

Function 3: Data compression and decompression

  • For example, when using WeChat video chat, the video data is relatively large, and the presentation layer will compress these data. The receiver’s presentation layer is decompressed in the same way

Seven, application layer

The application layer is the interface between computer users and various application programs and the network. Its function is to directly provide services to users and complete various tasks that users hope to complete on the network. Mainly responsible for providing data interface standards, the services provided include file transfer , file management and email services

Typical application layer protocols : file transfer (FTP), email (SMTP), World Wide Web (HTTP)

Guess you like

Origin blog.csdn.net/qq_42500831/article/details/105123706