To this day, the Internet has become an indispensable part of everyone’s daily life. Shopping, ordering food, binge-watching shows, and online courses have permeated every aspect of our lives. But how exactly does the network work? This is especially true for those of us engaged in software development and the ICT industry: understanding and mastering this infrastructure on which our products run is particularly essential.
In this article, we will strive, in the simplest and most accessible way, to clarify the foundation of network protocols: the OSI seven-layer model and the TCP/IP four-layer model
The Origins of the Network
To talk about the OSI seven-layer model, we must first review the development and origins of network technology itself.
Today’s network technology actually began for military purposes, germinating against the backdrop of the Cold War rivalry between the United States and the Soviet Union. In 1957, the Soviet Union successfully launched the first artificial satellite, causing panic in the United States, which led to the establishment of APRA (Advanced Research Project Agency, the U.S. Department of Defense Advanced Research Projects Agency).

In 1961, the Soviet Union successfully test-fired the R-16 intercontinental ballistic missile, making a nuclear strike on the U.S. mainland possible. To cope with a possible attack, the U.S. Department of Defense authorized APRA to develop a “distributed” military command system.
In 1966, the prototype of this system was named ARPANET (Arpa Net), and it became the predecessor of the modern Internet.
In 1969, the U.S. Department of Defense officially opened commercial bidding for ARPANET; BBN won the bid and set up a research and development center in the same year.
At the end of 1969, the first ARPANET was born, interconnecting four large mainframe computers at four universities: the University of California, Los Angeles; the University of California, Santa Barbara; Stanford University; and the University of Utah. Human society began to enter the “network era”.

As ARPANET continued to evolve, the need for network protocols was raised in order to solve the problem of signal recognition between different nodes. The first network protocol to be established was called NCP (net control protocol)
In 1977, to address the shortcomings of NCP itself, namely its requirement for homogeneous systems and its limited number of supported hosts, versions V1 and V2 of the Transmission Control Protocol (TCP) were proposed.
In 1978, based on the idea of layering, TCP V3 split the original protocol into the TCP protocol and the IP protocol. The former is responsible for reliable transmission, and the latter for addressing and interconnection. It further evolved into the stable V4 version.
By 1984, the U.S. Department of Defense had divided ARPANET into military and civilian parts. The Internet was thus born
Also in 1984, to solve the problem of interoperability between different systems, the International Organization for Standardization, ISO, proposed the OSI (Open System Interconnect) Open Systems Interconnection model, and promoted it vigorously.
At the same time, the TCP/IP protocol was bundled with the Unix operating system, and as Unix systems became widespread, TCP/IP came to be supported by various subsequent operating systems. The TCP/IP four-layer model thus became the implementation adopted more often in practice.
However, although the OSI seven-layer model and the TCP/IP four-layer model are defined differently, they can essentially be matched and mapped onto each other. The OSI model is more theoretical, while TCP/IP is more widely adopted in practice.

The OSI Seven-Layer Network Model
Let us now explain in detail how the OSI seven-layer model is divided, and the specific function and role of each layer.
Physical Layer
The foundation of modern computer network technology, at its lowest level, is still digital circuit technology. That is, the high-level and low-level signals corresponding to voltage levels in electromagnetic waveform signals are processed into the 1s and 0s of binary. This is the bit, Bit, in binary. All the various operations we perform on our computers and phones, ultimately sent out over the network, are in fact nothing more than a string of binary signals, bits, that is, a bit stream.
Therefore, the role of the physical layer is to handle connectivity in the physical sense: through network interface cards, network cables, or optical fibers and wireless electromagnetic signals, it establishes a communication channel between the device we are currently using and the target host. Through this channel, the bit stream is conducted to the other end.
Data Link Layer
However, a bit stream is merely a string of binary signals; the physical layer actually has no idea where this string of signals is supposed to go. This is where the data link layer comes in:
At this layer, the binary bit stream is first converted, in groups of 8 bits, into bytes (1 byte corresponds to 8 bits); the byte is also the basic unit of storage in our computers. Data organized by grouping into bytes is, by definition, called a frame (frame). The first function of the data link layer is to reorganize the data, converting bits into frames.
Another key function of the data link layer also includes the addition of the MAC address, which is used to mark where the data to be sent is going. The MAC address here, also called the network physical address, is a unique address that is burned into each of our network interface cards at the time the card leaves the factory, and cannot be changed. Through this unique address, we can know exactly whom the data is to be sent to. It is just as when writing a letter we need an address, so that the letter knows where to be delivered. But if at the outset we do not know the MAC address of the device connected through the physical layer, addressing is still required. Addressing works through an addressing protocol (ARP): first a broadcast message is sent, carrying one’s own MAC address and the IP address obtained from the network layer, asking within the current network for the MAC address corresponding to the target IP to be accessed. The corresponding target, after receiving the broadcast message, will send its own MAC address to the sender based on the source MAC address in the received message. In this way, once the original sender obtains the target MAC address, it can complete the encapsulation of the data frame and deliver it correctly according to the address.

At this layer, there are usually Layer 2 switches in the current network, used to forward messages.
Therefore, the main functions of the data link layer are the encapsulation of frames and MAC addressing. (And through switches, some error detection and correction, as well as flow control, can also be accomplished.)
Network Layer
The addressing we mentioned at the data link layer requires that, within the same network, a broadcast shout can be heard by the other party before it can tell you its MAC address. But in reality, when we access the Internet, the target server and we ourselves are thousands of miles apart; in that case, how do we find the other party and complete the communication?
This gives rise to the concept of different networks. The Internet is in fact made up of all kinds of networks, large and small. To complete communication between different networks, your data may have to pass through computers on many different networks before reaching the other end, and at the same time we must find the fastest path so that transmission is more efficient.
Therefore, for our computers to connect to the network, they all actually have an IP address. In contrast to the MAC address, which corresponds to a physical address, the IP address is a logical address. IP addresses are defined by the IP protocol; the one we commonly use today is IPV4, that is, the four-segment decimal dotted numbers we often see (in a form like 192.168.101.11), which, corresponding to binary, is actually a 32-bit binary number string. Of course, now that IPV4 addresses have been exhausted, network IPs are also transitioning to 128-bit IPV6, but for a considerable time to come, IPV4 will continue to be used.
Within this 32-bit IP, both the network number and the host number of the current computer are indicated. Distinguishing the network number from the host number is the role of the subnet mask in an IP address (a detailed review and understanding of the IP protocol will be summarized in a later article)
And this is the main function of the network layer: it encapsulates the IP address into a data packet, that is, the data encapsulated at this layer is called a packet (package). It will include the source IP and the destination IP; after further encapsulation at the next layer down, the data link layer, which adds the MAC address, it is sent to the default gateway of the current network (that is, the default route). After the default gateway receives this packet, if it finds that the destination address is not on the current network, it will use the stored routing table to choose the optimal path for routing and forwarding the data packet. After a series of forwards, it finally reaches the target network, where the gateway of the target network converts the received data packet into a frame, and finally forwards it to the target host.
Therefore, the network layer mainly completes the encapsulation of data packets and performs routing and forwarding. It is an extremely critical layer in the entire network communication process.
Transport Layer
The data transmission we discussed in the previous layers was from host to host, but we run many different programs on our computers — listening to music, running QQ, playing games… All these different programs generate network communication, so how is the transmitted data correctly distinguished so that different programs each handle the data they need?
This is what the transport layer does. The operating system uses ports to correspond to different application programs; the data corresponding to each application, along with its corresponding port, is encapsulated, and data encapsulated this way is called a segment (segment). What is mainly added to a segment is the source port and the destination port. In addition, another aspect of the segment’s role is that the data an application has to process may be quite large; to ensure the continuity and integrity of data processing, it is impossible to wait until all the data has arrived and then process it all at once, so the transport layer also has the function of splitting the data and transmitting it segment by segment. At the transport layer there are two most important protocols: one is TCP (Transmission Control Protocol), and the other is UDP (User Datagram Protocol). They mainly accomplish the segmentation, ordering, and reassembly of data.
Session Layer
From this layer upward are the upper three layers of the OSI model, which mainly deal with processing at the program level. In the TCP/IP model, these three layers are collectively treated as a single layer.
The role of the session layer is to establish a connection between the communicating entities at both ends, and to handle authentication, authorization, and checkpoint recording during communication, so that data transmission can continue even if the session is interrupted unexpectedly. Examples include session persistence, recording of login information, and breakpoint records.
Presentation Layer
The presentation layer is mainly intended to eliminate some of the differences between different systems at the two ends of communication. It is responsible for the representation, encoding, and decoding of data, achieving the conversion of data formats and the unification of representation between different systems. In plain terms, it accomplishes the translation work between the two systems. It also includes, for example, data encryption, compression, and slimming down, which are likewise defined to be done at this layer.
Application Layer
The application layer is the layer we come into direct contact with when using various applications in our daily lives. It is mainly responsible for processing the user’s operations and fulfilling the user’s application needs. For example, the most commonly used Internet protocol, the HTTP protocol, resides at this layer. In addition, protocols such as the mail protocols SMTP and POP3, the file transfer protocol FTP, and the remote login protocol telnet all belong to the application layer.
A single diagram illustrating the transfer of data through the layers is shown below.

A Plain-Language Understanding of the OSI Model
The above is an analysis of this model from the perspective of technical principles. If we use an example from our daily life as an analogy, it will be easier to understand:
The Double Eleven shopping festival is here, and I want to buy a laptop I have long been dreaming of.
- First, compare prices everywhere, find a platform, and, satisfied with the value for money, decide to buy on this platform. This platform here is actually the application layer, which satisfies the shopping need. (Application layer: concrete application services)
- After placing the order, before shipping, the seller will certainly repack the computer as well as all the accessories and gifts to make sure they arrive in your hands undamaged. This process of packing and protection is equivalent to the work of the presentation layer. (Presentation layer: data encoding/decoding and formatting)
- Before placing the order, you may also contact customer service to confirm the gifts, note the shipping time, choose the color, and so on. This process of communicating with customer service is the session layer. (Session layer: maintaining the communication channel between the two parties)
- Once everything is confirmed, the merchant ships the goods to you. At this point a courier company is needed to handle delivery, whether it is SF Express or the “Sitong Yida” carriers; their purpose is to deliver the laptop safely and on time into your hands. The role of the courier company here is the transport layer. (Transport layer: responsible for reliable data delivery)
- How does the courier company deliver the goods? Of course it needs to know the merchant’s address and the buyer’s address, and, based on the addresses, select the optimal route for the courier to pick up and deliver the goods. This is the network layer. (Network layer: responsible for logical addressing and routing)
- The laptop you bought has been delivered from the seller to the regional station in your area. At this point a courier will bring it to your door, and will usually give you a call to check whether you are at home. Determining your exact location by phone is equivalent to physical addressing. This is the data link layer. (Data link layer: physical addressing and delivery of data frames)
- Finally, throughout the whole delivery process, trucks, delivery vans, the courier’s three-wheeler, and his own two legs are used. This is the physical layer, the concrete means of transport. (Physical layer: physical media transmitting the bit stream)
Through such an analogy, do we now have a fairly clear picture of how the OSI seven-layer model actually works?
