Detailed explanation of OSI and TCP/IP network layering model (basic)

OSI model : Open System Interconnection Reference Model ( Open System Interconnection Reference Model ), is a standard framework proposed by the International Organization for Standardization (ISO) that attempts to interconnect various computers into a network worldwide, referred to as OSI.

OSI seven-layer model

The OSI seven-layer model is a network layered model proposed by the International Organization for Standardization. Its general structure and the functions provided by each layer are shown in the following figure:

Each layer focuses on one thing, and each layer needs to use the functions provided by the next layer. For example, the transport layer needs to use the routing and addressing functions provided by the network layer, so that the transport layer knows where to transmit the data.

OSI's seven-layer architecture is conceptually clear and theoretically complete, but it is complex and impractical, and some functions are repeated across multiple layers.

The above picture may be more abstract, and then a more vivid picture. The following picture is what I saw on a foreign website, it is very good!

Since the OSI seven-layer model is so powerful, why can't it do the TCP/IP four-layer model?

Indeed, the OSI seven-layer model has been supported by some large companies and even some national governments at that time. Under such a background, why did it fail? I think there are mainly the following reasons:

  1. OSI experts lack practical experience, and they lack commercial drive in completing OSI standards

  2. The OSI protocols are overly complex to implement and run inefficiently

  3. The cycle of OSI standard formulation is too long, so that the equipment produced according to OSI standard cannot enter the market in time (in the early 1990s, although the entire set of OSI international standards had been formulated, the Internet based on TCP/IP has been successfully operated in a considerable range of the world)

  4. The hierarchical division of OSI is not reasonable, and some functions are repeated in multiple layers.

Although the OSI seven-layer model failed, it provided a lot of good theoretical foundations. In order to better understand network layering, it is very necessary to learn the OSI seven-layer model.

Finally, share a very good summary picture about the OSI seven-layer model!

# TCP/IP four-layer model

The TCP/IP four-layer model is a model widely used at present. We can regard the TCP/IP model as a simplified version of the OSI seven-layer model, which consists of the following four layers:

  1. application layer

  2. transport layer

  3. Network layer

  4. network interface layer

It should be noted that we cannot completely and accurately match the TCP/IP four-layer model and the OSI seven-layer model, but we can simply match the two, as shown in the following figure:

 

 

#Application layer

The application layer is located above the transport layer and mainly provides information exchange services between applications on two terminal devices . It defines the format of information exchange, and the messages will be handed over to the next transport layer for transmission. We call the data unit exchanged by the application layer a message.

 

 

Application layer protocols define network communication rules, and different application layer protocols are required for different network applications. There are many application layer protocols in the Internet, such as the HTTP protocol that supports Web applications, the SMTP protocol that supports email, and so on.

 

 

For a summary of common protocols at the application layer, please see this article: Summary of Common Protocols at the Application Layer (Application Layer) .

#Transport layer (Transport layer)

The main task of the transport layer is to provide general data transmission services for the communication between two terminal device processes . Application processes use this service to transmit application layer messages. "Universal" means that it does not target a specific network application, but multiple applications can use the same transport layer service.

The transport layer mainly uses the following two protocols:

  1. Transmission Control Protocol TCP (Transmission Control Protocol) - provides connection-oriented , reliable data transmission services.

  2. User Data Protocol UDP (User Datagram Protocol)--provides connectionless , best-effort data transmission services (the reliability of data transmission is not guaranteed).

 

 

#Network layer

The network layer is responsible for providing communication services for different hosts on the packet switching network . When sending data, the network layer encapsulates the message segments or user datagrams groups and packets for transmission. In the TCP/IP architecture, because the network layer uses the IP protocol, the packet is also called IP datagram , or datagram for short.

⚠️ Note: Do not confuse "User Datagram UDP" at the transport layer with "IP Datagram" at the network layer .

Another task of the network layer is to select a suitable route, so that the packets transmitted by the source host from the transport layer can find the destination host through the routers in the network layer.

It is emphasized here that the word "network" in the network layer is no longer the specific network we usually talk about, but refers to the name of the third layer in the computer network architecture model.

The Internet is connected by a large number of heterogeneous networks through routers. The network layer protocol used by the Internet is the connectionless Internet Protocol (Internet Protocol) and many routing protocols, so the network layer of the Internet is also called the Internet layer or IP layer .

 

 

Common protocols at the network layer :

  • IP: Internet Protocol : Internet Protocol IP is one of the most important protocols in the TCP/IP protocol and also one of the most important protocols in the network layer. The role of the IP protocol includes addressing protocols, defining the format of data packets, etc. It is the main protocol for information transmission at the network layer. At present, the IP protocol is mainly divided into two types, one is the past IPv4, and the other is the newer IPv6, both of which are currently in use, but the latter has been proposed to replace the former.

  • ARP protocol : ARP protocol, the full name of Address Resolution Protocol (Address Resolution Protocol), which solves the problem of conversion between network layer addresses and link layer addresses . Because an IP datagram always needs to know where the next hop (the next physical destination) should go during the physical transmission process, but the IP address belongs to the logical address, and the MAC address is the physical address. The ARP protocol solves some problems of IP address to MAC address.

  • NAT: Network Address Translation Protocol : The application scenario of the NAT protocol (Network Address Translation) is just like its name - Network Address Translation, which is applied in the process of address translation from the internal network to the external network. Specifically, in a small subnet (local area network, LAN), each host uses the IP address under the same LAN, but outside the LAN, in the wide area network (WAN), a unified IP address is needed to identify the location of the LAN on the entire Internet.

  • ......

#Network interface layer

We can think of the network interface layer as a combination of the data link layer and the physical layer.

  1. The data link layer (data link layer) is usually referred to as the link layer (data transmission between two hosts is always transmitted on a link). The role of the data link layer is to assemble the IP datagrams delivered by the network layer into frames , and transmit the frames on the link between two adjacent nodes . Each frame includes data and necessary control information (such as synchronization information, address information, error control, etc.).

  2. The role of the physical layer is to realize the transparent transmission of bit streams between adjacent computer nodes, shielding the differences in specific transmission media and physical equipment as much as possible

 

 

#Summary _

A brief summary of the protocols and core technologies included in each layer:

 

 

Application layer protocol :

  • HTTP protocol (Hypertext Transfer Protocol, a protocol commonly used for web browsing)

  • DHCP protocol (Dynamic Host Configuration)

  • DNS System Principles (Domain Name System)

  • FTP protocol (File Transfer Protocol)

  • Telnet protocol (remote login protocol)

  • Email protocols, etc. (SMTP, POP3, IMAP)

  • ......

Transport layer protocol :

  • TCP protocol

    • segment structure

    • reliable data transmission

    • flow control

    • congestion control

  • UDP protocol

    • segment structure

    • RDT (Reliable Data Transfer Protocol)

Network layer protocol :

  • IP protocol (the basis of TCP/IP protocol, divided into IPv4 and IPv6)

  • ARP protocol (Address Resolution Protocol, used to resolve the mapping between IP addresses and MAC addresses)

  • ICMP protocol (Control Message Protocol, used to send control messages)

  • NAT protocol (Network Address Translation Protocol)

  • RIP protocol, OSPF protocol, BGP protocol (routing protocol)

  • ......

Network interface layer :

  • error detection technology

  • Multiple access protocol (channel multiplexing technology)

  • CSMA/CD protocol

  • MAC protocol

  • Ethernet technology

  • ......

#Reason for network stratification

At the end of this article, I want to talk about: "Why is the network layered?".

When it comes to layering, let’s start with the development of a background program using a framework. We often divide the system into three layers according to the principle that each layer does different things (there will be more layers in complex systems):

  1. Repository (database operations)

  2. Service (business operation)

  3. Controller (front-end and back-end data interaction)

Complex systems need layers, because each layer needs to focus on one class of things. The reason for network layering is the same, each layer only focuses on doing one type of thing.

Well, let's talk about it again: "Why is the network layered?". I think there are mainly 3 reasons:

  1. Each layer is independent of each other : each layer is independent of each other, and each layer does not need to care about how other layers are implemented. It only needs to know how to call the good functions provided by the lower layer (it can be simply understood as interface call) . This is the same as our layering of the development system.

  2. Improved overall flexibility : each layer can be implemented using the most suitable technology, you only need to ensure that the functions you provide and the rules of the exposed interfaces have not changed. This corresponds to the principles of high cohesion and low coupling that we usually require when developing systems.

  3. Big problems are reduced to small ones : Hierarchy can decompose complex network problems into many smaller problems with clear and simple boundaries to deal with and solve. This makes complex computer network systems easy to design, implement and standardize. This corresponds to when we usually develop, we generally decompose system functions, and then decompose complex problems into smaller problems that are easy to understand. These smaller problems have better boundary (goal and interface) definitions.

I thought of a very, very famous sentence in the computer world, let me share it here:

Any problem in the field of computer science can be solved by adding an indirect middle layer. The entire computer system is designed according to a strict hierarchical structure from top to bottom.

Guess you like

Origin blog.csdn.net/QRLYLETITBE/article/details/131866229