LDP Label Distribution Modes and Label Spaces
RFC 5036 defines three pairs of choices for how LDP behaves: when to advertise a label, how much of what is received to keep, and in what order to advertise upstream. Only one of the three is selectable in real implementations; the others are fixed. This article explains the three pairs and the idea of a label space, then confirms what can be confirmed in an IOS XR (XRd) lab. The basics of LDP are covered in What Is LDP.
The three pairs
| Pair | RFC 5036 | Choices | What changes |
|---|---|---|---|
| Label advertisement | Section 2.6.3 | Downstream Unsolicited / Downstream on Demand | Whether a label is sent before being asked for |
| Label retention | Section 2.6.2 | liberal / conservative | Whether labels from non-next-hop peers are discarded |
| Label distribution control | Section 2.6.1 | independent / ordered | Whether a label may go upstream before one arrives from downstream |
All three share the same premise: the downstream LSR chooses the label and hands it upstream. In MPLS the receiving side picks the label, so the LSR nearer the destination is the one that says “use this label when you send to me”.
Label advertisement: DU and DoD
Downstream Unsolicited sends one Label Mapping for every prefix it holds as soon as the session comes up, without considering whether the peer will use them. Downstream on Demand waits for a Label Request from upstream and answers with the Label Mapping for that FEC.
DoD exists for environments such as ATM where label resources are scarce. On the Ethernet-based routers of today labels do not run out, so the default is DU.
On IOS XR, session downstream-on-demand with <ACL> under mpls ldp names the peers to use DoD with. Both routers must be configured or the session stays DU.
Label retention: liberal and conservative
LDP receives Label Mappings from every peer it has a session with. Only those from the next hop chosen by the IGP are actually used.
liberal keeps the rest as well. It costs memory, but when routing changes and the next hop swaps, the label it already holds can be used immediately. conservative keeps only the next hop’s and has to ask again when routing changes. It saves resources at the cost of convergence time.
Label distribution control: independent and ordered
independent allows an LSR to advertise its own label upstream before it has received one from downstream. ordered does not advertise upstream until a label has arrived from downstream, the egress LSR being the exception because it is the destination itself.
Ordered means labels are only advertised once the LSP is complete end to end, which avoids traffic entering an LSP that breaks partway. Independent gives up that guarantee in exchange for faster convergence.
What implementations actually let you choose
Only label advertisement is selectable. The other two are fixed per implementation.
| Implementation | Label advertisement | Label retention | Label distribution control |
|---|---|---|---|
| IOS XR | DU / DoD selectable | liberal only | independent only |
| IOS XE | DU / DoD selectable | liberal only | independent only |
| Junos | DU / DoD selectable | liberal only | ordered only |
All three use liberal retention. Label distribution control is the opposite between Cisco and Juniper. Juniper’s documentation states plainly, “Ordered mode is supported, but not Independent mode.”
IOS XE has mpls ldp atm control-mode which accepts ordered and independent, but it applies only to LC-ATM interfaces, not to Ethernet. The RFC offers two choices because it had to cover ATM as well; router implementations have settled on liberal plus independent, or liberal plus ordered.
When control mode differs across a mixed network, the LDP message exchange itself is unchanged. Only the order in which the LSP completes differs.
This lab confirms only label advertisement and label retention. Label distribution control cannot be configured, so it was not observed.
Label spaces
A label space is the scope in which an LSR manages label values (RFC 5036 section 2.2.1).
| Type | Meaning | Where it is used |
|---|---|---|
| per-platform | One label space for the whole device | Ethernet and anything else with no constraint on label values |
| per-interface | A separate label space per interface | ATM VPI/VCI and similar, where the link owns the label resource |
Which one is in use shows in the last two octets of the LDP Identifier (section 2.2.2). For per-platform they are always zero, so 3.3.3.3:0 means per-platform.
With per-platform, a packet arriving on any link resolves to the same forwarding entry for the same label value. That is why a single LDP session suffices even with several links to the same peer.
Lab verification
Lab setup
CE1 — PE1 — P1 — P2 — PE2 — CE2 are connected in a line. PE1 / P1 / P2 / PE2 in AS 65001 form the MPLS network, distributing routes with OSPF (area 0) and labels with LDP. PE1 and P1 are joined by two links. CE3 and CE4 are customers in VRF CUST-A.
| Router | Role | Lo0 |
|---|---|---|
| CE1 | Customer side (AS 65101), advertises 192.168.1.0/24 | 1.1.1.1/32 |
| PE1 | Ingress / egress LSR (AS 65001) | 2.2.2.2/32 |
| P1 | Transit LSR | 3.3.3.3/32 |
| P2 | Transit LSR | 4.4.4.4/32 |
| PE2 | Ingress / egress LSR (AS 65001) | 5.5.5.5/32 |
| CE2 | Customer side (AS 65102), advertises 192.168.6.0/24 | 6.6.6.6/32 |
| CE3 | Customer side in VRF CUST-A (AS 65107) | 7.7.7.7/32 |
| CE4 | Customer side in VRF CUST-A (AS 65108) | 8.8.8.8/32 |
Observation centres on P1, which holds LDP sessions with both PE1 and P2 and so suits the retention check.
Verification steps
| STEP | Change | What it shows |
|---|---|---|
| 0 | Initial state | The default is DU. The LDP Identifier ends in :0, so per-platform. Labels from a peer that is not the next hop are kept |
| 1 | session downstream-on-demand on PE1 only | One side alone does not switch to DoD |
| 2 | The same on P1 | With both sides configured it becomes DoD and Label Requests flow |
| 3 | Remove STEP 1 and STEP 2 (final state) | The state returns to that of STEP 0 |
STEP 0: Initial state
The two peers as seen from P1. Both are Downstream-Unsolicited and both LDP Identifiers end in :0.
Peer LDP Identifier: 4.4.4.4:0
TCP connection: 4.4.4.4:39224 - 3.3.3.3:646
State: Oper; Msgs sent/rcvd: 18/17; Downstream-Unsolicited
Peer LDP Identifier: 2.2.2.2:0
TCP connection: 2.2.2.2:646 - 3.3.3.3:28568
State: Oper; Msgs sent/rcvd: 16/18; Downstream-UnsolicitedRetention shows up in the bindings. For P1, 5.5.5.5/32 is PE2’s Loopback0 and the next hop is P2.
O 2.2.2.2/32 [110/2] via 10.2.3.2, 00:05:12, GigabitEthernet0/0/0/0
O 4.4.4.4/32 [110/2] via 10.3.4.4, 00:06:11, GigabitEthernet0/0/0/1
O 5.5.5.5/32 [110/3] via 10.3.4.4, 00:04:01, GigabitEthernet0/0/0/1
O 10.4.5.0/24 [110/2] via 10.3.4.4, 00:06:11, GigabitEthernet0/0/0/1The next hop for 5.5.5.5/32 is 10.3.4.4, which is P2 and nothing else. Even so, the bindings still hold PE1’s label.
5.5.5.5/32, rev 17
Local binding: label: 24003
Remote bindings: (2 peers)
Peer Label
----------------- ---------
2.2.2.2:0 24004
4.4.4.4:0 24004 Remote bindings: (2 peers) includes 2.2.2.2 (PE1), which is not the next hop. That is liberal retention. Conservative would list only 4.4.4.4.
STEP 1: Configure DoD on PE1 only
An ACL naming the peer was created on PE1 and session downstream-on-demand applied.
ipv4 access-list DOD-PEERS
10 permit ipv4 host 3.3.3.3 any
!
mpls ldp
session downstream-on-demand with DOD-PEERSThe session is rebuilt when this is applied. The syslog gives the reason as Label advertisement mode changed.
RP/0/RP0/CPU0:Sep 11 05:49:10.357 UTC: mpls_ldp[1178]: %ROUTING-LDP-5-NBR_CHANGE : VRF 'default' (0x60000000), Neighbor 3.3.3.3:0 is DOWN (Label advertisement mode changed)
RP/0/RP0/CPU0:Sep 11 05:49:14.891 UTC: mpls_ldp[1178]: %ROUTING-LDP-5-NBR_CHANGE : VRF 'default' (0x60000000), Neighbor 3.3.3.3:0 is UP (IPv4 connection) After the rebuild the mode is unchanged.
Peer LDP Identifier: 3.3.3.3:0
TCP connection: 3.3.3.3:15840 - 2.2.2.2:646
Graceful Restart: No
Session Holdtime: 180 sec
State: Oper; Msgs sent/rcvd: 15/14; Downstream-Unsolicited
Up time: 00:03:15One side alone does not produce DoD. P1 shows the same thing.
STEP 2: Configure P1 as well
With the same configuration on P1, both ends change.
Peer LDP Identifier: 3.3.3.3:0
TCP connection: 3.3.3.3:22947 - 2.2.2.2:646
Graceful Restart: No
Session Holdtime: 180 sec
State: Oper; Msgs sent/rcvd: 14/14; Downstream-on-Demand
Up time: 00:04:20At this point P1 is DoD toward PE1 and DU toward P2. The advertisement mode is per session.
The capture now holds Label Requests, which never appear under DU. Four seconds after the session comes up PE1 sends five Requests and P1 answers with Label Mappings.
19 9.533811000 3.3.3.3 2.2.2.2 Initialization Message
28 14.245187000 3.3.3.3 2.2.2.2 Initialization Message
29 14.266202000 2.2.2.2 3.3.3.3 Initialization Message Keep Alive Message
30 14.269227000 3.3.3.3 2.2.2.2 Keep Alive Message
31 14.273151000 2.2.2.2 3.3.3.3 Address Message
32 14.275792000 3.3.3.3 2.2.2.2 Address Message
35 18.254353000 2.2.2.2 3.3.3.3 Label Request Message Label Request Message Label Request Message Label Request Message Label Request Message [Malformed Packet]
36 18.258873000 3.3.3.3 2.2.2.2 Label Mapping Message Label Mapping Message Label Mapping Message Label Mapping Message Label Mapping Message
41 20.712829000 3.3.3.3 2.2.2.2 Label Request Message [Malformed Packet]
42 20.716533000 2.2.2.2 3.3.3.3 Label Mapping Message Under DU the Label Mappings follow the Address message directly (see STEP 1 of What Is LDP). Under DoD a Label Request comes between them.
Inside the Request is a Prefix FEC saying which FEC the label is wanted for.
Label Distribution Protocol
Label Space ID: 0
Label Request Message
Message Type: Label Request Message (0x401)
FEC Elements
FEC Element 1
FEC Element Type: Prefix FEC (2)
FEC Element Address Type: IPv4 (1)
FEC Element Length: 32
Prefix: 3.3.3.3The Type is 0x0401, matching the RFC 5036 definition. The [Malformed Packet] note is tshark failing to decode several Requests packed into one segment; the routers processed them correctly.
STEP 3: Remove the configuration (final state)
Removing it from both ends returns the session to DU and the bindings to nine entries, the same state as STEP 0.
Captures
The first PE1 - P1 link was captured, with no filter.
STEP 2 switching to DoDVerification config and show output
The following file types were collected from all eight routers at every STEP, split per router. The verification config is these ..._run.txt files (the final state is the one from the last STEP).
| File | Contents |
|---|---|
..._show.txt | show version / show interface description / show route and the OSPF, LDP, MPLS forwarding and BGP set |
..._log.txt | show logging limited to that STEP |
..._run.txt | show running-config at that STEP (the verification config for that STEP) |
..._trace.txt | LDP and LSD traces on the four core routers |
STEP 0: Initial state
| Router | show | syslog | running-config | trace |
|---|---|---|---|---|
| CE1 | show | log | run | - |
| PE1 | show | log | run | trace |
| P1 | show | log | run | trace |
| P2 | show | log | run | trace |
| PE2 | show | log | run | trace |
| CE2 | show | log | run | - |
| CE3 | show | log | run | - |
| CE4 | show | log | run | - |
STEP 1: Configure DoD on PE1 only
| Router | show | syslog | running-config | trace |
|---|---|---|---|---|
| CE1 | show | log | run | - |
| PE1 | show | log | run | trace |
| P1 | show | log | run | trace |
| P2 | show | log | run | trace |
| PE2 | show | log | run | trace |
| CE2 | show | log | run | - |
| CE3 | show | log | run | - |
| CE4 | show | log | run | - |
STEP 2: Configure P1 as well
| Router | show | syslog | running-config | trace |
|---|---|---|---|---|
| CE1 | show | log | run | - |
| PE1 | show | log | run | trace |
| P1 | show | log | run | trace |
| P2 | show | log | run | trace |
| PE2 | show | log | run | trace |
| CE2 | show | log | run | - |
| CE3 | show | log | run | - |
| CE4 | show | log | run | - |
STEP 3: Remove the configuration (final state)
| Router | show | syslog | running-config | trace |
|---|---|---|---|---|
| CE1 | show | log | run | - |
| PE1 | show | log | run | trace |
| P1 | show | log | run | trace |
| P2 | show | log | run | trace |
| PE2 | show | log | run | trace |
| CE2 | show | log | run | - |
| CE3 | show | log | run | - |
| CE4 | show | log | run | - |
References
| RFC | Title | Summary |
|---|---|---|
| RFC 5036 | LDP Specification | Label distribution control (2.6.1), label retention (2.6.2), label advertisement (2.6.3), label spaces (2.2.1) and their relation to the LDP Identifier (2.2.2). |
Book: Luc De Ghein, MPLS Fundamentals (Cisco Press, 2006), Chapters 2 and 4