# 网络层

网络层是OSI参考模型的第3层，负责通过附加地址、选择路由和处理数据包大小限制，将数据包从源主机跨越多个网络传送到目的主机。在运行互联网的TCP/IP协议族中，这项工作由网际层完成，其核心协议是网际协议（IP）。

| 关键事实 | 详情 |
|---|---|
| 在模型中的位置 | OSI第3层；对应TCP/IP模型的网际层<sup>[1](https://www.cse.wustl.edu/~jain/cse4703-26/ftp/i_1cniy.pdf)</sup> |
| 核心功能 | 寻址与分片，其中路径选择称为路由<sup>[2](https://www.rfc-editor.org/rfc/rfc791.html)</sup> |
| 服务模型 | 无连接数据报交付；数据报可能乱序到达、丢失、重复或包含错误<sup>[3](https://datatracker.ietf.org/doc/rfc1812/)</sup> |
| 地址长度 | IPv4中为32位，IPv6中扩展至128位<sup>[4](https://www.rfc-editor.org/info/rfc8200/)</sup> |
| 最小MTU | 每条IPv4链路必须支持68个八位组或更大的MTU；IPv6要求下层支持1280字节的MTU<sup>[5](https://datatracker.ietf.org/doc/html/rfc8900)</sup><sup> • </sup><sup>[6](https://www.rfc-editor.org/info/rfc3819/)</sup> |
| 分片责任 | IPv4路由器可分片；IPv6路由器从不对数据包分片，只有发送方可以<sup>[7](https://www.rfc-editor.org/info/rfc7915/)</sup> |
| 配套协议 | ICMP（错误报告、流量控制、首跳路由器重定向）和IGMP（组播组成员管理）是网际层的组成部分<sup>[3](https://datatracker.ietf.org/doc/rfc1812/)</sup> |

## 该层的功能

网络层位于链路层与传输层之间。链路层在单个物理网络（如以太网或Wi-Fi）上承载帧，传输层则管理进程之间的端到端通信。网络层的数据单位是数据包，其核心工作是转发：每台路由器检查数据包的目的地址，在路由表中查找，并选择通往目的地的下一跳<sup>[3](https://datatracker.ietf.org/doc/rfc1812/)</sup>。最初的IP规范将该协议的两项基本功能描述为寻址和分片，而为传输选择路径则称为路由<sup>[2](https://www.rfc-editor.org/rfc/rfc791.html)</sup>。

该层提供的服务刻意保持简单。互联网的各组成网络只需提供数据包的无连接传输，IP服务规范允许数据报乱序到达、丢失、重复或损坏<sup>[3](https://datatracker.ietf.org/doc/rfc1812/)</sup>。可靠性留给TCP等传输层协议，由它们在IP之上增加端到端重传、重排序和连接控制<sup>[3](https://datatracker.ietf.org/doc/rfc1812/)</sup>。这种分工正是网络层常被描述为将上层与底层网络细节隔离开来的原因<sup>[8](https://www.cs.ait.ac.th/~on/O/oreilly/tcpip/tcpip/ch01_02.htm)</sup>。

## 寻址与路由

每个数据包都携带其目的地的逻辑地址，IP层的目标就是通过在许多网络中路由，将数据包投递到该地址<sup>[9](https://www.cs.cornell.edu/courses/cs4410/2018su/lectures/lec22-routing.html)</sup>。路由被视为路由器而非主机的问题：RFC 1812指出，路由是复杂的，应当由路由器执行，从而使主机软件不受互联网路由架构变化的影响<sup>[3](https://datatracker.ietf.org/doc/rfc1812/)</sup>。

路由按层次组织。在一个自治系统（由一个运营者控制的网络；网络之间的路由单元）内部，OSPF和RIP等内部协议决定数据包如何在路由器之间移动；在自治系统之间，边界路由器使用AS-PATH长度等路径属性来选择路由<sup>[10](https://w3.cs.jmu.edu/kirkpams/OpenCSF/Books/csf/html/NetLayer.html)</sup>。一台路由器连接两个或多个逻辑接口，转发依赖于路由数据库，也称为路由表或转发表；“路由器”一词本身就源于构建该表的过程<sup>[3](https://datatracker.ietf.org/doc/rfc1812/)</sup>。

## 分片与MTU

各网络所能承载的最大数据包不同，称为最大传输单元（MTU）。当数据包长于路径MTU时，必须分成多个分片，每个分片都有自己的IP首部，并在接收端重组<sup>[5](https://datatracker.ietf.org/doc/html/rfc8900)</sup>。IPv4允许沿途路由器对数据包分片。IPv6改变了这一点：路由器从不对数据包分片，只有发送主机可以分片，需要时使用分片首部<sup>[7](https://www.rfc-editor.org/info/rfc7915/)</sup><sup> • </sup><sup>[4](https://www.rfc-editor.org/info/rfc8200/)</sup>。IPv6转而依赖路径MTU发现，由源端获知沿途最小的MTU并据此确定数据包大小<sup>[6](https://www.rfc-editor.org/info/rfc3819/)</sup>。

下限值由规范设定。IPv4要求每条链路支持68个八位组或更大的MTU<sup>[5](https://datatracker.ietf.org/doc/html/rfc8900)</sup>，而IPv6要求下层支持1280字节的MTU<sup>[6](https://www.rfc-editor.org/info/rfc3819/)</sup>。重组有其自身规则：如果在首个到达的分片之后60秒内到达的分片不足，必须放弃重组并丢弃已收到的分片<sup>[4](https://www.rfc-editor.org/info/rfc8200/)</sup>。由于分片曾被用于攻击，RFC 5722规定IPv6主机必须静默丢弃重叠分片<sup>[11](https://arxiv.org/abs/2309.03525)</sup>，RFC 8900则记录了为何在实践中依赖IP分片是脆弱的<sup>[5](https://datatracker.ietf.org/doc/html/rfc8900)</sup>。

## IPv4与IPv6

IPv4于1981年在RFC 791中规定，是承载早期互联网的版本。IPv6在RFC 8200中规定，被设计为其后继者，最突出的变化是将地址长度从32位扩展到128位，以支持更多层次的寻址体系、多得多的可寻址节点以及更简单的自动配置<sup>[4](https://www.rfc-editor.org/info/rfc8200/)</sup>。IPv6还通过删除或将部分IPv4字段设为可选来简化首部，增加了流标记能力，并规定了认证和隐私方面的扩展<sup>[4](https://www.rfc-editor.org/info/rfc8200/)</sup>。

部署是渐进的。谷歌的测量显示，使用IPv6访问其服务的用户占比在2026年首次达到50%，而APNIC Labs截至2026年4月测得全球IPv6能力约为42%<sup>[12](https://blog.apnic.net/2026/04/28/google-hits-50-ipv6/?trk=article-ssr-frontend-pulse_little-text-block)</sup>。两个版本共存，RFC 7915等转换算法在两者之间进行转换<sup>[7](https://www.rfc-editor.org/info/rfc7915/)</sup>。

## 在协议模型中的位置

OSI七层模型和TCP/IP模型以不同粒度描述同一领域。在标准映射中，OSI网络层对应TCP/IP网际层，而OSI的应用层、表示层和会话层合并为TCP/IP应用层，OSI的数据链路层和物理层则成为TCP/IP网络接入层<sup>[1](https://www.cse.wustl.edu/~jain/cse4703-26/ftp/i_1cniy.pdf)</sup>。TCP/IP网际层由IP、ICMP和IGMP组成；ICMP提供错误报告、流量控制和首跳路由器重定向，IGMP则让主机和路由器加入和离开组播组<sup>[3](https://datatracker.ietf.org/doc/rfc1812/)</sup>。

## 历史

该层的设计直接源自ARPANET。DARPA的项目经理罗伯特·卡恩（Robert Kahn）和温顿·瑟夫（Vinton Cerf）于20世纪70年代开始研究后来成为[传输控制协议](https://www.edgepedia.org/zh/transmission-control-protocol)和网际协议的内容<sup>[13](https://www.darpa.mil/news/features/arpanet)</sup>。1983年1月1日，ARPANET在所有主机上从没有互联能力的网络控制程序切换到TCP/IP，这一事件通常被视为作为互联网络的互联网的诞生<sup>[14](https://www.tomshardware.com/networking/arpanet-standardized-tcp-ip-on-this-day-in-1983-43-year-old-standard-set-the-foundations-for-todays-internet)</sup>。这次转换还使ARPANET得以拆分为用于军事作战的MILNET和用于研究的ARPANET<sup>[15](https://www.internetsociety.org/internet/history-internet/brief-history-internet/)</sup>。保持网络层简单、将可靠性推向端点的设计选择，可追溯到分组交换、去中心化的ARPANET架构——其中每个节点都能路由数据包，流量可绕过故障节点<sup>[16](https://time.com/3659180/time-to-build-a-more-secure-internet/)</sup>。

## References

1. [Computer Networks and the Internet (Raj Jain, Washington University in St. Louis)](https://www.cse.wustl.edu/~jain/cse4703-26/ftp/i_1cniy.pdf)
2. [RFC 791: Internet Protocol, RFC Editor](https://www.rfc-editor.org/rfc/rfc791.html)
3. [RFC 1812: Requirements for IP Version 4 Routers, RFC Editor](https://datatracker.ietf.org/doc/rfc1812/)
4. [RFC 8200: Internet Protocol, Version 6 (IPv6) Specification, RFC Editor](https://www.rfc-editor.org/info/rfc8200/)
5. [RFC 8900: IP Fragmentation Considered Fragile, RFC Editor](https://datatracker.ietf.org/doc/html/rfc8900)
6. [RFC 3819: Advice for Internet Subnetwork Designers, RFC Editor](https://www.rfc-editor.org/info/rfc3819/)
7. [RFC 7915: IP/ICMP Translation Algorithm, RFC Editor](https://www.rfc-editor.org/info/rfc7915/)
8. [TCP/IP: Chapter 1, A Data Communications Model, O'Reilly](https://www.cs.ait.ac.th/~on/O/oreilly/tcpip/tcpip/ch01_02.htm)
9. [CS 4410 Lecture 22: Routing, Cornell University](https://www.cs.cornell.edu/courses/cs4410/2018su/lectures/lec22-routing.html)
10. [Internet Layer: IP, Computer Systems Fundamentals, James Madison University](https://w3.cs.jmu.edu/kirkpams/OpenCSF/Books/csf/html/NetLayer.html)
11. [A New Model for Testing IPv6 Fragment Handling, arXiv](https://arxiv.org/abs/2309.03525)
12. [Google hits 50% IPv6, APNIC Blog](https://blog.apnic.net/2026/04/28/google-hits-50-ipv6/?trk=article-ssr-frontend-pulse_little-text-block)
13. [ARPANET, DARPA](https://www.darpa.mil/news/features/arpanet)
14. [ARPANET standardized TCP/IP on this day in 1983, Tom's Hardware](https://www.tomshardware.com/networking/arpanet-standardized-tcp-ip-on-this-day-in-1983-43-year-old-standard-set-the-foundations-for-todays-internet)
15. [A Brief History of the Internet, Internet Society](https://www.internetsociety.org/internet/history-internet/brief-history-internet/)
16. [Time to Build a More Secure Internet, TIME](https://time.com/3659180/time-to-build-a-more-secure-internet/)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 网络与安全 › Networking fundamentals and architecture › Networking fundamentals overview

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/network-layer

English original: https://www.edgepedia.org/network-layer
