2

For the Internet to be interconnected, a message needs to go through the network protocol from sending to receiving. Let's talk about the TCP/IP protocol and the network layering model

First look at the network layered model

Network Hierarchical Model

In the network layering model, there are two models, one is the TCP/IP standard, which was proposed early and was invented in 1970. It proposes the concept of layering and divides network communication into four layers, namely the link layer, the network layer, the transport layer, and the application layer.

The other is OSI, the full name is the Open System Interconnection Communication Reference Model, which is an international standard used to unify various network protocols, which began in the late 1970s. It is the "empty boss" of network layering

The OSI model is divided into seven layers, namely physical layer, data link layer, network layer, transport layer, session layer, presentation layer, and application layer.

The relationship between the two is like the giants of mobile phone systems are iOS and Android. They have developed standards. Because of their strong discourse, international standards take them as the core and specify some other standards, but the core is iOS and Android. Among them, TCP/IP is the leader in the network layering model. OSI is like the Queen of England, a symbol of the royal family and an international standard.

TCP/IP Network Hierarchical Model

It is very interesting that TCP/IP is obviously a general term for network communication protocols, but it is called by the name of two of the core protocols. It has a total of four layers, like building blocks, each layer needs the support of the lower layer and supports the upper layer at the same time. as the picture shows:

TCP/IP 网络分层模型

The bottom layer is also the first layer called the network access (link) layer, the Network Access (link) layer, which is responsible for sending original data packets on the underlying network such as Ethernet and Wi-Fi. MAC addresses are used to mark devices on the network, so sometimes called the MAC layer

The second layer is called the network interconnection layer, the internet layer, where the IP protocol is located. Because the IP protocol defines the concept of IP address, on the basis of the link layer, the IP address is used to replace the MAC address.

The third layer is called the transport layer, which is responsible for ensuring the reliable transmission of data between two points marked by an IP address, such as TCP, UDP, SCTP, etc.

The fourth layer is called the application layer. As the name suggests, it is a protocol for specific applications, such as HTTP, SSH, FTP, SMTP, DNS, etc.

According to the TCP/IP model, the network communication is one layer by one layer, the sender adds a header every time it passes through a layer, and the receiver deletes the header every time it passes through a layer.

数据传输过程

The things to note here are:

  • The transmission unit of the MAC layer is the frame (frame)
  • The transmission unit of the IP layer is the packet.
  • The transmission unit of the TCP layer is the segment (segment)
  • The transmission unit of HTTP is a message or a message (message)
Note: What we often say about packet loss and packet loss is IP packets.

OSI Network Hierarchy Model

The official layered model is called OSI, the full name is the Open System Interconnection Communication Reference Model. If you ask me if I support it, I support it, but it is not a mandatory standard, so there has always been a four-layer (TCP/IP model) and seven-layer (OSI model).

OSI 网络分层模型

The first layer: physical layer, physical layer, the physical form of the network, such as cables, optical fibers, network cards, etc.;

The second layer: data link layer, data link layer, which is basically equivalent to the link layer of TCP/IP;

The third layer: network layer, network layer, equivalent to the network layer of TCP/IP;

The fourth layer: transport layer, transport layer, equivalent to the transport layer of TCP/IP;

The fifth layer, session layer, session layer, maintains the connection state in the network, that is, maintains the session and synchronization;

The sixth layer, the presentation layer, converts the data into appropriate and understandable syntax and semantics;

The seventh layer, the application layer, transmits data for specific applications

Mapping relationship between two hierarchical models

分层模型的映射关系

The first layer: physical layer, there is no corresponding in TCP/IP;

The second layer: data link layer, corresponding to the network access (link) layer of TCP/IP;

The third layer: network layer, corresponding to the network interconnection layer of TCP/IP;

The fourth layer: transport layer, corresponding to the transport layer of TCP/IP;

The fifth, sixth and seventh layers: The application layer corresponding to TCP/IP is unified.

TCP/IP protocol

Appeal We know what the two network hierarchical models are, what they consist of, and how they map. Although there are international standards, the world is still dominated by the TCP/IP protocol. You can understand it as preconceived or unipolar hegemony. You can even think about the importance of 5G/6G standards to the world's right to speak. In short, the TCP/IP protocol is still the main protocol at this stage.

Four layers

Network access (link) layer

MAC address, which represents your physical world address

Network layer

IP protocol defines IP addresses

There is a clip in the movie "Hacker Army", which was made into a programmer's joke

程序员段子

A: What is your address?

B: 173.168.15.10 (IP address)

A: No, what about your local address?

B: 127.0.0.1

A: I mean your physical address

B: 29:01:38:62:31:58 (physical address refers to MAC address)

You can also view all your addresses by ipconfig /all

网络地址

transport layer

The representative is TCP. It can be said that before HTTP3, the transport layer is the world of TCP, which represents the transport layer. After HTTP2, it was found that the bottleneck affecting performance became TCP’s head of queue blocking, so UDP became active. Get up, it's all the time

Regarding TCP and UDP, this chart can better compare and analyze

TCP 和 UDP

application layer

There are many protocols in the application layer, such as HTTP protocol, FTP protocol, SMTP protocol...

application layer protocol application
HTTP World Wide Web
FTP file transfer
DNS Domain name conversion
SMTP e-mail
TELNET remote terminal access
... ...

References


山头人汉波
394 声望555 粉丝