To better explain this abstract topic, we will analyze the same issue from different perspectives. Remember the story of the blind men and the elephant? Some say the elephant is like a large tree, while others say it resembles a fan. These views are certainly one-sided, but if we gather all these perspectives, we can roughly outline the framework of the elephant.
1. TCP/IP Protocol from the User’s Perspective
Select the network card, right-click, choose Properties, and in the menu, you will see the TCP/IP protocol, indicating it is installed in the system. You can also check the IP address, subnet mask, default gateway, and DNS server. At this point, the user can open a browser to go online; it’s quite simple, isn’t it?
1.1 Uninstalling the TCP/IP Protocol
If you want to have a tangible understanding of TCP/IP, you can right-click to uninstall it. You will see it disappear from the network card’s Software Properties. When you try to open the browser, you will find you can no longer go online. Now you understand the importance of TCP/IP, right? Let’s reinstall TCP/IP, and then we can go online again. Isn’t that magical?
1.2 Uninstalling the Hardware Network Card
Now let’s take a look at the network card’s Hardware Properties. You will see the network card driver section. Select uninstall, and you will find the network card disappears, along with all other properties. As the saying goes, Without the skin, where will the hair attach? When you open the browser to go online, it will directly inform you that the network is unavailable. Then we reinstall the driver, the network card reappears, all software and hardware properties are back, and we can surf the internet again.
1.3 Uninstalling the Software Browser
Next, we go to the Control Panel, select the Add/Remove Programs icon, and uninstall your browser (assuming it’s the only browser). At this point, we don’t even have a place to enter a URL; how can we browse the web? Let’s reinstall the browser, and then we can go online again.
User Xiaomei, cutely watching us operate, raises a new question: the built-in IE browser is not user-friendly; can it be uninstalled to install another browser? Of course! Users can freely choose their browser to go online.
Xiaomei has another question: can we replace the network card? Of course! Just unplug the old network card, replace it with a new one, and reinstall the network card driver, and it’s done. Users can freely choose their hardware network card.
Xiaomei suddenly wonders, Can we uninstall TCP/IP and replace it with something similar? The elder brother begins to explain: Since 99.99% of servers and client users on the Internet use TCP/IP, if we switch to another protocol, communication may fail because different protocols cannot understand each other, just like people who speak different languages cannot communicate. If communication is needed, translation is required, which unnecessarily adds complexity. Therefore, we cannot replace TCP/IP.
In other words, we can change the network card and the browser, but we cannot change TCP/IP; TCP/IP is our only choice.
TCP/IP serves as a central hub, working with any data link layer protocol, such as Ethernet/HDLC/PPP/ATM/Frame Relay; it can support many application layer protocols, such as HTTP/SMTP/FTP/POP3, as well as user-defined protocols. TCP/IP operates as a protocol suite within the operating system kernel, completing connection-oriented reliable transmission (Connection-Oriented TCP) or connectionless unreliable transmission (Connectionless UDP), making TCP/IP protocol the core engine of computer networks.
2. TCP/IP from the Operating System’s Perspective
TCP/IP runs as independent processes in the operating system kernel, such as TCP process and IP process. To ensure the IP process works correctly, it requires the initialization of the IP address, network mask, default gateway, and DNS server, which is handled by the DHCP process. Alternatively, users can manually configure these parameters.
The DHCP process broadcasts messages and sends them from the network card. If there is a DHCP server within the layer 2 broadcast domain, it will assign the above IP parameters to the user’s DHCP process, completing the IP process initialization. At this point, TCP/IP can be used normally.
When Xiaomei opens the browser, it initiates a user process (named http process), then enters the URL http://www.zhihu.com, triggering a series of actions:
2.1 First, the URL must be translated into an IP address, which requires calling the DNS process. The DNS process sends a request to the DNS server and receives the IP address A.
2.2 The http process organizes its webpage request, adds the HTTP header, similar to http + data, and calls the TCP process, telling it to send the data http + data to A.
2.3 The TCP process triggers a three-way handshake connection with A. This handshake consists purely of TCP messages, without any HTTP data, and all three handshake steps require calling the IP process with A as the input parameter.
2.4 The IP process uses A as the input parameter to query the routing table and finds it needs to send it to the default gateway. It needs to know the MAC address of the default gateway, calling the ARP process to request the gateway’s MAC, with the gateway’s IP as the input parameter.
2.5 The ARP process broadcasts an ARP request, receives the gateway MAC, and returns it to the IP process.
2.6 The IP process calls the network card driver process, using the gateway’s MAC as the input parameter, and the data consists of the IP header + TCP header.
2.7 The network card sends it out, eventually reaching the server, completing the three-way handshake.
2.8 The TCP process then calls the IP process again with TCP header + HTTP header + data, following similar steps as 2.4 – 2.7, which will not be repeated here.
2.9 Suppose the http process finally receives the webpage from the server and displays it in the browser.
3. TCP/IP from the OSI Model’s Perspective
The OSI model has seven layers:
Layer Seven: Application Layer
Layer Six: Presentation Layer
Layer Five: Session Layer
Layer Four: Transport Layer
Layer Three: Network Layer
Layer Two: Link Layer
Layer One: Physical Layer
The browser corresponds to the seventh, sixth, and fifth layers.
TCP/IP corresponds to the fourth and third layers.
The TCP layer corresponds to the fourth layer, i.e., the transport layer.
The IP layer corresponds to the third layer, i.e., the network layer.
The network card (driver) corresponds to the second layer (link layer) and the first layer (physical layer).
Thus, the browser + TCP/IP + network card (driver) perfectly corresponds to the seven layers of the OSI reference model.
Why is there an OSI layering?
This is to enable communication between different operating systems and devices from different manufacturers, all adhering to the same protocol standards, much like how people speaking the same language can communicate freely.
Layering also allows different underlying network cards to independently implement their functions, achieving the same encoding method at the lower (physical) layer, while providing standard interfaces at the upper (network) layer. How they implement internally is not of concern to others.
The same goes for the IP layer, which independently completes its functions, provides standard interfaces to the upper layer, and calls standard interfaces from the lower layer, making development very convenient.