📚 GCSE AQA Computer Science: TCP/IP Protocol Stack Explained | GCSE AQA 计算机科学:TCP/IP 协议栈考点精讲
In the world of modern networking, data rarely travels as one unbroken stream. Instead, it is chopped into packets, labelled, addressed, and reassembled according to a strict set of rules called protocols. For GCSE AQA Computer Science, understanding the TCP/IP protocol stack is fundamental. It explains how your browser fetches a webpage from a server halfway across the globe, how email reaches the correct inbox, and why some communications are faster while others guarantee delivery. This article unpacks every layer of the stack, the role of key protocols like TCP, UDP, IP, HTTP, and FTP, and the vital concepts of packet switching, addressing, and encapsulation that appear regularly in exam questions.
在现代网络世界中,数据很少以连续的流直接传输。它会先被切成数据包,贴上标签、写上地址,然后根据一套严格的规则(即协议)进行重组。对于 GCSE AQA 计算机科学来说,理解 TCP/IP 协议栈是基础。它解释了你的浏览器如何从地球另一端的服务器获取网页,电子邮件如何到达正确的收件箱,以及为什么有些通信更快而另一些则保证交付。本文逐层剖析协议栈的每个部分,介绍 TCP、UDP、IP、HTTP、FTP 等关键协议的角色,以及考试中频繁出现的分组交换、寻址和数据封装等重要概念。
1. What Is a Protocol and Why the TCP/IP Model? | 什么是协议,为什么使用 TCP/IP 模型?
A protocol is an agreed set of rules that govern how devices communicate over a network. Without protocols, data would be sent in incompatible formats and never reach its destination correctly. The TCP/IP model is a conceptual framework used to standardise these rules across the internet and most private networks. It organises networking functions into layers, with each layer responsible for a specific part of the communication process.
协议是一套约定的规则,控制着设备之间如何在网络上通信。没有协议,数据就会以不兼容的格式发送,永远无法正确到达目的地。TCP/IP 模型是一个概念框架,用于在互联网和大多数私有网络中标准化这些规则。它将网络功能组织成多个层次,每一层负责通信过程的特定部分。
The TCP/IP model originally had four layers, which matches the AQA GCSE specification exactly: Application, Transport, Network, and Link. This layered approach simplifies troubleshooting, allows developers to change one layer without affecting others, and ensures different manufacturers’ devices can work together seamlessly.
TCP/IP 模型最初有四个层次,这与 AQA GCSE 考试大纲完全吻合:应用层、传输层、网络层和链路层。这种分层方法简化了故障排除,允许开发人员更改某一层而不影响其他层,并确保不同制造商的设备能够无缝协作。
2. The Four Layers of the TCP/IP Stack | TCP/IP 协议栈的四层结构
The stack is typically visualised from top (closest to the user) to bottom (closest to the physical hardware). The four layers are: Application, Transport, Network, and Link. Each layer uses the services of the layer below it and provides services to the layer above it. For instance, the Transport layer relies on the Network layer to deliver data across different networks, while the Application layer relies on the Transport layer to manage end-to-end connections.
协议栈通常从上(最接近用户)到下(最接近物理硬件)来可视化。四层分别是:应用层、传输层、网络层和链路层。每一层都使用其下层提供的服务,并向上层提供服务。例如,传输层依赖网络层在不同网络间传输数据,而应用层则依赖传输层来管理端到端连接。
AQA exams often ask you to name the four layers in order and describe what each does. A simple mnemonic is ‘All The Nice Layers’ (Application, Transport, Network, Link), but remembering the functions matters more than the mnemonic.
AQA 考试经常要求按顺序说出四层名称,并描述每层的功能。一个简单的助记法是 ‘All The Nice Layers’(Application, Transport, Network, Link),但记住功能比助记法更重要。
3. Application Layer – Protocols That the User Interacts With | 应用层——用户直接使用的协议
The Application layer is the topmost layer and is where network applications operate. It provides protocols that allow software to access the network. Common protocols include HTTP (Hypertext Transfer Protocol) for web browsing, HTTPS (HTTP Secure) for encrypted web traffic, FTP (File Transfer Protocol) for uploading and downloading files, SMTP (Simple Mail Transfer Protocol) for sending emails, and IMAP (Internet Message Access Protocol) for retrieving emails.
应用层是最顶层,也是网络应用程序运行的层面。它提供了允许软件访问网络的协议。常见协议包括用于网页浏览的 HTTP(超文本传输协议)、用于加密网页流量的 HTTPS(安全超文本传输协议)、用于上传和下载文件的 FTP(文件传输协议)、用于发送电子邮件的 SMTP(简单邮件传输协议)以及用于接收电子邮件的 IMAP(互联网消息访问协议)。
At this layer, data is formatted in a way that the receiving application can understand, such as HTML for a web page or a base64-encoded attachment in an email. The Application layer passes the data down to the Transport layer, adding its own header information where necessary.
在这一层,数据被格式化为接收应用程序能理解的形式,例如网页的 HTML 或电子邮件中经过 base64 编码的附件。应用层把数据向下传递给传输层,必要时会加上自己的头部信息。
4. Transport Layer – Managing Reliable Communication | 传输层——管理可靠通信
The Transport layer is responsible for end-to-end communication between the source and destination applications. It splits large data from the Application layer into smaller segments (or datagrams) and adds a header containing the source and destination port numbers. Port numbers identify specific processes: for instance, web servers typically listen on port 80 for HTTP and port 443 for HTTPS.
传输层负责源应用程序与目标应用程序之间的端到端通信。它将来自应用层的大块数据分割成较小的段(或数据报),并添加包含源端口号和目标端口号的头部。端口号用于标识特定进程:例如,Web 服务器通常在端口 80 上侦听 HTTP 请求,在端口 443 上侦听 HTTPS 请求。
The two key protocols at this layer are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). TCP provides reliable, connection-oriented communication: it establishes a connection with a three-way handshake, numbers each segment, and retransmits lost data. UDP is connectionless and faster but does not guarantee delivery or order, making it suitable for live video streaming or online gaming where speed outweighs occasional loss.
这一层的两个关键协议是 TCP(传输控制协议)和 UDP(用户数据报协议)。TCP 提供可靠的、面向连接的通信:它通过三次握手建立连接,为每个数据段编号,并重传丢失的数据。UDP 是无连接的,速度更快,但不保证交付或顺序,因此适用于直播视频流或在线游戏,这些场景中速度比偶尔的丢失更重要。
5. Network Layer – Logical Addressing and Routing | 网络层——逻辑寻址与路由
The Network layer handles the logical addressing of devices and determines the best path for data across interconnected networks. The main protocol here is IP (Internet Protocol). Each device on a network has a unique IP address, which can be either IPv4 (e.g., 192.168.1.10) or the newer IPv6 (e.g., 2001:0db8:85a3::8a2e:0370:7334).
网络层处理设备的逻辑寻址,并决定数据在互联网络之间的最佳路径。这一层的主要协议是 IP(互联网协议)。网络上的每台设备都有一个唯一的 IP 地址,它可以是 IPv4(例如 192.168.1.10)或较新的 IPv6(例如 2001:0db8:85a3::8a2e:0370:7334)。
When a packet arrives, routers examine its destination IP address and use routing tables to forward it to the next hop. This process of packet switching replaces the older circuit switching method used in telephone networks, making data transmission more efficient and resilient.
当数据包到达时,路由器会检查其目标 IP 地址,并利用路由表将其转发到下一跳。这种分组交换过程取代了电话网络中使用的较旧的电路交换方法,使数据传输更高效、更有弹性。
6. Link Layer – Physical Hardware and Local Delivery | 链路层——物理硬件与本地交付
The Link layer (sometimes called the Network Interface layer) governs the physical transmission of data over a specific medium, such as copper cables, fibre optics, or radio waves. It is responsible for framing packets into frames, adding the source and destination MAC (Media Access Control) addresses. MAC addresses are 48-bit hardware identifiers burned into network interface cards and are unique to each device.
链路层(有时称为网络接口层)控制数据在特定介质上(如铜缆、光纤或无线电波)的物理传输。它负责将数据包封装成帧,并添加源和目标 MAC(媒体访问控制)地址。MAC 地址是烧录在网络接口卡中的 48 位硬件标识符,每台设备都是唯一的。
This layer also handles error detection (though not correction) through checksums within the frame trailer. The most common protocol at this layer is Ethernet, which defines frame formats and how devices share the cable. The Link layer ensures that data can be transmitted hop by hop within a local network segment.
该层还通过帧尾部的校验和来处理错误检测(但不负责纠正)。该层最常见的协议是以太网,它定义了帧的格式以及设备如何共享传输介质。链路层确保数据能在本地网段内逐跳传输。
7. Data Encapsulation and Decapsulation | 数据封装与解封装
As data travels down the stack from Application to Link, each layer wraps the data from the layer above in its own header (and sometimes a trailer). This process is called encapsulation. At the Application layer, data is simply a stream of bytes (e.g., HTML). The Transport layer adds a TCP header to create a segment. The Network layer adds an IP header to form a packet. Finally, the Link layer adds a MAC header and trailer, creating a frame.
当数据从应用层向下传递到链路层时,每一层都会用自己特有的头部(有时还有尾部)将上层数据包裹起来。这个过程称为封装。在应用层,数据只是字节流(例如 HTML)。传输层添加 TCP 头部形成数据段。网络层添加 IP 头部形成数据包。最后,链路层添加 MAC 头部和尾部,形成帧。
At the receiving end, the process is reversed: decapsulation. The Link layer removes the frame header and trailer, passing the packet to the Network layer, which removes the IP header and passes the segment to the Transport layer, and so on, until the raw application data reaches the receiving software. This systematic approach allows intermediate devices like routers to read headers at the layers they need without touching the payload.
在接收端,过程是相反的:解封装。链路层移除帧头部和尾部,将数据包传递给网络层;网络层移除 IP 头部,将数据段传递给传输层;如此继续,直到原始应用数据到达接收软件。这种系统化的方法允许中间设备(如路由器)只读取它们所需层的头部,而不接触实际负载。
8. Packets, Packet Switching, and Routing | 数据包、分组交换与路由
A packet is a unit of data at the Network layer, consisting of an IP header and a payload (the encapsulated Transport layer segment). Packet switching is the method used by the internet and most modern networks. Instead of establishing a dedicated circuit for the entire communication, packets are sent independently and can take different routes to the destination, where they are reassembled in the correct order.
数据包是网络层的数据单元,由 IP 头部和有效载荷(即被封装的传输层数据段)组成。分组交换是互联网和大多数现代网络使用的方法。它不再为整个通信建立一条专用电路,而是将数据包独立发送,可以通过不同的路由到达目的地,并在那里按正确顺序重新组合。
Routers operate at the Network layer and use the destination IP address to decide where to forward each packet. If a link fails, routers can dynamically reroute packets through alternative paths, making the network highly fault-tolerant. This contrasts with circuit switching, where a broken connection drops the entire call.
路由器工作在网络层,利用目标 IP 地址来决定将每个数据包转发到何处。如果某条链路发生故障,路由器可以动态地通过备用路径重新路由数据包,从而使网络具有高度的容错能力。这与电路交换形成对比,在电路交换中,一旦连接中断,整个通话就会断开。
9. MAC Addresses vs IP Addresses | MAC 地址与 IP 地址
Understanding the difference between MAC and IP addresses is a classic exam topic. A MAC address is a 48-bit physical address (e.g., 00:1A:2B:3C:4D:5E) hardcoded into a network interface card and used for communication within a local network segment. An IP address is a logical address (e.g., 192.168.0.5) assigned by software and used for end-to-end routing across different networks. MAC addresses stay the same throughout a packet’s journey within a single LAN, while IP addresses may change via NAT (Network Address Translation) but typically remain unchanged across the internet.
理解 MAC 地址与 IP 地址的区别是经典的考试题目。MAC 地址是一个 48 位的物理地址(例如 00:1A:2B:3C:4D:5E),硬编码在网络接口卡中,用于本地网段内的通信。IP 地址是由软件分配的逻辑地址(例如 192.168.0.5),用于跨不同网络的端到端路由。在数据包于单个局域网内传输的过程中,MAC 地址保持不变;而通过 NAT(网络地址转换)IP 地址可能会变,但在整个互联网上通常保持不变。
The ARP (Address Resolution Protocol) is used to map IP addresses to MAC addresses within a local network. When a device wants to send data to an IP address on the same LAN, it broadcasts an ARP request asking “Who has this IP address?” and the owner replies with its MAC address.
ARP(地址解析协议)用于在本地网络内将 IP 地址映射为 MAC 地址。当一台设备想向同一局域网内的某个 IP 地址发送数据时,它会广播一个 ARP 请求,询问“谁拥有这个 IP 地址?”,拥有者则用其 MAC 地址进行回复。
10. Common Protocols and Their Port Numbers | 常用协议及其端口号
AQA expects you to recall which ports are associated with certain protocols, especially those in the Application layer. The key ones are: HTTP uses port 80, HTTPS uses port 443, FTP uses ports 20 (data) and 21 (control), SMTP uses port 25 (or 587 for submission), IMAP uses port 143 (or 993 for IMAPS), and DNS uses port 53. At the Transport layer, TCP and UDP do not use port numbers themselves but carry them in their headers to address specific services.
AQA 希望你记住某些协议关联的端口号,特别是应用层的协议。关键的有:HTTP 使用端口 80,HTTPS 使用端口 443,FTP 使用端口 20(数据)和 21(控制),SMTP 使用端口 25(或 587 用于邮件提交),IMAP 使用端口 143(或 993 用于 IMAPS),DNS 使用端口 53。在传输层,TCP 和 UDP 本身不使用端口号,但会在其头部携带端口号以定位特定服务。
| Protocol | 协议 | Port(s) | Transport |
|---|---|---|---|
| HTTP | 超文本传输协议 | 80 | TCP |
| HTTPS | 安全超文本传输协议 | 443 | TCP |
| FTP | 文件传输协议 | 20, 21 | TCP |
| SMTP | 简单邮件传输协议 | 25 | TCP |
| IMAP | 互联网消息访问协议 | 143 | TCP |
| DNS | 域名系统 | 53 | UDP/TCP |
11. TCP vs UDP – Reliability, Ordering, and Speed | TCP 与 UDP——可靠性、排序与速度
TCP and UDP are often compared in exam questions. TCP is connection-oriented: it uses a three-way handshake (SYN, SYN-ACK, ACK) to set up a session, assigns sequence numbers to segments so they can be reassembled in order, and uses acknowledgements and retransmissions to guarantee delivery. This makes TCP highly reliable but adds latency and overhead.
考试中经常比较 TCP 和 UDP。TCP 是面向连接的:它通过三次握手(SYN、SYN-ACK、ACK)建立会话,为数据段分配序列号以便按序重组,并使用确认和重传机制来保证交付。这使得 TCP 非常可靠,但会增加延迟和开销。
UDP, on the other hand, is connectionless. It sends datagrams without prior setup, does not number them, and provides no guarantee of delivery or order. Consequently, UDP has much lower overhead and is ideal for real-time applications like VoIP (Voice over IP), live video, and multiplayer gaming, where a few lost packets are less disruptive than the delay of retransmission.
相比之下,UDP 是无连接的。它无需预先设置即可发送数据报,不对它们编号,也不保证交付或顺序。因此,UDP 的开销低得多,非常适合实时应用,如 VoIP(IP 语音)、直播视频和多人在线游戏,在这些场景中,丢失几个数据包的破坏性远小于重传带来的延迟。
12. End-to-End Journey of a Web Request | 一次网页请求的端到端旅程
Let’s trace what happens when a user types a URL into a browser. The Application layer constructs an HTTP GET request. The Transport layer wraps it in a TCP segment with a destination port 80 (or 443 for HTTPS), using a random source port. The Network layer encapsulates the segment in an IP packet addressed to the server’s IP. The Link layer frames the packet with the MAC address of the local gateway router and transmits the frame.
让我们追溯一下用户在浏览器中输入网址时会发生什么。应用层构建一个 HTTP GET 请求。传输层将其封装在目标端口 80(或 HTTPS 时端口 443)和随机源端口的 TCP 段中。网络层将该段封装在目标为服务器 IP 地址的 IP 数据包中。链路层用本地网关路由器的 MAC 地址封装该数据包形成帧,并将其发送出去。
Routers along the way strip the Link layer headers, examine the IP header, determine the next hop, re-encapsulate with new MAC addresses, and forward the packet. At the server, the reverse process occurs until the Application layer receives the HTTP request. The server then sends back an HTTP response containing the webpage, which follows the same layered journey back to the client. Understanding this entire flow not only secures marks on layered model questions but also strengthens your grasp of how the internet actually works.
沿途的路由器会剥离链路层头部,检查 IP 头部,确定下一跳,用新的 MAC 地址重新封装,然后转发数据包。在服务器端,发生相反的过程,直到应用层接收到 HTTP 请求。然后服务器发回包含网页内容的 HTTP 响应,该响应沿着相同的分层路径返回客户端。理解整个流程不仅能在分层模型题目中得分,还能加深你对互联网实际运行方式的理解。
Published by TutorHao | GCSE AQA Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply