Describes the function of the TCP/IP Model
Why TCP/IP Model? 网络非常复杂(devices + protocols + media) 使用模型来: 理解(understanding) 标准化(standardizing) 故障排查(troubleshooting) TCP/IP model has four different…
- Why TCP/IP Model?
- 网络非常复杂(devices + protocols + media)
- 使用模型来:
- 理解(understanding)
- 标准化(standardizing)
- 故障排查(troubleshooting)
- TCP/IP model has four different layers: Application layer, Transport Layer, Internet Layer, Network interface layer.
| Layer | Role |
|---|---|
| Application Layer | Provides an interface between applications and the network and defines protocols such as HTTP, SMTP, DNS, and DHCP for data exchange. |
| Transport Layer | Provides end-to-end communication and ensures reliable data transfer using TCP, while UDP offers faster but less reliable transmission. |
| Internet Layer | Handles IP addressing and routing to ensure data packets reach their intended destination across networks. |
| Network Interface Layer | Manages physical data transmission, including hardware, signal encoding, and MAC addressing over network media. |
1. Application Layer (Client Request)|应用层(客户端请求)
-
The user enters a URL and the browser creates an HTTP GET request.
用户输入 URL,浏览器生成一个 HTTP GET 请求。
-
The request is prepared according to the HTTP protocol and passed to the transport layer.
请求按照 HTTP 协议构建,并传递到传输层。
2. Transport Layer (Segmentation & Connection)|传输层(分段与连接)
-
The request is divided into TCP segments with headers including sequence numbers, ports, and checksums.
请求被分割为 TCP 段,并添加序列号、端口号和校验和等信息。
-
A TCP connection is established using the three-way handshake (SYN, SYN-ACK, ACK).
通过三次握手(SYN, SYN-ACK, ACK)建立 TCP 连接。
-
After connection establishment, the segments are sent to the internet layer.
连接建立后,数据段被发送到网络层。
3. Internet Layer (IP Packet & Routing)|网络层(IP与路由)
-
Each TCP segment is encapsulated into an IP packet with source and destination IP addresses.
每个 TCP 段被封装成 IP 数据包,包含源 IP 和目标 IP 地址。
-
The packet is assigned a next hop and prepared for routing across networks.
数据包被分配下一跳地址,用于跨网络传输。
4. Network Interface Layer (Frame & Transmission)|网络接口层(帧与传输)
-
The IP packet is encapsulated into a frame with MAC addresses.
IP 数据包被封装为帧,并加入 MAC 地址。
-
The frame is converted into electrical signals and transmitted through the network.
帧被转换为电信号或无线信号并进行传输。
Between 4 and 5: Internet Routing|(互联网传输过程)
-
The data travels through multiple routers.
数据经过多个路由器传输。
-
Each router forwards the packet based on the destination IP address.
每个路由器根据目标 IP 地址转发数据包。
5. Server Receives Data|服务器接收数据
-
The network interface layer reconstructs the frame from signals.
网络接口层从信号中还原数据帧。
-
The internet layer verifies the IP and extracts the TCP segment.
网络层验证 IP 并提取 TCP 段。
-
The transport layer checks and reassembles the data.
传输层检查并重组数据。
-
The request is passed to the application layer.
请求被传递到应用层。
6. Server Responds|服务器响应
-
The application layer generates an HTTP response.
应用层生成 HTTP 响应。
-
The response is segmented, encapsulated, and transmitted back.
响应被分段、封装并发送回客户端。
7. Client Receives Data|客户端接收数据
-
The network interface layer reconstructs the frame.
网络接口层还原数据帧。
-
The internet layer extracts the TCP segment.
网络层提取 TCP 段。
-
The transport layer reassembles the data.
传输层重组数据。
-
The application layer displays the web page.
应用层显示网页内容。
8. Connection Termination|连接终止
-
The TCP connection is closed using FIN and ACK packets.
使用 FIN 和 ACK 包关闭 TCP 连接。
-
This ensures a graceful termination of the communication.
这确保连接被安全地关闭。
Simplified version of the 8 steps
-
Application Layer (Client) – User Requests a Web Page
The user enters a URL, and the browser constructs an HTTP GET request according to the HTTP protocol. The request is passed to the transport layer.
-
Transport Layer – Preparing the Request for Transmission
The request is converted into a TCP segment with sequence numbers, port numbers (e.g., port 80), and a checksum. A TCP connection is established using the three-way handshake (SYN → SYN-ACK → ACK).
-
Internet Layer – Preparing the Segment for Routing
The TCP segment is encapsulated into an IP packet with source and destination IP addresses, protocol type, TTL, and checksum. A next-hop address is assigned.
-
Network Interface Layer – Encapsulation and Transmission
The IP packet is encapsulated into an Ethernet frame with MAC addresses and a frame checksum. It is converted into signals and transmitted through the network.
-
Network Interface Layer (Server) – Receiving the Request
The server receives the signals and reconstructs the frame. The checksum is verified, and if valid, the IP packet is extracted and passed up the layers(extracting the IP packet is done in the Internet layer).
-
Application Layer (Server) – Generating a Response
The server processes the request and creates an HTTP response. The response travels down through all layers and is sent back to the client.
-
Application Layer (Client) – Displaying the Web Page
The client receives the response, processes it through the layers, and the browser renders the web page.
-
Transport Layer – Connection Termination
The TCP connection is closed using FIN and ACK packets, ensuring a graceful termination of communication.
客户端把请求一层层往下发到网络(from application layer to network interface layer)→传到服务器→服务器一层层往上处理并生成响应from network interface layer to application layer)→再一层层往下发回→客户端再一层层往上接收显示。