MPLS MASTERCLASS · CHAPTER 3

The MPLS core: IGP, LDP and labels

From a blank lab to a core that switches labels hop by hop, without a single line of BGP.

14 min readVideos: Day 1, parts 3 and 4Level: intermediate

From point A to point B

Point A: you know MPLS theory, its roles (CE, PE and P) and its three basic operations: impose, swap and dispose. But you have not yet watched a label being born, travel and disappear on a real router. Point B: by the end of this chapter you will bring up an MPLS core from scratch and follow a label hop by hop with Cisco IOS verification commands.

What you will see
  1. The customer routers with OSPF 20 and the core IGP with OSPF 1
  2. Why /32 loopbacks hold the whole MPLS network together
  3. What LDP does and how to enable it with mpls ip, mpls ldp autoconfig and mpls label range
  4. RIB, FIB, LIB and LFIB: the two planes of the router
  5. Local binding, remote binding, implicit null and PHP
  6. Why the core does not need BGP

The customers: OSPF 20 at each end

Jesús starts from a blank lab on purpose, so you can repeat every step in your own GNS3. There are six routers in a row: customer A at both ends (CE-A1 and CE-A2) and the provider core in the middle (PE-1, P1, P2 and PE-2).

The Day 1 lab: customer sites and MPLS core Six routers in a row. On each end, a customer A router, CE-A1 with loopbacks 30.30.30.30 and 31.31.31.31 and CE-A2 with 40.40.40.40 and 41.41.41.41, runs OSPF process 20 in area 0. In the middle, the provider core: PE-1 with loopback 1.1.1.1 and labels 100 to 199, P1 with 2.2.2.2 and labels 200 to 299, P2 with 3.3.3.3 and labels 300 to 399, and PE-2 with 4.4.4.4 and labels 400 to 499. The core runs OSPF process 1 in area 0 plus LDP over the transit links 10.10.10.0/30, 10.10.11.0/30 and 10.10.12.0/30. The customer links are 192.168.1.0/24 and 192.168.2.0/24, and the PE interfaces toward them stay out of OSPF 1 because they will belong to a VRF. MPLS CORE · OSPF 1 AREA 0 + LDP CUSTOMER A CUSTOMER A CE-A1 Lo0 30.30.30.30 Lo1 31.31.31.31 PE-1 Lo0 1.1.1.1/32 labels 100–199 P1 Lo0 2.2.2.2/32 labels 200–299 P2 Lo0 3.3.3.3/32 labels 300–399 PE-2 Lo0 4.4.4.4/32 labels 400–499 CE-A2 Lo0 40.40.40.40 Lo1 41.41.41.41 192.168.1.0/24 10.10.10.0/30 10.10.11.0/30 10.10.12.0/30 192.168.2.0/24 OSPF 20 · area 0 OSPF 20 · area 0 Transit links /30 · loopbacks /32, reachable from every router in the core PE interfaces toward the CEs stay out of OSPF 1: they will belong to a VRF

The Day 1 lab: two customer A sites and a four-router MPLS core. Diagram: The House of Routing.

Each CE has two loopbacks and one interface toward the provider, always with the .2 of the link. Both run OSPF 20 in area 0: CE-A1 with a single network statement that covers everything, and CE-A2 with ip ospf 20 area 0 on each interface. Both methods are valid.

CE-A1(config)# interface Loopback0
CE-A1(config-if)# ip address 30.30.30.30 255.255.255.255
CE-A1(config-if)# ip ospf network point-to-point
CE-A1(config-if)# interface Loopback1
CE-A1(config-if)# ip address 31.31.31.31 255.255.255.255
CE-A1(config-if)# ip ospf network point-to-point
CE-A1(config-if)# interface GigabitEthernet0/1
CE-A1(config-if)# ip address 192.168.1.2 255.255.255.0
CE-A1(config-if)# no shutdown
CE-A1(config-if)# router ospf 20
CE-A1(config-router)# router-id 30.30.30.30
CE-A1(config-router)# network 0.0.0.0 255.255.255.255 area 0
CE-A2(config)# interface Loopback0
CE-A2(config-if)# ip address 40.40.40.40 255.255.255.255
CE-A2(config-if)# ip ospf 20 area 0
CE-A2(config-if)# ip ospf network point-to-point
CE-A2(config-if)# interface Loopback1
CE-A2(config-if)# ip address 41.41.41.41 255.255.255.255
CE-A2(config-if)# ip ospf 20 area 0
CE-A2(config-if)# ip ospf network point-to-point
CE-A2(config-if)# interface GigabitEthernet0/1
CE-A2(config-if)# ip address 192.168.2.2 255.255.255.0
CE-A2(config-if)# ip ospf 20 area 0
CE-A2(config-if)# no shutdown
CE-A2(config-if)# router ospf 20
CE-A2(config-router)# router-id 40.40.40.40

Why process 20? The process number is local to each router, so it is not a requirement. It is a teaching choice: the core will use 1 and the customer 20, so you always know which instance you are looking at once VRFs appear.

Each site has its own area 0. The goal is not for the CEs to become neighbors, but for their prefixes to be advertised in both directions across the L3VPN. That transparent joining of two areas 0 is called the MPLS super backbone. The route distinguisher and the route target do not go on the CE: they live in the PE's VRF.

The core IGP: OSPF 1, /30 and /32

In the core, the IGP is OSPF process 1 in area 0. Its job is simple and critical: provide reachability between all the provider loopbacks.

  • /30 transit links: 10.10.10.0/30 between PE-1 and P1, 10.10.11.0/30 between P1 and P2, and 10.10.12.0/30 between P2 and PE-2.
  • /32 loopbacks: 1.1.1.1 on PE-1, 2.2.2.2 on P1, 3.3.3.3 on P2 and 4.4.4.4 on PE-2.

On the PEs, OSPF is enabled per interface. On the Ps, which only have core interfaces, a single network statement covers everything.

PE-1(config)# interface Loopback0
PE-1(config-if)# ip address 1.1.1.1 255.255.255.255
PE-1(config-if)# ip ospf 1 area 0
PE-1(config-if)# ip ospf network point-to-point
PE-1(config-if)# interface GigabitEthernet0/2
PE-1(config-if)# ip address 10.10.10.1 255.255.255.252
PE-1(config-if)# ip ospf 1 area 0
PE-1(config-if)# no shutdown
PE-1(config-if)# router ospf 1
PE-1(config-router)# router-id 1.1.1.1
! Gi0/0 and Gi0/1 (toward the CEs) stay out of OSPF 1: they will go into VRFs
P1(config)# interface Loopback0
P1(config-if)# ip address 2.2.2.2 255.255.255.255
P1(config-if)# interface GigabitEthernet0/2
P1(config-if)# ip address 10.10.10.2 255.255.255.252
P1(config-if)# no shutdown
P1(config-if)# interface GigabitEthernet0/0
P1(config-if)# ip address 10.10.11.1 255.255.255.252
P1(config-if)# no shutdown
P1(config-if)# router ospf 1
P1(config-router)# router-id 2.2.2.2
P1(config-router)# network 0.0.0.0 255.255.255.255 area 0
! P2: Lo0 3.3.3.3, Gi0/0 10.10.11.2/30, Gi0/3 10.10.12.1/30, router-id 3.3.3.3
PE-2(config)# interface Loopback0
PE-2(config-if)# ip address 4.4.4.4 255.255.255.255
PE-2(config-if)# ip ospf 1 area 0
PE-2(config-if)# ip ospf network point-to-point
PE-2(config-if)# interface GigabitEthernet0/3
PE-2(config-if)# ip address 10.10.12.2 255.255.255.252
PE-2(config-if)# ip ospf 1 area 0
PE-2(config-if)# no shutdown
PE-2(config-if)# router ospf 1
PE-2(config-router)# router-id 4.4.4.4

PE-2# show ip ospf neighbor
PE-2# show ip route | include O
PE-2# ping 1.1.1.1 source 4.4.4.4

Notice what is not in OSPF 1: the PE interfaces toward the customers. They will become part of a VRF, another router instance inside the same physical box.

Verify with show ip ospf neighbor and show ip route | include O. Finish with ping 1.1.1.1 source 4.4.4.4 from PE-2: if the loopbacks at both ends reach each other, the IGP is ready. In the class, an adjacency on PE-2 would not come up until the interface was really active: always check the no shutdown.

About ip ospf network point-to-point. OSPF advertises any loopback as a /32 host route, whatever its mask. With ip ospf network point-to-point, Cisco advertises the configured mask. Since the loopbacks here are already /32, the result is the same and it stays explicit in the configuration.

Loopbacks, the heart of the MPLS network

Jesús insists on one idea: in an MPLS network, your loopbacks are the heart of the whole infrastructure. There are three reasons.

  1. High availability. A loopback does not go down with a link: it stays reachable through any live path.
  2. BGP. The iBGP sessions between PEs point to the loopbacks with update-source. You will see it in chapter 4.
  3. LDP. Unless you change it with mpls ldp router-id, Cisco picks the highest loopback address as the LDP router ID. By default, that same address is the transport address: the IP that LDP uses to open its TCP session.

If a router's loopback does not reach its neighbors, LDP does not form the session and there are no labels. The class advice: advertise your loopbacks across the whole core, preferably as /32, and point LDP and BGP to them.

What LDP does

LDP (Label Distribution Protocol, RFC 5036) distributes labels among the core routers. It has three jobs:

  1. Discover neighbors. It sends Hello messages over UDP port 646 to the multicast address 224.0.0.2 (“all routers on this subnet”). This is basic discovery.
  2. Form adjacencies. When two routers hear each other, they compare their transport addresses. The one with the higher address takes the active role and opens the TCP session to port 646. From then on, everything travels as unicast.
  3. Advertise labels. For each prefix in its routing table, the router assigns a local label and advertises it to its neighbors without being asked. This is downstream unsolicited mode.

Each association between a prefix and a label is a binding. In MPLS, the group of packets forwarded the same way is called a FEC (forwarding equivalence class). In this core, each IGP prefix is a FEC.

TDP, Cisco's Tag Distribution Protocol, is no longer used. LDP is the default protocol, so mpls label protocol ldp only makes it explicit.

Enabling MPLS router by router

On P1 and P2: through the IGP

mpls ldp autoconfig area 0, inside the OSPF process, enables LDP on every interface in that area. It is very handy if you have a hundred interfaces running OSPF. According to Cisco documentation, it only works with OSPF and IS-IS and requires mpls ip in global mode.

P1(config)# ip cef
P1(config)# mpls ip
P1(config)# mpls label range 200 299
P1(config)# mpls label protocol ldp
P1(config)# router ospf 1
P1(config-router)# mpls ldp autoconfig area 0
! P2: same commands with mpls label range 300 399

On PE-1 and PE-2: per interface

The other method is granular: mpls ip on each core interface. It is more deterministic and highly recommended while you learn.

PE-1(config)# ip cef
PE-1(config)# mpls ip
PE-1(config)# mpls label range 100 199
PE-1(config)# mpls label protocol ldp
PE-1(config)# interface GigabitEthernet0/2
PE-1(config-if)# mpls ip
! PE-2: mpls label range 400 499 and mpls ip on GigabitEthernet0/3

MPLS needs CEF. On older IOS (version 12) it could be disabled, which is why ip cef appears.

One label range per router

Labels use 20 bits: they go from 16 to 1 048 575, because 0 to 15 are reserved (RFC 3032). If you do nothing, every router allocates from 16.

The class best practice is to give each router its own range with mpls label range: 100-199 on PE-1, 200-299 on P1, 300-399 on P2 and 400-499 on PE-2. When you see a label, you know which router assigned it. Set the range before enabling LDP: according to Cisco, existing bindings stay active even if they fall outside the new range.

Control plane and forwarding plane

Jesús repeats this exercise on every router (“repetition is the mother of skill”). An MPLS router has four tables, two per paradigm.

Control plane and forwarding plane in an MPLS router A two by two grid. Columns: IP routing based on the destination address, and MPLS based on labels. Rows: control plane and forwarding plane. The RIB, seen with show ip route, feeds the FIB built by CEF, seen with show ip cef. The prefixes of the RIB are the FECs that LDP labels: the LIB, seen with show mpls ldp bindings, keeps local and remote bindings. From the LIB the router builds the LFIB, seen with show mpls forwarding-table, with the local label, the outgoing label and the next hop. IP ROUTING · DESTINATION IP MPLS · LABELS CONTROL PLANE FORWARDING PLANE RIB Routing Information Base show ip route OSPF · connected LIB Label Information Base show mpls ldp bindings local + remote bindings FIB · CEF Forwarding Information Base show ip cef next hop · outgoing label LFIB Label FIB show mpls forwarding-table local → outgoing label prefixes = FEC The control plane decides where to go; the forwarding plane moves each packet.

RIB and LIB form the control plane; FIB and LFIB, the forwarding plane. Diagram: The House of Routing.

IP routing (destination IP)MPLS (labels)
Control planeRIB · show ip routeLIB · show mpls ldp bindings
Forwarding planeFIB (CEF) · show ip cefLFIB · show mpls forwarding-table

The class metaphor: the RIB is the conductor of the orchestra, but CEF is the one playing the violin. The RIB knows the way to 4.4.4.4; CEF forwards every packet. In MPLS, the LIB stores the bindings and the LFIB forwards.

! Control plane and forwarding plane, IP and MPLS
PE-2# show ip route
PE-2# show ip cef
PE-2# show ip cef 1.1.1.1/32
PE-2# show mpls ldp bindings
PE-2# show mpls forwarding-table
! LDP neighbors and discovery (Cisco LDP configuration guide)
PE-2# show mpls ldp neighbor
PE-2# show mpls ldp discovery

With MPLS active, show ip cef 1.1.1.1/32 on PE-2 already shows the outgoing label: next hop 10.10.12.1, interface Gi0/3, label 300. CEF joins both worlds: it receives an IP packet and sends it out labeled.

“No Label” across the core is a bad sign. In the class it shows up because no neighbor speaks LDP yet. In production, it points to a problem.

Local binding, remote binding and PHP

Follow the prefix 1.1.1.1/32, the loopback of PE-1. In show mpls ldp bindings you will see two kinds of entries:

  • Local binding: the label this router assigned to the prefix and advertises to its neighbors.
  • Remote binding: the label a neighbor advertised for that same prefix. The one from the next-hop neighbor becomes the outgoing label.

The router keeps the bindings from all its neighbors, even if they are not its next hop: this is the liberal label retention described in RFC 5036.

Implicit null and penultimate hop popping

PE-1 does not advertise a normal label for its own loopback. It advertises implicit null, the reserved value 3, which never travels in a packet. The message is: “if you send me traffic for 1.1.1.1, remove the label yourself”. Every router does the same for its loopbacks and connected networks, which is why on P1 the networks 10.10.10.0/30 and 10.10.11.0/30 also show implicit null.

The router before the last one, the penultimate hop, sees implicit null as the outgoing label and removes the label (pop). That is PHP, penultimate hop popping. The last router receives a clean IP packet and does one lookup, not two.

Labels for 1.1.1.1/32 from PE-1 to PE-2, with PHP Top: LDP signaling for the prefix 1.1.1.1/32, the loopback of PE-1. PE-1 advertises implicit null to P1. P1 assigns local label 200 and advertises it to P2. P2 assigns local label 300 and advertises it to PE-2, which assigns local label 400. Bottom: a packet from PE-2 to 1.1.1.1 travels the other way. PE-2 imposes label 300, P2 swaps 300 for 200, and P1, the penultimate hop, pops the label because PE-1 asked for implicit null. PE-1 receives a plain IP packet. Labels are signaled upstream and packets flow downstream. CONTROL PLANE · LDP LABEL MAPPINGS FOR 1.1.1.1/32 → implicit null 200 300 each router tells its upstream neighbor which label to use toward 1.1.1.1 PE-1 · 1.1.1.1 local: imp-null P1 local 200 · out pop P2 local 300 · out 200 PE-2 local 400 · out 300 IP lookup, delivers pop (PHP) swap 300 → 200 impose 300 IP 200 | IP 300 | IP ← DATA PLANE · PACKETS TO 1.1.1.1 FLOW DOWNSTREAM Signaling goes upstream; packets go downstream. With implicit null, the penultimate hop (P1) removes the label, so PE-1 does a single IP lookup instead of a label lookup plus an IP lookup.

Labels for 1.1.1.1/32 are advertised from PE-1 toward PE-2; packets travel the other way. Diagram: The House of Routing.

RouterLocal labelOutgoing labelWhat it does with the packet
PE-1implicit null—Receives the IP packet and delivers it
P1200pop labelRemoves the label (PHP)
P2300200Swaps 300 for 200
PE-2400300Imposes label 300

A packet from PE-2 to 1.1.1.1 leaves with 300, P2 swaps it for 200 and P1 removes it before handing the packet to PE-1. PE-2's local label 400 would be used by a router sitting behind it.

The golden rule of the class: labels are signaled upstream and packets flow downstream. The same pattern repeats with 3.3.3.3: P2 advertises implicit null, P1 assigns 201 and PE-1 assigns 101 with outgoing label 201.

A BGP-free core

So far you have not written a single line of BGP, and the MPLS network already works. This is one of the central ideas of the class: MPLS does not need BGP. With an IGP (OSPF or IS-IS) and LDP, the core already switches labels.

BGP is needed for the applications that run on top: L3VPN, VPLS. And only at the edges. One iBGP session between PE-1 and PE-2 is enough, with no route reflectors or confederations in the core. The Ps stay as they are: IGP and LDP only, doing swaps.

The Ps never learn the prefixes of the customers or of the Internet: they only need to reach the PE loopbacks. In the next chapter you will build that iBGP session and the first VRF.

Class videos

These are the two Day 1 videos behind this chapter. They were recorded live on March 13, 2021 with Cisco routers in GNS3. The audio is in Spanish, with subtitles in Spanish, English, French and Portuguese.

Recorded live; Spanish audio with Spanish, English, French and Portuguese subtitles. When you play it, the video loads from YouTube. Day 1 playlist on YouTube

Test what you learned

1. Must the CEs use a different OSPF process from the core?

Answer. No. The OSPF process number is local to each router. The class uses 20 for the customers and 1 for the core for clarity, to tell the customer instance apart from the core instance.

2. OSPF is FULL between two routers, but the LDP session does not come up. What do you check first?

Answer. That each router can reach the other's loopback. By default, the LDP transport address is its router ID, the highest loopback. If that address is not advertised in the IGP, the TCP session to port 646 cannot open.

3. On P2, the LIB for 1.1.1.1/32 shows local 300 and remote 200 from neighbor 2.2.2.2. A packet arrives with label 300. What happens?

Answer. P2 looks up 300 in its LFIB, swaps it for 200 and sends it toward P1, its next hop to 1.1.1.1. Then P1 removes the label because PE-1 advertised implicit null.

4. What does it mean when a router advertises implicit null for its own loopback?

Answer. It asks the penultimate hop to remove the label before sending it the packet (PHP). The last router then does a single IP lookup. Implicit null is the reserved value 3 and never travels in the packet.

5. Does your core need BGP for MPLS to work?

Answer. No. With an IGP and LDP, the core already switches labels. BGP is only needed between the PEs, for applications such as L3VPN or VPLS.

Key takeaways

  • The CEs run their own OSPF; the PE interfaces toward them stay out of the core IGP because they will move into a VRF.
  • The core needs an IGP with /30 links and /32 loopbacks reachable from every router.
  • LDP discovers neighbors over UDP 646, forms the session over TCP 646 and uses the loopback as router ID and transport address.
  • mpls ldp autoconfig enables LDP from OSPF or IS-IS; mpls ip per interface gives you granular control.
  • One mpls label range per router tells you at a glance who assigned each label.
  • RIB and LIB are the control plane; FIB (CEF) and LFIB, the forwarding plane.
  • Implicit null triggers PHP: labels are signaled upstream and packets flow downstream. And all of this works without BGP in the core.

Official resources

Source and credits. Chapter written from the MPLS Masterclass that Jesús Espinoza recorded live in March 2021. Text drafted with AI assistance and reviewed; original diagrams by The House of Routing. Technical data and configuration were checked against official Cisco documentation and IETF RFCs.

Navigate