Interviewer: How do you understand the TCP/IP protocol?

Interviewer: How do you understand the TCP/IP protocol?

[[400060]]

This article is reprinted from the WeChat public account "JS Daily Question", the author is Huihui. Please contact the JS Daily Question public account to reprint this article.

1. What is

TCP/IP, Transmission Control Protocol/Internet Protocol, is a protocol suite that enables information transmission between multiple different networks.

  • TCP (Transmission Control Protocol)

A connection-oriented, reliable, byte-stream-based transport layer communication protocol

  • IP (Internet Protocol)

Protocol for packet-switched data networks

The TCP/IP protocol does not only refer to the two protocols TCP and IP, but also refers to a protocol cluster consisting of FTP, SMTP, TCP, UDP, IP and other protocols.

Just because TCP and IP are the most representative in TCP/IP, they are collectively called TCP/IP protocol suite (English: TCP/IP Protocol Suite, or TCP/IP Protocols).

2. Division

The TCP/IP protocol suite is divided into a five-layer system or a four-layer system

The five-layer protocol structure is a protocol that combines the advantages of OSI and TCP/IP, including application layer, transport layer, network layer, data link layer and physical layer.

The five-layer protocol architecture is only designed to introduce network principles. The actual application is still the TCP/IP four-layer architecture, including application layer, transport layer, network layer (internet layer), network interface layer

As shown in the following figure:

Five-layer system

Application Layer

The TCP/IP model combines the functions of the session layer, presentation layer, and application layer in the OSI reference model into an application layer implementation, providing services for different applications through different application layer protocols.

Such as: FTP, Telnet, DNS, SMTP, etc.

Transport Layer

This layer corresponds to the transport layer of the OSI reference model and provides communication functions from the source end to the peer host for the upper layer entity.

The transport layer defines two main protocols: Transmission Control Protocol (TCP) and User Datagram Protocol (UDP)

The connection-oriented TCP protocol ensures the reliability of data transmission, and the connectionless UDP protocol enables simple and fast transmission of data packets.

Network Layer

Responsible for providing communication services for different hosts in the packet network and delivering data to the target host by selecting the appropriate route.

When sending data, the network layer encapsulates the segments or user data generated by the transport layer into groups or packets for transmission.

Data Link Layer

When the data link layer transmits data between two adjacent nodes, it assembles the IP datagrams handed down by the network layer into frames and transmits the frames on the link between the two adjacent nodes.

Physical Layer

Ensure that data can be transmitted on various physical media, providing a reliable environment for data transmission

Four-tier system

The four-layer structure of TCP/IP is shown in the following table:

Hierarchy Name unit Function protocol
Network Interface Layer frame Responsible for the actual data transmission, corresponding to the lower two layers of the OSI reference model HDLC (High-Level Link Control Protocol) PPP (Point-to-Point Protocol) SLIP (Serial Line Interface Protocol)
Network Layer Datagram Responsible for addressing data transmission between networks, corresponding to the third layer of the OSI reference model IP (Internet Protocol) ICMP (Internet Control Message Protocol) ARP (Address Resolution Protocol) RARP (Reverse Address Resolution Protocol)
Transport Layer Message segment Responsible for providing reliable transmission services, corresponding to the fourth layer of the OSI reference model TCP (Transmission Control Protocol) UDP (User Datagram Protocol)
Application Layer Responsible for implementing all application-related functions, corresponding to the upper three layers of the OSI reference model FTP (File Transfer Protocol) HTTP (Hypertext Transfer Protocol) DNS (Domain Name Server Protocol) SMTP (Simple Mail Transfer Protocol) NFS (Network File System Protocol)

Conclusion

The differences between the OSI reference model and the TCP/IP reference model are as follows:

Similarities:

  • Both the OSI reference model and the TCP/IP reference model use a hierarchical structure.
  • Both connection-oriented and connectionless communication service mechanisms can be provided

Differences:

  • OSI uses a seven-layer model; TCP/IP uses a four-layer or five-layer structure
  • The TCP/IP reference model does not subdivide the network interface layer, but only provides some conceptual descriptions; the OSI reference model makes a clear distinction between services and protocols.
  • Although the OSI reference model divides the network into seven layers, it is difficult to implement. The TCP/IP reference model is acceptable as a simplified layered structure.
  • The reason why the TCP/IP protocol removes the presentation layer and the session layer is that the session layer, presentation layer, and application layer are all implemented within the application program, and the final output is an application data packet. However, it is almost impossible to achieve abstract code sharing between applications, which makes the application-level stratification envisioned by OSI impossible to achieve.

The corresponding relationship between the three models is shown in the following figure:

References

https://zh.wikipedia.org/wiki/TCP/IP%E5%8D%8F%E8%AE%AE%E6%97%8F

https://zhuanlan.zhihu.com/p/103162095

https://segmentfault.com/a/1190000039204681

https://leetcode-cn.com/leetbook/detail/networks-interview-highlights/

https://vue3js.cn/interview

<<:  I heard that the client will disappear within three years.

>>:  The Ministry of Industry and Information Technology has made it clear that the SA function will be turned on by default for new 5G mobile phones

Recommend

The Secret of Online Physical Examination Technology (Part 1)

1. Necessity of online physical examination In da...

Intel Launches High-Performance, Energy-Efficient Ethernet Solutions

On February 25, 2025, Intel released two new Ethe...

GSA report: Global application status of LTE and 5G in Sub 1GHz spectrum

GSA released a report that believes that the freq...

How to deal with the nightmare of network outage

Reducing network outages is becoming an increasin...

A practical guide to running databases across regions and Kubernetes clusters

Translator | Kang Shaojing Planning | Yun Zhao Am...

How to solve the packet loss problem in TCP transmission protocol

1. Before answering this question, we need to con...

Mobile phone + satellite, how difficult is it?

​These days, news about satellite phones has beco...

What is an access network?

Nowadays, whether it is the fixed network (broadb...

Home Wi-Fi Routers and Extenders Market to Reach $18 Billion by 2030

[[420910]] Market Introduction Market research fi...

TSMC factory suddenly outages! May lose 200 million yuan, 30,000 wafers damaged

According to Taiwanese media reports, yesterday m...