TCP/IP Key Points Explained | TCP/IP 考点精讲

📚 TCP/IP Key Points Explained | TCP/IP 考点精讲

The TCP/IP protocol suite is the foundation of the modern Internet, enabling reliable communication across diverse networks. Understanding its layered architecture, key protocols, and addressing schemes is essential for IB and CIE Computer Science students. This article breaks down the core concepts you need to master for the exam.

TCP/IP 协议族是现代互联网的基础,使得跨异构网络的可靠通信成为可能。理解其分层体系结构、关键协议以及寻址方案,对 IB 和 CIE 计算机科学的学生至关重要。本文分解了你在考试中必须掌握的核心概念。

1. Overview of the TCP/IP Model | TCP/IP 模型概述

The TCP/IP model is a four-layer conceptual framework used to standardize network communication. From top to bottom, the layers are: Application, Transport, Internet, and Network Access. It was developed by the US Department of Defense and is simpler than the OSI model, directly reflecting the real-world protocol stack used on the Internet.

TCP/IP 模型是一个四层概念框架,用于标准化网络通信。从上到下依次为:应用层、传输层、网际层和网络接入层。它由美国国防部开发,比 OSI 模型更简洁,直接反映了互联网上实际使用的协议栈。

Each layer has specific responsibilities: the Application layer handles high-level protocols like HTTP and SMTP; the Transport layer manages end-to-end communication (TCP, UDP); the Internet layer routes packets across networks (IP); and the Network Access layer deals with hardware addressing and physical transmission.

每一层都有特定职责:应用层处理像 HTTP 和 SMTP 这样的高级协议;传输层管理端到端通信(TCP、UDP);网际层在网络间路由数据包(IP);网络接入层负责硬件寻址和物理传输。


2. Comparison with the OSI Model | 与 OSI 模型的比较

The OSI model has seven layers, while TCP/IP has four. The upper three OSI layers (Application, Presentation, Session) are combined into the single Application layer in TCP/IP. The OSI Data Link and Physical layers correspond to TCP/IP’s Network Access layer. The diagram below illustrates the mapping.

OSI 模型有七层,而 TCP/IP 有四层。OSI 的上三层(应用层、表示层、会话层)在 TCP/IP 中被合并为一个应用层。OSI 的数据链路层和物理层对应 TCP/IP 的网络接入层。下图说明了这种映射。

While OSI is a theoretical model, TCP/IP is practically implemented. Exam questions often ask you to compare them: TCP/IP is protocol-driven, whereas OSI is a generic reference model. Key protocols like IP and TCP live at the Internet and Transport layers respectively in both models.

OSI 是理论模型,而 TCP/IP 是实际实现的。考题常要求你比较它们:TCP/IP 是协议驱动的,而 OSI 是一个通用参考模型。像 IP 和 TCP 这样的关键协议在两种模型中分别位于网际层和传输层。


3. The Application Layer | 应用层

This topmost layer provides network services directly to user applications. It includes protocols such as HTTP/HTTPS for web browsing, FTP for file transfer, SMTP/POP3/IMAP for email, and DNS for domain name resolution. Each protocol uses specific port numbers to identify the service.

这一最顶层直接向用户应用程序提供网络服务。它包括诸如用于网页浏览的 HTTP/HTTPS、用于文件传输的 FTP、用于电子邮件的 SMTP/POP3/IMAP,以及用于域名解析的 DNS 等协议。每个协议使用特定的端口号来标识服务。

In the TCP/IP model, the Application layer is also responsible for data formatting, encryption (TLS/SSL), and session management—tasks that are separate in the OSI model. For the exam, remember the common protocols, their purposes, and their default port numbers.

在 TCP/IP 模型中,应用层还负责数据格式化、加密(TLS/SSL)和会话管理——这些任务在 OSI 模型中是分离的。考试中要记住常见协议、它们的用途以及默认端口号。


4. The Transport Layer: TCP and UDP | 传输层:TCP 与 UDP

The Transport layer ensures data is delivered reliably (or not) between processes running on different hosts. The two main protocols are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). TCP provides connection-oriented, reliable, stream-oriented communication with error checking and flow control. UDP is connectionless and offers no guarantees, but is faster and simpler.

传输层确保在不同主机上运行的进程之间可靠地(或不保证地)传递数据。两个主要协议是 TCP(传输控制协议)和 UDP(用户数据报协议)。TCP 提供面向连接、可靠、面向流的通信,具有差错校验和流量控制。UDP 是无连接的,不提供保证,但更快、更简单。

TCP segments data into packets, numbers them, and reassembles them at the destination. It uses acknowledgements and retransmissions to recover lost packets. UDP just sends datagrams without setup, which is ideal for real-time applications like VoIP or video streaming where occasional loss is acceptable.

TCP 将数据分割成数据包,进行编号,并在目的地重新组装。它使用确认和重传来恢复丢失的数据包。UDP 只是发送数据报而无需建立连接,这非常适合实时应用,如 VoIP 或视频流,其中偶尔的丢失是可以接受的。


5. TCP Three-Way Handshake | TCP 三次握手

TCP establishes a connection using a three-way handshake before data transfer begins. The process involves SYN, SYN-ACK, and ACK flags. The client sends a SYN packet with a random sequence number (x). The server replies with a SYN-ACK, acknowledging x+1 and sending its own sequence number (y). The client then sends an ACK for y+1, and the connection is established.

TCP 在数据传输开始前,使用三次握手建立连接。过程涉及 SYN、SYN-ACK 和 ACK 标志。客户端发送一个带有随机序列号 (x) 的 SYN 包。服务器回复一个 SYN-ACK,确认 x+1 并发送自己的序列号 (y)。然后客户端发送对 y+1 的 ACK,连接建立。

This handshake synchronizes sequence numbers, allowing both sides to agree on initial values. Only after the handshake can reliable, ordered data transfer commence. Closing a connection typically uses a four-way handshake with FIN and ACK flags.

这个握手同步了序列号,使双方就初始值达成一致。只有在握手之后,可靠、有序的数据传输才能开始。关闭连接通常使用带有 FIN 和 ACK 标志的四次挥手。


6. Reliable Data Transfer and Flow Control | 可靠数据传输与流量控制

TCP guarantees reliable delivery through positive acknowledgements and retransmission. When a receiver gets a segment, it sends back an ACK with the next expected sequence number. If the sender does not receive an ACK within a timeout, it retransmits the segment. This ensures data eventually arrives correctly.

TCP 通过肯定确认和重传来保证可靠传递。当接收方收到一个报文段时,它发回一个带有下一个期望序列号的 ACK。如果发送方在超时内未收到 ACK,它就重传该报文段。这确保数据最终正确到达。

Flow control prevents a fast sender from overwhelming a slow receiver. TCP uses a sliding window mechanism: the receiver advertises a window size (the number of bytes it can accept). The sender can send only up to that amount of data without waiting for new ACKs. This dynamically adjusts to network conditions.

流量控制防止快速发送方压垮慢速接收方。TCP 使用滑动窗口机制:接收方通告一个窗口大小(它能接受的字节数)。发送方只能发送最多该数量的数据而不必等待新的 ACK。这会动态适应网络条件。


7. The Internet Layer: IP Addressing | 网际层:IP 地址

The Internet layer is responsible for logical addressing and routing packets across multiple networks. The core protocol is IP (Internet Protocol), currently in two versions: IPv4 and IPv6. IPv4 addresses are 32-bit numbers, usually written in dotted decimal (e.g., 192.168.1.1). IPv6 uses 128-bit addresses to solve address exhaustion.

网际层负责逻辑寻址以及跨多个网络路由数据包。核心协议是 IP(互联网协议),目前有两个版本:IPv4 和 IPv6。IPv4 地址是 32 位数字,通常写为点分十进制(例如 192.168.1.1)。IPv6 使用 128 位地址以解决地址枯竭问题。

Each IP packet contains source and destination IP addresses, a time-to-live (TTL) field to prevent infinite looping, and a protocol field indicating the transport-layer protocol (e.g., 6 for TCP, 17 for UDP). IP is connectionless and best-effort; reliability is left to upper layers.

每个 IP 数据包包含源和目的 IP 地址、一个用于防止无限循环的生存时间(TTL)字段,以及一个指示传输层协议的协议字段(例如,6 代表 TCP,17 代表 UDP)。IP 是无连接的、尽力而为的;可靠性留给上层处理。


8. IPv4 Addressing and Subnetting | IPv4 地址与子网划分

IPv4 addresses are divided into network and host portions, determined by the subnet mask. A subnet mask is a 32-bit value with contiguous 1s for the network part and 0s for the host part (e.g., 255.255.255.0). CIDR notation represents this succinctly: 192.168.1.0/24, where /24 indicates 24 network bits.

IPv4 地址分为网络部分和主机部分,由子网掩码决定。子网掩码是一个 32 位的值,网络部分为连续的 1,主机部分为 0(例如,255.255.255.0)。CIDR 表示法简洁地表示这一点:192.168.1.0/24,其中 /24 表示 24 个网络位。

Subnetting allows a large network to be split into smaller sub-networks. To calculate the number of subnets: 2n, where n is the number of borrowed host bits. The number of usable hosts per subnet is 2h – 2, where h is the number of remaining host bits (minus network and broadcast addresses).

子网划分允许将一个大型网络分割成更小的子网。计算子网数量:2n,其中 n 是借用的主机位数。每个子网中可用的主机数为 2h – 2,其中 h 是剩余主机位数(减去网络地址和广播地址)。


9. Routing and Packet Forwarding | 路由与数据包转发

Routers operate at the Internet layer and use routing tables to forward packets toward their destination. Each entry in a routing table contains a destination network, subnet mask, next-hop gateway, and metric. When a packet arrives, the router performs a longest prefix match to find the best route.

路由器在网际层工作,使用路由表将数据包转发到目的地。路由表中的每一项包含目的网络、子网掩码、下一跳网关和度量值。当数据包到达时,路由器执行最长前缀匹配以找到最佳路由。

Routing can be static (manually configured) or dynamic (using protocols like RIP, OSPF, BGP). The TTL field is decremented at each hop; if it reaches zero, the packet is discarded and an ICMP ‘time exceeded’ message is sent back, enabling tools like traceroute.

路由可以是静态的(手动配置)或动态的(使用 RIP、OSPF、BGP 等协议)。TTL 字段在每一跳递减;如果到达零,数据包被丢弃,并发送回一条 ICMP ‘超时’消息,这使得像 traceroute 这样的工具成为可能。


10. Common Protocols and Port Numbers | 常见协议与端口号

Memorizing well-known port numbers is critical for the exam. The table below lists the most important ones you will encounter in TCP/IP networking, along with the transport protocol and description.

记忆熟知端口号对考试至关重要。下表列出了你在 TCP/IP 网络中会遇到的最重要的端口号,以及对应的传输协议和描述。

Port Protocol Service
20, 21 TCP FTP (File Transfer Protocol)
22 TCP SSH (Secure Shell)
23 TCP Telnet
25 TCP SMTP (Simple Mail Transfer Protocol)
53 TCP/UDP DNS (Domain Name System)
80 TCP HTTP (Hypertext Transfer Protocol)
110 TCP POP3 (Post Office Protocol v3)
143 TCP IMAP (Internet Message Access Protocol)
443 TCP HTTPS (HTTP Secure)

UDP is used by DNS (port 53 for simple queries), DHCP (ports 67, 68), and TFTP (port 69). In the exam, you might be asked to identify a protocol from a given port number or to explain why a specific transport protocol is chosen.

UDP 用于 DNS(简单查询使用端口 53)、DHCP(端口 67、68)和 TFTP(端口 69)。在考试中,你可能会被要求从给定的端口号识别协议,或解释为什么选择特定的传输协议。


Published by TutorHao | Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading