# 标签分发协议

标签分发协议（Label Distribution Protocol，LDP）是为分发MPLS标签而定义的一种协议：它是一组过程和消息，标签交换路由器（Label Switched Router，LSR）通过将网络层路由信息直接映射到数据链路层交换路径，从而利用这组过程和消息在网络中建立标签交换路径（Label Switched Path，LSP）<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。在MPLS体系结构中，两台LSR必须就用于在彼此之间及穿过彼此转发流量的标签的含义达成一致，而这种共识是通过标签分发协议实现的——一台LSR通过该协议将其所做的标签绑定告知另一台LSR<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。LDP支持沿正常路由路径的逐跳转发，这一作用使其有别于RSVP-TE——后者是用于显式信令的流量工程路径的独立协议<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup><sup> • </sup><sup>[2](https://enable.network/blog/ldp-vs.-segment-routing)</sup>。

| 关键事实 | 详情 |
|---|---|
| 功能 | 在LSR之间分发标签绑定，使其能够为逐跳MPLS转发建立LSP<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup> |
| 首个规范 | RFC 3036，2001年1月由IETF MPLS工作组发布<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup> |
| 现行规范 | RFC 5036，2007年10月发布，取代RFC 3036；作者为L. Andersson、I. Minei和B. Thomas<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup> |
| 分发模式 | 下游按需（应显式请求发送绑定）以及向未请求的LSR主动分发<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup> |
| FEC关联 | 每条由LDP创建的LSP都与一个转发等价类（Forwarding Equivalence Class，FEC）相关联，该FEC指定哪些数据包映射到该LSP<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup> |
| 更新 | RFC 6720（GTSM）、RFC 6790（熵标签）、RFC 7358（标签通告规则）和RFC 7552（IPv6）更新了RFC 5036<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup> |
| 流量工程 | LDP没有让源端指定路径的机制；为此目的，通常会同时部署RSVP-TE<sup>[2](https://enable.network/blog/ldp-vs.-segment-routing)</sup> |

## 起源与规范

LDP最初于2001年1月作为RFC 3036发布。IETF的MPLS工作组创建了该协议，作者为洛阿·安德松（Loa Andersson）、保罗·杜兰（Paul Doolan）、南希·费尔德曼（Nancy Feldman）、安德烈·弗雷代特（Andre Fredette）和鲍勃·托马斯（Bob Thomas）。<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>现行规范RFC 5036于2007年10月由路由区域[多协议标签交换](https://www.edgepedia.org/zh/multiprotocol-label-switching)工作组内的L. Andersson、I. Minei和B. Thomas发布，取代了RFC 3036<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。

MPLS体系结构并不假定只有单一的标签分发协议。现有协议已被扩展，使得标签分发可以搭载于其上；同时也定义了新的协议，专门用于分发标签；该体系结构讨论了为特定MPLS应用（如流量工程）在其中进行选择的考量<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。LDP正是为此目的而专门定义的协议，其后RFC 5038记录了对它的实现调查<sup>[3](https://www.rfc-editor.org/info/rfc5038/)</sup>。

## 工作原理

LDP为其创建的每条LSP关联一个转发等价类（FEC）。FEC指定哪些数据包被“映射”到该LSP，随着每台LSR将某个FEC的入标签拼接到连接上，LSP在网络中得以延伸<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。一条LSP可以在直接相连的邻居处有端点——类似于IP逐跳转发——也可以在网络出口节点处有端点，从而能够经由所有中间节点进行交换<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。

**标签分发模式。** MPLS体系结构允许LSR响应另一台LSR的显式请求来分发FEC标签绑定，这称为下游按需标签分发。它也允许LSR向未显式请求的LSR分发标签绑定<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。下游按需变体后来被应用于无缝MPLS设计中，该设计面向设备数量多、计算和内存资源受限的接入网络；RFC 7032描述了该背景下LDP DoD的用例，并在标签请求消息中定义了一个可选TLV，用于快速启动收敛<sup>[4](https://pike.lysator.liu.se/docs/ietf/rfc/70/rfc7032.xml)</sup>。

**会话与环路控制。** 一旦LDP会话建立，LSR必须确保其对端在每个KeepAlive间隔内收到来自它的一个LDP PDU，以便重启对端的会话KeepAlive定时器；如果没有其他内容要发送，LSR就发送一条KeepAlive消息来满足这一要求。LSR可以随时使用Shutdown消息终止与对端的会话<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。LDP运行在TCP之上，规范中包含了防止伪造TCP段被引入LDP会话的机制<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。环路检测使用标签映射消息中的跳数和路径向量TLV：当LSR检测到环路时，它必须停止使用该标签进行转发、丢弃该消息，并向源端发出“检测到环路”状态<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。规范建议将环路检测与有序标签分发配合配置，以尽量减少标签映射更新消息的数量<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。

## 后续更新

有四个RFC更新了RFC 5036<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。RFC 6720为LDP规定了通用TTL安全机制（Generalized TTL Security Mechanism，GTSM），RFC 6790涵盖了熵标签在MPLS转发中的使用<sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。RFC 7358定义了LDP转发等价类的标签通告规则，规定了标签绑定如何在两台LSR之间通告<sup>[5](https://www.rfc-editor.org/rfc/rfc7358.html)</sup>。RFC 7552是一份互联网标准跟踪文档，纠正并澄清了在使用IPv6网络（无论是否同时使用IPv4）时LDP的行为，并更新了RFC 5036和RFC 6720<sup>[6](https://www.rfc-editor.org/info/rfc7552/)</sup>。

对LDP控制平面的安全分析指出，LDP自身不为其发现阶段和会话通信阶段提供任何安全保障，规范讨论了基于MD5的TCP消息摘要技术，用于确保LDP消息的真实性和完整性<sup>[7](https://www.rfc-editor.org/rfc/rfc6952.html)</sup><sup> • </sup><sup>[1](https://www.rfc-editor.org/info/rfc5036/)</sup>。

## LDP与RSVP-TE及段路由的比较

在经典MPLS网络中，LDP和RSVP-TE扮演互补的角色。LDP沿正常路由路径逐跳建立标签绑定，而RSVP-TE则维护一个独立的信令路径数据库，使用PATH和RESV消息、刷新定时器，并在每台中转路由器上维护每条LSP的状态<sup>[8](https://hellonetworking.net/posts/segment-routing-sr-mpls-srv6/)</sup>。由于LDP没有允许源端指定路径的机制，希望实现流量工程的网络不得不部署第二种协议，通常是RSVP-TE<sup>[2](https://enable.network/blog/ldp-vs.-segment-routing)</sup>。

段路由（Segment Routing）被提出用于流量工程、快速重路由和服务链等用例，它通过IGP的扩展来传递信令，而不是使用独立的标签分发协议<sup>[9](https://datatracker.ietf.org/doc/html/draft-li-spring-compare-sr-ldp-rsvpte-01)</sup>。其基本前提之一是消除对LDP和RSVP-TE等额外信令和标签分发协议的需求，利用路由协议本身（IGP、BGP）进行标签分发<sup>[10](https://www.arista.com/en/solutions/mpls-segment-routing)</sup>。取决于厂商的实现选择，采用独立LSP控制模式的LDP部署可能会增殖不必要的控制平面和数据平面状态，从而导致扩展性挑战<sup>[10](https://www.arista.com/en/solutions/mpls-segment-routing)</sup>。在实际比较中，LDP下的快速重路由由LFA或远程LFA提供，而RSVP-TE使用备份隧道，段路由则使用TI-LFA（拓扑无关无环替代路径）<sup>[11](https://www.ipinfusion.com/blog/segment-routing-traffic-engineering-sr-policies/)</sup>。LDP还通过已定义的同步过程（RFC 5443和RFC 6138）与IGP交互，而段路由的集成信令则避免了这一点<sup>[12](https://www.cisco.com/c/en/us/support/docs/multiprotocol-label-switching-mpls/mpls/215215-segment-routing-overview-and-migration-g.pdf/1000)</sup>。

## References

1. [RFC 5036: LDP Specification, RFC Editor](https://www.rfc-editor.org/info/rfc5036/)
2. [LDP vs. segment routing: The evolution of MPLS in modern networking, Enable Network Services](https://enable.network/blog/ldp-vs.-segment-routing)
3. [RFC 5038: The Label Distribution Protocol (LDP) Implementation Survey Results, RFC Editor](https://www.rfc-editor.org/info/rfc5038/)
4. [RFC 7032: LDP Downstream-on-Demand in Seamless MPLS](https://pike.lysator.liu.se/docs/ietf/rfc/70/rfc7032.xml)
5. [RFC 7358: Label Advertisement Discipline for LDP FECs, RFC Editor](https://www.rfc-editor.org/rfc/rfc7358.html)
6. [RFC 7552: Updates to LDP for IPv6, RFC Editor](https://www.rfc-editor.org/info/rfc7552/)
7. [RFC 6952: Analysis of LDP Security, RFC Editor](https://www.rfc-editor.org/rfc/rfc6952.html)
8. [Segment Routing: Simplifying the Routing Control Plane, Hello, Networking!](https://hellonetworking.net/posts/segment-routing-sr-mpls-srv6/)
9. [draft-li-spring-compare-sr-ldp-rsvpte-01: Comparison between Segment Routing and LDP/RSVP-TE, IETF](https://datatracker.ietf.org/doc/html/draft-li-spring-compare-sr-ldp-rsvpte-01)
10. [MPLS Segment Routing: Solutions and Applications, Arista](https://www.arista.com/en/solutions/mpls-segment-routing)
11. [Steering Traffic with Precision: Segment Routing Traffic Engineering Using SR Policies, IP Infusion](https://www.ipinfusion.com/blog/segment-routing-traffic-engineering-sr-policies/)
12. [Segment Routing Overview and Migration Guidelines, Cisco](https://www.cisco.com/c/en/us/support/docs/multiprotocol-label-switching-mpls/mpls/215215-segment-routing-overview-and-migration-g.pdf/1000)

---
*Initially written Oct 15, 2026*

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

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/label-distribution-protocol

English original: https://www.edgepedia.org/label-distribution-protocol
