A2.1.4 · Network fundamentals
A2.1.4 · 网络基础
Network Protocols
网络协议
Typing a website address into a browser quietly triggers several different protocols working in a precise sequence, one making sure the device even has an address to communicate from, others making sure the actual request gets there, back, and in a form the browser understands.
在浏览器中输入一个网址,会悄然触发若干不同协议按精确的顺序协同工作:一个确保设备本身有一个可用于通信的地址,其他协议则确保实际的请求能够送达、返回,并以浏览器能够理解的形式呈现。
Explainer
讲解
A protocol is an agreed set of rules that defines exactly how data is formatted, sent and received across a network, so that two devices from completely different manufacturers can still understand each other.
协议是一套约定的规则,精确定义了数据在网络中如何被格式化、发送与接收,使来自完全不同厂商的两台设备依然能够彼此理解。
The five protocols in this statement split into two jobs: TCP and UDP work at the transport layer, getting data reliably (or quickly) between two applications; HTTP, HTTPS and DHCP work at the application layer, defining what that data actually means once it arrives.
本条考纲陈述涉及的五种协议分属两种职责:TCP 与 UDP 工作在传输层,负责在两个应用程序之间可靠地(或快速地)传递数据;HTTP、HTTPS 与 DHCP 工作在应用层,定义数据到达之后实际代表什么含义。
Explainer
讲解
TCP vs UDP
TCP 与 UDP
Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) both move data between two applications, identified by port numbers (think of a port number as an apartment number: the IP address (Internet Protocol address, the number identifying a device on a network) gets a packet to the right building, the port number gets it to the right door). They make very different trade-offs to do it.
传输控制协议(Transmission Control Protocol, TCP)与用户数据报协议(User Datagram Protocol, UDP)都在两个应用程序之间传递数据,由端口号来标识(可以把端口号想象成公寓的门牌号:IP 地址,即标识网络上某设备的编号,把数据包送到正确的大楼,端口号则把它送到正确的房门)。但它们为此做出的取舍截然不同。
Real example: loading a web page, where every byte of the page has to arrive, correctly and in order, or the page breaks.
真实例子:加载一个网页,页面的每一个字节都必须正确、按序到达,否则页面就会出错。
- Reliable and ordered (connection-oriented: it confirms the connection first, then acknowledges every piece of data, resending anything lost or corrupted)
- 可靠且有序 (面向连接:先确认连接,再对每一份数据进行确认,任何丢失或损坏的数据都会被重新发送)
- Slower, more overhead (setting up the connection and tracking every acknowledgement takes real time and resources that a simpler protocol wouldn't spend)
- 速度较慢,开销较大 (建立连接以及追踪每一次确认都需要花费真实的时间与资源,而更简单的协议不会有这些开销)
Real example: a live video call, where an occasional dropped frame matters far less than the call falling out of sync in real time.
真实例子:实时视频通话,偶尔丢失一帧远不如通话实时失去同步来得重要。
- Fast, low overhead (connectionless: data is simply sent, with no setup, no acknowledgement and no resending, which keeps genuinely real-time data flowing without delay)
- 速度快,开销低 (无连接:数据直接发送,没有建立连接、没有确认、也没有重发,这让真正的实时数据能够不间断地流动)
- No guarantee of delivery or order (a lost or out-of-order piece of data is simply gone, which would be unacceptable for something like a bank transfer)
- 不保证送达或顺序 (丢失或乱序的数据就此消失,这对于银行转账之类的场景是无法接受的)
Explainer
讲解
HTTP and HTTPS
HTTP 与 HTTPS
Web pages travel between a browser and a server using Hypertext Transfer Protocol (HTTP). A browser sends a request, the server sends back a response, and neither side remembers anything about it afterwards (HTTP is stateless, each request stands alone).
网页借助超文本传输协议(Hypertext Transfer Protocol, HTTP)在浏览器与服务器之间传输。浏览器发送一个请求,服务器发回一个响应,之后双方都不会记住这次交互(HTTP 是无状态的,每一个请求都是独立的)。
Request: GET /menu.html HTTP/1.1
Host: www.chloescafe-example.com
Response: HTTP/1.1 404 Not Found
Here the café's menu page doesn't actually exist at that address, so the server reports 404 rather than pretending the request worked. A successful request instead gets a 200 status code back, HTTP's way of reporting a specific outcome, not just a bare success or failure.
在这个例子中,咖啡馆的菜单页面在该地址上其实并不存在,所以服务器报告 404,而不是假装请求成功了。一次成功的请求则会返回 200 状态码,这是 HTTP 报告具体结果的方式,而不只是简单的成功或失败。
Take HTTP and add three things, and the result is called Hypertext Transfer Protocol Secure (HTTPS): encryption (so intercepted data is unreadable), authentication (a certificate proving the server really is who it claims to be), and data integrity (proof the data wasn't altered in transit). It is not a separate protocol with a different purpose, it's HTTP made safe to use for anything sensitive.
在 HTTP 的基础上加入三样东西,结果就被称为超文本传输安全协议(Hypertext Transfer Protocol Secure, HTTPS):加密(使截获的数据无法被读取)、身份验证(通过证书证明服务器确实是其所声称的那一方),以及数据完整性(证明数据在传输过程中未被篡改)。它并不是一个具有不同用途的独立协议,而是让 HTTP 变得足够安全,可用于任何敏感信息的传输。
Worked example
示例讲解
DHCP: joining a network
DHCP:加入网络
Dynamic Host Configuration Protocol (DHCP) is how a device gets an IP address the moment it joins a network, without anyone typing one in by hand. Aria's laptop joining a café's WiFi for the first time goes through the exact same four-step exchange every device does.
动态主机配置协议(Dynamic Host Configuration Protocol, DHCP)是设备在加入网络的那一刻自动获得 IP 地址的方式,无需任何人手动输入。Aria 的笔记本电脑第一次连接一家咖啡馆的 WiFi 时,会经历与每一台设备完全相同的四步交换过程。
Discover. The laptop has no address yet, so it broadcasts a message to the whole network: "is there a DHCP server here, and can you give me an address?"
发现(Discover)。笔记本电脑还没有地址,于是向整个网络广播一条消息:"这里有 DHCP 服务器吗?能给我分配一个地址吗?"
Offer. The café's router, running a DHCP server, replies with an available address from its own pool.
提供(Offer)。咖啡馆运行 DHCP 服务器的路由器,从自己的地址池中回复一个可用的地址。
Request. The laptop confirms it wants to actually use that specific address (another device could have made an offer too, so this step avoids a mix-up).
请求(Request)。笔记本电脑确认自己确实要使用这个特定地址(可能还有其他设备也收到了提供,所以这一步可以避免混乱)。
Acknowledge. The server confirms the address is now leased to the laptop for a set period, along with other details like which DNS server (Domain Name System, the service that turns a typed web address into an IP address) to use. The laptop can now actually communicate on the network.
确认(Acknowledge)。服务器确认该地址现已租给这台笔记本电脑,租期为一段固定时长,同时附带其他信息,例如应使用哪个 DNS 服务器(Domain Name System,将输入的网址转换为 IP 地址的服务)。此时笔记本电脑才真正能够在网络上通信。
The address is leased, not owned permanently. When that lease runs out, the same request-and-confirm exchange has to happen again, which is what lets a busy network (like a café's guest WiFi) reuse a limited pool of addresses as different customers come and go.
该地址是被租用的,而不是永久拥有。当租期到期时,同样的请求与确认交换必须再次发生,这正是繁忙的网络(比如咖啡馆的访客 WiFi)能够在顾客不断来来去去时,重复利用有限地址池的原因。
Check your understanding
检验你的理解
A company is building two features: a system that streams live security camera footage (an occasional dropped frame is fine, but delay is not), and a system that transfers signed legal contracts (every byte must arrive intact, even if it takes longer). Which transport protocol suits each feature?
某公司正在开发两个功能:一个是实时传输安防摄像头画面的系统(偶尔丢一帧没关系,但延迟不行),另一个是传输已签署法律合同的系统(即使耗时更长,每个字节都必须完整到达)。每个功能各自适合哪种传输层协议?
Common mistake
常见错误
RecurringA common weak answer describes HTTPS as if it were a completely separate protocol built for a different purpose than HTTP, rather than recognising it as HTTP itself with security features layered on top. HTTPS still carries the exact same web pages, requests and responses as HTTP, it just does so encrypted, authenticated and tamper-checked.
反复出现一个常见的薄弱答案,会把 HTTPS 描述成一个完全独立、用途也不同于 HTTP 的协议,而不是认识到它其实就是叠加了安全功能的 HTTP。HTTPS 依然传输与 HTTP 完全相同的网页、请求与响应,只是这些内容被加密、经过身份验证并防止篡改。
Treated as unrelated: "HTTP is for normal websites and HTTPS is for secure websites, they're two different systems." Implies HTTPS does a different JOB than HTTP, when it actually does the exact same job, more safely.
被当作互不相关: "HTTP 用于普通网站,HTTPS 用于安全网站,它们是两套不同的系统。" 这暗示 HTTPS 做的是与 HTTP 不同的工作,但实际上它做的是完全相同的工作,只是更安全。
Correctly framed as an extension: "HTTPS is HTTP with encryption, authentication and data integrity added, it carries the same requests and responses, just protected against interception and tampering." States the actual relationship between the two, rather than treating them as unrelated systems.
正确地表述为一种扩展: "HTTPS 就是加上了加密、身份验证与数据完整性的 HTTP,它传输相同的请求与响应,只是防止了被截获与篡改。" 准确说明了两者之间真正的关系,而不是把它们当作互不相关的系统。
Linking question
关联问题
How this connects to the rest of the syllabus
这与考纲其他部分的联系
The IB syllabus is deliberately woven together, not a stack of isolated topics. Here's how these protocols connect specifically to B2 (programming), worth thinking through, not just memorising: it's the kind of synthesis a Paper 1/2 question can genuinely ask for.
IB 考纲各主题之间是有意交织在一起的,而不是一堆孤立的知识点。以下是这些协议与 B2(编程)具体的联系,值得思考,而不只是记忆:这正是 Paper 1/2 题目真正可能要求的综合能力。
How do the concepts of binary and hexadecimal data structures relate to network communications? (Every field in a TCP segment or an IP address is ultimately just binary data, and MAC addresses and status codes are conventionally written in hexadecimal, the same number systems taught in B2 turn up directly inside the protocols on this page.)
二进制与十六进制数据结构的概念与网络通信有何关系?(TCP 段或 IP 地址中的每一个字段归根结底都只是二进制数据,而 MAC 地址与状态码则按惯例以十六进制书写,B2 所教的这些数制正是直接出现在本页所讲的协议内部。)
Revision questions
复习题
Past-paper style. Write an answer, then reveal the marking points and mark yourself.
采用历年真题风格。写下答案,然后展开评分要点给自己打分。
[2]State one situation where UDP is preferred over TCP, and explain why.
[2]陈述一种优先使用 UDP 而非 TCP 的情况,并解释原因。
Marking points
评分要点
- Any one: live video or voice calls, online gaming, or live streaming.
- UDP is preferred because it has no delivery guarantee and no re-sending, so it is faster and lower overhead; a late packet is useless for live media anyway, so speed matters more than perfect delivery.
- 任选其一:直播视频或语音通话、在线游戏,或直播流。
- 首选 UDP,因为它不保证送达、不重发,所以更快、开销更低;对于直播媒体,迟到的数据包本来就没用了,所以速度比完美送达更重要。
[3]Explain what HTTPS adds to a normal HTTP connection.
[3]解释 HTTPS 在普通 HTTP 连接的基础上增加了什么。
Marking points
评分要点
- HTTPS adds encryption, so intercepted data is unreadable.
- It adds authentication, using a digital certificate that proves the server really is who it claims to be.
- It adds integrity checking, so tampering with the data in transit is detected.
- It carries the same requests and responses as HTTP, just protected.
- HTTPS 加了加密,使被拦截的数据无法读懂。
- 它加了认证,用一份数字证书证明服务器确实是它所声称的对象。
- 它加了完整性校验,所以传输中对数据的篡改会被检测到。
- 它承载与 HTTP 相同的请求和响应,只是受到保护。
[4]Describe the sequence of messages exchanged when a device first requests an IP address from a DHCP server.
[4]描述设备首次向 DHCP 服务器请求 IP 地址时所交换的消息序列。
Marking points
评分要点
- Discover: the device has no address, so it broadcasts a request asking if a DHCP server is present.
- Offer: a DHCP server replies with an available IP address from its pool.
- Request: the device replies confirming it wants that specific address (this avoids a mix-up if more than one server made an offer).
- Acknowledge: the server confirms the address is now leased to the device for a set period, and sends other details such as the DNS server address.
- 发现:设备没有地址,所以广播一个请求,询问是否有 DHCP 服务器。
- 提供:一台 DHCP 服务器从它的地址池中回复一个可用的 IP 地址。
- 请求:设备回复确认它要用那个特定的地址(如果不止一台服务器给出了提供,这一步可避免混淆)。
- 确认:服务器确认该地址现在租给设备一段固定时间,并发送 DNS 服务器地址等其他细节。
Flashcards
记忆卡片
Active recall for this statement’s key terms.
针对本条考纲陈述关键术语的主动回忆练习。
Keep this statement’s practice with you
把这条考纲陈述的练习保存下来
Free account: unlock every revision question and flashcard for A2.1.4, and every other IB CS 2027 statement.
免费账户:解锁 A2.1.4 以及所有其他 IB CS 2027 考纲陈述的全部复习题和记忆卡片。