We can think of the TCP/IP protocol as the “underlying operating system” of the internet—it serves as the “rulebook” for the operation of the internet, enabling countless devices worldwide (phones, computers, servers, routers) to communicate with each other as if they “speak the same language”.
Why is TCP/IP Needed?
Early computer networks had many different “dialects” (proprietary protocols from various vendors); for example, a computer from Company A could connect to Company A’s router without issue, but would struggle to communicate with Company B’s router. TCP/IP acts like a “globally accepted language” that defines a set of concise and flexible rules allowing all devices connected to the internet to “understand each other”, ultimately forming the internet we know today.
Core Features of TCP/IP
- •
Clear Layering: Although simpler than the OSI 7-layer model, it is still divided into 4 layers, each focusing on a specific function;
- •
Practicality First: It does not pursue theoretical perfection but is designed around “how to ensure reliable data transmission over the network”, making it more suitable for real-world complex network environments;
- •
Openness: Global vendors can use and improve it for free, promoting the widespread adoption of the internet.
The Four Layers of TCP/IP: From “Sending a Package” to “Unpacking a Package”
We use the process of “sending a package” as an analogy to explain the core logic of TCP/IP layer by layer, from the bottom layer (physical transmission) to the top layer (user applications):
Layer 1: Network Interface Layer—”Physical Connection and Transmission Medium”
Responsibilities: Defines “how to transmit signals of 0s and 1s using physical devices (cables, Wi-Fi, fiber optics)”; it is the “foundation” of TCP/IP.
Analogy: The “transportation tools and roads” for packages—whether it’s a truck, airplane, or fiber optics, as long as it can deliver the “package” (data) from one point to another, it suffices.
Specific Tasks:
- •
Specifies the shape of physical interfaces (e.g., RJ45 for Ethernet, wireless signal frequencies for Wi-Fi);
- •
Defines the encoding method for signals (e.g., “1” is represented by high voltage, “0” by low voltage; Wi-Fi uses the strength of electromagnetic waves);
- •
Responsible for converting “data packets” from upper layers into physical signals (e.g., converting binary data into electrical currents or radio waves).
Common Protocols/Technologies: Ethernet, Wi-Fi (IEEE 802.11), PPP (dial-up), fiber optics (light signal transmission).
Layer 2: Internet Layer—”Addressing and Routing Across Networks”
Responsibilities: Addresses the issue of “how data crosses different networks (e.g., from your home Wi-Fi to your company’s LAN)”; the core is IP addresses and routing.
Analogy: The “cross-regional sorting system” for packages—whether the package needs to go from Beijing to Shanghai or from New York to Tokyo, the IP layer is responsible for labeling each package with an “address tag” (IP address) and finding the optimal route (routing).
Specific Tasks:
- •
IP Address: Assigns each device a “network ID card” (e.g., “192.168.1.1”) that identifies its location on the network;
- •
Routing Selection: Routers (the core devices of the Internet layer) determine which path the data should take based on the IP address (e.g., whether to route through Nanjing or Hangzhou);
- •
Packet Transmission: Breaks large data blocks into multiple “IP packets” (similar to dividing a box of apples into several smaller packages) to adapt to the transmission capabilities of different networks.
Common Protocols: IP (IPv4/IPv6, the core protocol), ICMP (network diagnostics, e.g., the “ping” command), ARP (address resolution, converting IP to MAC address).
Layer 3: Transport Layer—”End-to-End Reliability and Efficiency”
Responsibilities: Ensures the complete, ordered, and lossless transmission of data from the sender’s computer to the receiver’s computer (regardless of how many routers it passes through); the core is “port numbers” and “reliability mechanisms”.
Analogy: The “full tracking and after-sales guarantee” for packages—when you shop online, the system gives you a “tracking number” (port number) so you can see where the package is; if it gets lost, the courier company will resend it (TCP’s reliable transmission).
Specific Tasks:
- •
Port Number: Assigns each application a “room number” (e.g., port 80 for web pages, 443 for HTTPS), indicating to the receiver which software the data is intended for;
- •
Reliable Transmission (TCP):
- •
Three-way handshake: The sender first “says hello” (SYN), the receiver responds “received” (SYN+ACK), and the sender confirms “I am about to send” (ACK), ensuring both parties are “ready”;
- •
Acknowledgment and Retransmission: The receiver sends an “acknowledgment” (ACK) after receiving data; if the sender does not receive this acknowledgment, it will retransmit;
- •
Flow Control: Adjusts the sending speed based on the receiver’s processing capability (e.g., slowing down when the receiver is busy).
- •
Efficient Transmission (UDP): Does not establish a connection or confirm retransmission; it simply “sends and goes” (similar to regular packages without tracking), suitable for scenarios requiring high speed (e.g., video calls, gaming).
Common Protocols: TCP (reliable transmission, such as web pages, emails), UDP (efficient transmission, such as video, live streaming).
Layer 4: Application Layer—”Directly Meeting User Needs”
Responsibilities: Directly provides services for user applications (WeChat, browsers, email clients), defining “how applications communicate with each other”.
Analogy: The “user ordering interface” for packages—when you click “order” in the app, this layer defines the rules for your interaction with the app (e.g., what format to input the address, how the app responds after clicking).
Specific Tasks:
- •
Defines the communication rules for applications (e.g., HTTP specifies the format for “web requests”:
<span>GET /index.html HTTP/1.1</span>); - •
Receives user input (e.g., when you type “weather” in the search box) and passes it to the lower layer for processing;
- •
Transforms data from lower layers into a format understandable by users (e.g., converting binary data returned by the server into web pages or images).
Common Protocols: HTTP (web pages), HTTPS (encrypted web pages), FTP (file transfer), SMTP (email sending), DNS (domain name resolution, converting “www.baidu.com” into an IP address).
How Does TCP/IP Work? An Example of “Sending a WeChat Message”
Suppose you send a WeChat message to a friend saying “Shall we have dinner together tonight?” The workflow of TCP/IP is as follows:
- 1.
Application Layer: The WeChat app generates the original message “Shall we have dinner together tonight?”.
- 2.
Transport Layer: The TCP protocol adds a “port” to the message (WeChat’s port is usually 443 or another), and checks if reliable transmission is needed (WeChat chat defaults to TCP).
- 3.
Internet Layer: The IP protocol adds a “source IP” (your phone’s IP) and a “destination IP” (your friend’s phone’s IP) to the message; routers plan the route based on the IP address (e.g., from your home Wi-Fi → carrier base station → your friend’s router).
- 4.
Network Interface Layer: Converts the data into Wi-Fi signals (or mobile data signals) and transmits it through physical media (radio waves).
After receiving the signal, your friend’s phone unpacks it layer by layer:
- •
Network Interface Layer: Converts the Wi-Fi signal back into binary data;
- •
Internet Layer: Confirms based on the IP address that it is intended for itself;
- •
Transport Layer: TCP checks for any lost packets (e.g., if the word “dinner” was missed); if so, it requests a retransmission;
- •
Application Layer: The WeChat app converts the complete message into text that you can see: “Shall we have dinner together tonight?”.
The Relationship Between TCP/IP and the OSI Model
- •
OSI is a Theoretical Framework: The 7-layer model is more rigorous (e.g., it separately defines the session layer and presentation layer), but it is overly complex and difficult to implement in practice;
- •
TCP/IP is a Practical Product: The 4-layer model is simpler and directly designed around “how to connect data to the network”, ultimately becoming the de facto standard of the internet;
- •
Correspondence: The application layer of TCP/IP ≈ OSI layers 5-7 (session + presentation + application); the transport layer of TCP/IP ≈ OSI layer 4; the internet layer of TCP/IP ≈ OSI layer 3; the network interface layer of TCP/IP ≈ OSI layers 1-2 (physical + data link).
Conclusion
TCP/IP is not a single protocol but a protocol suite (composed of multiple protocols) that collaborates through layering to solve the core problem of “how different devices communicate across networks”. From sending WeChat messages to streaming videos, from checking emails to browsing web pages, the internet services we use every day are all underpinned by TCP/IP, quietly “transporting” data—it is like the “water, electricity, and gas” of the internet, the infrastructure of modern digital life.