Label Distribution Protocol and Basic
MPLS Configuration
APNIC Technical Workshop
Issue Date: [201609]
Revision: [01]
Label Distribution
Protocol
2
MPLS Builders
Which protocols can set up
Label Switched Path?
Pure Signaling Routing Protocols
MPLS Protocols with Extensions
Most classic
and
widespread
LDP BGP
RSVP-TE IGP
3
Advantages of LDP
• Reliability
– LDP uses reliable TCP as the transport protocol for all but the
discovery messages.
• Auto provision
– Abilities to set up LSPs dynamically based on routing information
• Plug-and-play
– Simple deployment and configuration
• Support for a large number of LSPs
4
LDP Identifier
• An LDP Identifier is a six octet quantity used to identify an
LSR label space.
4 byte 2 byte
LSR ID Label Space ID
Label Space ID = 0
10.10.1.1 0 Label space is per platform
Label Space ID ≠ 0
20.20.20.2 6 Label space is per interface
R2#show mpls ldp discovery
Local LDP Identifier:
2.2.2.2:0
Discovery Sources:
Interfaces:
FastEthernet0/0 (ldp): xmit/recv
LDP Id: 3.3.3.3:0
Ethernet1/0 (ldp): xmit/recv
LDP Id: 1.1.1.1:0
Cisco IOS
5
Label Space – Per Platform
• In per-platform label space, one single label is assigned to a
destination network and announced to all neighbors. The label
must be locally unique and valid on all incoming interfaces.
Prefix Out Label
100.1.1.0/24 100
200.1.1.0/24 200
R1
E1/1 100.1.1.0/24
E1/2 200.1.1.0/24
R3
R2
In Label Prefix
Prefix Out Label 100 100.1.1.0/24
100.1.1.0/24 100 200 200.1.1.0/24
200.1.1.0/24 200
6
Label Space – Per Interface
• In per-interface label space, local labels are assigned to IP
destination prefixes on a per-interface basis. These labels must
be unique on a per-interface basis.
Prefix Out Label
100.1.1.0/24 1/300
200.1.1.0/24 1/200
R1
ATM4/1 100.1.1.0/24
ATM4/2 200.1.1.0/24
R3
R2
In Label In Interface Prefix
Prefix Out Label 1/300 ATM 4/1 100.1.1.0/24
100.1.1.0/24 1/400 1/200 ATM 4/1 200.1.1.0/24
200.1.1.0/24 1/500 1/400 ATM 4/2 100.1.1.0/24
1/500 ATM 4/2 200.1.1.0/24
7
LDP Operations
Step 1
Neighbor Discovery
Step 2
Session Establishment
Step 3
Label Distribution
8
LDP Messages
Category Function Message Name
Discovery Announce and maintain the Hello
presence of an LSR in a network
Session Establish, maintain, and Initialization
terminate sessions between LDP
peers Keepalive
Label Create, change, and delete label Label Release
Distribution mappings for FECs
Label Request
Label Abort Request
Label Mapping
Label Withdrawal
Notification Provide advisory information and Notification
to signal error information
(Not list all the messages)
9
LDP Neighbor Discovery (1)
• Basic Discovery – Directly connected peer
– LDP Hello messages are UDP messages that are sent on the links to
the “all routers on this subnet” multicast IP address - 224.0.0.2. The
UDP port used for LDP is 646.
UDP: Hello
(2.2.2.2:1064 → 224.0.0.2:646)
LDP
R2: 2.2.2.2
UDP: Hello
(1.1.1.1:1050 → 224.0.0.2:646)
NO_MPLS
LDP
R1: 1.1.1.1 R3: 3.3.3.3
UDP: Hello
(4.4.4.4:1027 → 224.0.0.2:646)
LDP
R4: 4.4.4.4
10
LDP Neighbor Discovery (2)
• Extended Discovery – Non-directly connected peer
– LDP sessions between non-directly connected LSRs are supported by LDP Extended
Discovery.
Targeted LDP Session
R1:1.1.1.1 R2: 2.2.2.2 R3: 3.3.3.3 R4: 4.4.4.4
UDP: Targeted Hello
(1.1.1.1:1080 → 4.4.4.4:646)
UDP: Targeted Hello
(4.4.4.4:1012 → 1.1.1.1:646)
11
LDP Session Establishment and Maintenance
My LSR-ID is After neighbor discovery, My LSR-ID is
smaller, I am in 2 neighbors start to larger, I am in
Passive role. establish session Active role.
R1: 1.1.1.1 R2: 2.2.2.2
Establish TCP Connection (Initiated by R2)
Initialization Message
Initialization Message
Keepalive Message
Keepalive Message
Session UP Session UP
12
Label Distribution and Management
• After LDP sessions are established, labels will be distributed
between LDP peers. The label distribution mode used depends
on the interface and the implementation.
Label Distribution Ordered
Control Mode Independent
DoD
Label Advertisement (Downstream on Demand)
Mode DU
(Downstream Unsolicited)
Liberal
Label Retention Mode
Conservative
13
Label Distribution Control Mode
- Ordered
• In Ordered control mode, an LSR would only assign a local label
for the IGP prefixes that are marked as directly connected in its
routing table or also for the IGP prefixes for which it has already
received a label from the nexthop router.
Upstream Downstream
LDP LDP LDP Loopback 2:
100.1.1.1/32
R1 R2 2
R3 1
R4
3
Label Mapping Label Mapping Label Mapping
To 100.1.1.1/32 To 100.1.1.1/32 To 100.1.1.1/32
Label=100 Label=200 Label=300
14
Label Distribution Control Mode - Independent
• In the independent mode, each LSR creates a local binding for a
particular FEC as soon as it recognizes the FEC. Usually, this
means that the prefix for the FEC is in its routing table.
Upstream Downstream
LDP LDP LDP
100.1.1.1/32
R1 R2 R3 2
R4
1
Label Mapping Label Mapping
To 100.1.1.1/32 To 100.1.1.1/32
Label=100 Label=300
15
Label Advertisement Mode - Downstream on Demand
• In the DoD mode, an LSR distributes labels to a specified
FEC only after receiving Label Request messages from its
upstream LSR.
Upstream Downstream
Label Request Label Request Label Request
for 100.1.1.1/32 for 100.1.1.1/32 for 100.1.1.1/32
LDP LDP LDP
100.1.1.1/32
R1 R2 R3 R4
Label Mapping Label Mapping Label Mapping
To 100.1.1.1/32 To 100.1.1.1/32 To 100.1.1.1/32
Label=100 Label=200 Label=300
16
Label Advertisement Mode - Downstream Unsolicited
• In the DU mode, each LSR distributes a label to its
upstream LSRs, without those LSRs requesting a label.
Upstream Downstream
LDP LDP LDP
100.1.1.1/32
R1 R2 R3 R4
Label Mapping Label Mapping Label Mapping
To 100.1.1.1/32 To 100.1.1.1/32 To 100.1.1.1/32
Label=100 Label=200 Label=300
17
Label Retention Mode - Liberal
• In the liberal mode, an LSR keeps all received remote
labels in the LIB, but not all are used to forward packets.
Upstream Downstream
Prefix Out Label To 100.1.1.1/32,
100.1.1.1/32 200 NH= R3
100.1.1.1/32 500(Liberal)
Label Mapping
To 100.1.1.1/32
Label=200
LDP LDP LDP
GE
100.1.1.1/32
GE
R1 R2 R3 R4
LDP
FE
R5 R6
18
Label Retention Mode - Conservative
• An LSR that is running this mode does not store all remote
labels in the LIB, but it stores only the remote label that is
associated with the next-hop LSR for a particular FEC.
Upstream To 100.1.1.1/32,
Downstream
NH= R3
Prefix Out Label
100.1.1.1/32 200
Label Mapping
To 100.1.1.1/32
Label=200
LDP LDP LDP
ATM
100.1.1.1/32
ATM
R1 R2 R3 R4
LDP
ATM
R5 R6
19
Label Distribution Scheme Summary
• Cisco IOS can support:
Control Distribution Retention Label Space
Frame Mode Independent DU Liberal Per Platform
Cell Mode (LC ATM) Ordered DoD Conservation Per Interface
• Junos can support:
Control Distribution Retention
Ordered DU Liberal
DoD
• Huawei VRP can support:
Control Distribution Retention
Ordered DU Liberal By default
Ordered DoD Conservation Also support
20
LDP Session Protection (1)
• Without LDP session protection, if the link between R1 and R2 fails, the LDP
direct link adjacency fails.
LDP Session
R1 R2
R3
21
LDP Session Protection (2)
• MPLS LDP Session Protection uses LDP Targeted Hellos to
protect LDP sessions.
Targeted LDP Session
LDP Session
R1 R2
On R1 and R2:
1. Establish 2 • The LDP link adjacency is
LDP sessions
2. Enable LDP removed when the link goes
session down, but the targeted
protection
R3 adjacency keeps the LDP
session up.
22
Questions?
Basic MPLS
Configuration
24
Configuration Example
• Task: Configure MPLS LDP on Cisco IOS (Version 15.2) to
set up MPLS LSP only for loopback addresses.
• Prerequisite configuration:
– 1. IP address configuration on all the routers
– 2. IGP configuration on all the routers
Loopback0 Loopback0 Loopback0 Loopback0
10.0.0.1/32 10.0.0.2/32 10.0.0.3/32 10.0.0.4/32
Fa0/0 Fa0/0
E1/0 E1/0 10.23.1.0/30 E1/0 E1/0
.1 .2
.1 10.12.0.0/30 .2 10.23.2.0/30 .1 10.34.0.0/30 .2
Fa0/1 Fa0/1
R1 R2 R3 R4
MPLS Network
25
Step 1: Enable MPLS & LDP
• Configuration steps:
– 1. Configure basic MPLS and LDP on all the routers.
R1 configuration:
R1(config)# ip cef
To make MPLS work, CEF switching is mandatory.
R1(config)# mpls label range 100 199
Specifying the label range for this router start from
100 to 199.
R1(config)# mpls ldp router-id loopback 0 force
Forcing LDP router ID to be loopback 0 address.
R1(config)# interface ethernet 1/0
R1(config-if)# mpls ip
IP MPLS is enabled on the interface.
R1(config-if)# mpls label protocol ldp
Label distribution protocol is LDP.
26
Check MPLS Interface
• Using show mpls interfaces command verifies that interfaces have been
configured to use LDP:
R1#show mpls interfaces
Interface IP Tunnel BGP Static Operational
Ethernet1/0 Yes (ldp) No No No Yes
R2#show mpls interfaces
Interface IP Tunnel BGP Static Operational
FastEthernet0/0 Yes (ldp) No No No Yes
FastEthernet0/1 Yes (ldp) No No No Yes
Ethernet1/0 Yes (ldp) No No No Yes
27
Check LDP Discovery
• Check LDP discovery
R2#show mpls ldp discovery
Local LDP Identifier:
10.0.0.2:0 Local LDP ID
Discovery Sources:
Interfaces:
FastEthernet0/0 (ldp): xmit/recv
LDP Id: 10.0.0.3:0 Neighbor’s LDP ID
FastEthernet0/1 (ldp): xmit/recv
LDP Id: 10.0.0.3:0
Ethernet1/0 (ldp): xmit/recv
LDP Id: 10.0.0.1:0 R2 has received Hello
messages from
routers whose ID are
10.0.0.3 and 10.0.0.1
28
Check LDP Neighbors
• Check LDP neighbors on R1
R1#show mpls ldp neighbor
Peer LDP Ident: 10.0.0.2:0; Local LDP Ident 10.0.0.1:0
TCP connection: 10.0.0.2.48548 - 10.0.0.1.646 LDP session is
State: Oper; Msgs sent/rcvd: 34/34; Downstream a TCP session
Up time: 00:09:57 (port = 646)
LDP discovery sources:
Ethernet1/0, Src IP addr: 10.12.0.2
Addresses bound to peer LDP Ident:
10.23.1.1 10.23.2.1 10.12.0.2 10.0.0.2
Operational is the
stable state of LDP
session.
29
Check LDP Neighbors
• Check LDP neighbors on R2
R2#show mpls ldp neighbor
Peer LDP Ident: 10.0.0.3:0; Local LDP Ident 10.0.0.2:0
TCP connection: 10.0.0.3.28664 - 10.0.0.2.646
State: Oper; Msgs sent/rcvd: 36/36; Downstream
Up time: 00:12:12
LDP discovery sources: Multiple links
FastEthernet0/0, Src IP addr: 10.23.1.2 between two routers
FastEthernet0/1, Src IP addr: 10.23.2.2 still mean single
Addresses bound to peer LDP Ident:
10.23.1.2 10.23.2.2 10.34.0.1 10.0.0.3
LDP session.
Peer LDP Ident: 10.0.0.1:0; Local LDP Ident 10.0.0.2:0
TCP connection: 10.0.0.1.646 - 10.0.0.2.48548
State: Oper; Msgs sent/rcvd: 36/36; Downstream
Up time: 00:11:40
LDP discovery sources:
Ethernet1/0, Src IP addr: 10.12.0.1
Addresses bound to peer LDP Ident:
10.12.0.1 10.0.0.1
Fa0/0 Fa0/0
E1/0 E1/0 10.23.1.0/30 E1/0 E1/0
.1 .2
.1 10.12.0.0/30 .2 10.23.2.0/30 .1 10.34.0.0/30 .2
Fa0/1 Fa0/1
R1 R2 R3 R4
30
Check LDP Label Information Base
• Check LDP LIB
R2#show mpls ldp bindings
lib entry: 10.0.0.1/32, rev 24
local binding: label: 206
remote binding: lsr: 10.0.0.3:0, label: 302
remote binding: lsr: 10.0.0.1:0, label: imp-null
lib entry: 10.0.0.2/32, rev 18
local binding: label: imp-null
remote binding: lsr: 10.0.0.3:0, label: 301
remote binding: lsr: 10.0.0.1:0, label: 101
lib entry: 10.0.0.3/32, rev 22
local binding: label: 205
remote binding: lsr: 10.0.0.3:0, label: imp-null
remote binding: lsr: 10.0.0.1:0, label: 100
...........(omitted)
R2#show mpls ldp bindings 10.0.0.4 32
lib entry: 10.0.0.4/32, rev 20
local binding: label: 204
remote binding: lsr: 10.0.0.3:0, label: 300
remote binding: lsr: 10.0.0.1:0, label: 107
31
Check Label Forwarding Table
• Check label forwarding table
R2#show mpls forwarding-table
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
203 Pop Label 10.34.0.0/30 0 Fa0/0 10.23.1.2
Pop Label 10.34.0.0/30 0 Fa0/1 10.23.2.2
204 300 10.0.0.4/32 0 Fa0/0 10.23.1.2
300 10.0.0.4/32 0 Fa0/1 10.23.2.2
205 Pop Label 10.0.0.3/32 0 Fa0/0 10.23.1.2
Pop Label 10.0.0.3/32 0 Fa0/1 10.23.2.2
206 Pop Label 10.0.0.1/32 0 Et1/0 10.12.0.1
32
Step 2: Configure Conditional Label Distribution
• Only set up LSP for loopback addresses.
– 2.1 Create prefix-list on each router, all the loopback addresses are
in 10.0.0.0/24 block.
R1(config)#ip prefix-list ALL-LOOPBACK seq 5 permit
10.0.0.0/24 le 32
– 2.2 Apply the prefix-list
R1(config)#mpls ldp label
R1(config-ldp-lbl)#allocate global prefix-list ALL-LOOPBACK
Allocate labels for the routes matching ALL-LOOPBACK
prefix-list.
33
Verify the Results of Conditional Label Distribution
• Before the configuration.
R1#show mpls ldp bindings
lib entry: 10.0.0.1/32, rev 51
local binding: label: imp-null
remote binding: lsr: 10.0.0.2:0, label: 206
lib entry: 10.0.0.2/32, rev 52
local binding: label: 101
remote binding: lsr: 10.0.0.2:0, label: imp-null
lib entry: 10.0.0.3/32, rev 53 Entries for all the
local binding: label: 100 prefixes in IP routing
remote binding: lsr: 10.0.0.2:0, label: 205 table.
lib entry: 10.0.0.4/32, rev 54
local binding: label: 107
remote binding: lsr: 10.0.0.2:0, label: 204
lib entry: 10.12.0.0/30, rev 71
local binding: label: imp-null
remote binding: lsr: 10.0.0.2:0, label: imp-null
lib entry: 10.23.1.0/30, rev 72
local binding: label: 102
remote binding: lsr: 10.0.0.2:0, label: imp-null
lib entry: 10.23.2.0/30, rev 73
local binding: label: 103
remote binding: lsr: 10.0.0.2:0, label: imp-null
lib entry: 10.34.0.0/30, rev 75
local binding: label: 104
remote binding: lsr: 10.0.0.2:0, label: 200
34
Verify the Results of Conditional Label Distribution
• After configure on all the routers.
R1#show mpls ldp bindings
lib entry: 10.0.0.1/32, rev 51
local binding: label: imp-null
remote binding: lsr: 10.0.0.2:0, label: 206 Only the entries for
lib entry: 10.0.0.2/32, rev 52 loopback addresses.
local binding: label: 101
remote binding: lsr: 10.0.0.2:0, label: imp-null
lib entry: 10.0.0.3/32, rev 53
local binding: label: 100
remote binding: lsr: 10.0.0.2:0, label: 205
lib entry: 10.0.0.4/32, rev 54
local binding: label: 107
remote binding: lsr: 10.0.0.2:0, label: 204
35
Check the LSP
• Check the LSP for 10.0.0.4 from R1 to R3
R1#show mpls forwarding-table 10.0.0.4 32
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
107 204 10.0.0.4/32 0 Et1/0 10.12.0.2
R2#show mpls forwarding-table 10.0.0.4 32
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
204 300 10.0.0.4/32 0 Fa0/0 10.23.1.2
300 10.0.0.4/32 0 Fa0/1 10.23.2.2
R3# show mpls forwarding-table 10.0.0.4 32
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id If I want
Switched to use an
interface
300 Pop Label 10.0.0.4/32 outgoing
0 label at the
Et1/0 10.34.0.2
penultimate hop for keeping
QoS info. What can I do?
Implicit Null
36
Explicit-null Label
• Explicit Null label can be used to keep the QoS information.
Explicit Null (IPv4) = Label 0 Explicit Null (IPv6) = Label 2
Prefix: 10.0.0.4/32 Prefix: 10.0.0.4/32 Prefix: 10.0.0.4/32 Prefix: 10.0.0.4/32
Local Label Null Local Label 204 Local Label 300 Local Label Explicit-n
Out Interface E1/0 Out Interface Fa0/0 Fa0/1 Out Interface E1/0 Out Interface --
Out Label 204 Out Label 300 Out Label Explicit-n Out Label --
Operation Push Operation Swap Operation Swap Operation POP
204 IP:10.0.0.4 300 IP:10.0.0.4 0 IP:10.0.0.4
Push Swap Swap Pop
Fa0/0 Fa0/0
E1/0 E1/0 E1/0 E1/0
Fa0/1 Fa0/1
R1 R2 R3 R4
37
Additional Task: Using Explicit-null Label
• Explicit-null configuration on R4:
R4(config)# mpls ldp explicit-null
• After configuring this command, check the label forwarding
table on R3.
R3#show mpls forwarding-table 10.0.0.4 32
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
300 explicit-n 10.0.0.4/32 0 Et1/0 10.34.0.2
Out label is
explicit-null
38
Questions?