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.
- The customer routers with OSPF 20 and the core IGP with OSPF 1
- Why /32 loopbacks hold the whole MPLS network together
- What LDP does and how to enable it with
mpls ip,mpls ldp autoconfigandmpls label range - RIB, FIB, LIB and LFIB: the two planes of the router
- Local binding, remote binding, implicit null and PHP
- 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: 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.
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.
- High availability. A loopback does not go down with a link: it stays reachable through any live path.
- BGP. The iBGP sessions between PEs point to the loopbacks with
update-source. You will see it in chapter 4. - 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:
- 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.
- 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.
- 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.
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 plane | RIB · show ip route | LIB · show mpls ldp bindings |
| Forwarding plane | FIB (CEF) · show ip cef | LFIB · 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.
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 are advertised from PE-1 toward PE-2; packets travel the other way. Diagram: The House of Routing.
| Router | Local label | Outgoing label | What it does with the packet |
|---|---|---|---|
| PE-1 | implicit null | — | Receives the IP packet and delivers it |
| P1 | 200 | pop label | Removes the label (PHP) |
| P2 | 300 | 200 | Swaps 300 for 200 |
| PE-2 | 400 | 300 | Imposes 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.
- Day 1 · Part 3MPLS L3VPN lab from scratch: customers and OSPF coreWatch video
- Day 1 · Part 4LDP in the MPLS core: LIB, LFIB and PHPWatch video
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 autoconfigenables LDP from OSPF or IS-IS;mpls ipper interface gives you granular control.- One
mpls label rangeper 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
- Cisco · MPLS Label Distribution Protocol (LDP)cisco.com
- Cisco · MPLS LDP Autoconfigurationcisco.com
- Cisco IOS MPLS Command Reference · mpls label rangecisco.com
- Cisco · Review OSPF Frequently Asked Questionscisco.com
- RFC 3031 · Multiprotocol Label Switching Architecturedatatracker.ietf.org
- RFC 3032 · MPLS Label Stack Encodingdatatracker.ietf.org
- RFC 5036 · LDP Specificationdatatracker.ietf.org
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.