From point A to point B
Point A: you have the core running OSPF and LDP, the iBGP session with VPNv4 between PE-1 and PE-2, and VRF TU-CA1 speaking OSPF with its CE. But Customer A still can't reach the other side. Point B: by the end of this chapter your L3VPN will work end to end, you'll know how to read a VPNv4 prefix and you'll be able to explain, label by label, how a packet crosses the core while the P routers know nothing about the customer's routes.
- Redistributing OSPF into BGP inside the VRF
- How to read a VPNv4 prefix and its extended attributes
- The VRF on PE-2 and the validation from the CE
- The VPN label and the transport label, with PHP
- The MPLS header and its effect on the MTU
Redistributing OSPF into BGP per VRF
PE-1 already had the bridge from BGP into OSPF: redistribute bgp 100 subnets under router ospf 20 vrf TU-CA1. The opposite path is missing. The routes CE-A1 advertises through OSPF have to enter BGP to travel to the other PE.
The key is where you configure it. Not in the general IPv4 unicast address family, but in address-family ipv4 vrf TU-CA1. There you tell BGP: take OSPF 20 that belongs to this VRF, and only that one.
PE-1# configure terminal
PE-1(config)# router bgp 100
PE-1(config-router)# address-family ipv4 vrf TU-CA1
PE-1(config-router-af)# redistribute ospf 20 vrf TU-CA1
PE-1(config-router-af)# end
PE-1# show run | section bgp
In class we called this the most intricate part of the whole process, and for good reason: you have three nested contexts (BGP, the VRF's address family and that VRF's OSPF process). Pick the wrong context and the routes stay inside the VRF and never reach the core.
Remember that this rests on what we built earlier: the VPNv4 address family activated toward the other PE, and communities being sent.
! Built in the previous chapter: without it the RT never leaves PE-1
router bgp 100
address-family vpnv4 unicast
neighbor 4.4.4.4 activate
neighbor 4.4.4.4 send-community both
VPNv4 prefixes and extended attributes
After redistributing, try show ip bgp. It's empty. That's not an error: the router no longer has native BGP prefixes, it has VPNv4 prefixes. To see them you ask for their address family.
PE-1# show ip bgp
! empty: there are no native IPv4 BGP prefixes
PE-1# show bgp vpnv4 unicast all
PE-1# show bgp vpnv4 unicast rd 300:300
PE-1# show bgp vpnv4 unicast vrf TU-CA1 30.30.30.30/32
With all you see every VRF. With rd 300:300 you filter by Customer A's route distinguisher on this PE. With vrf TU-CA1 and a prefix you get the details of one route. A real PE can hold hundreds of VRFs, so filtering is not a luxury.
The details of 30.30.30.30/32 tell the whole story:
- Route distinguisher 300:300. It turns the IPv4 route into a unique VPNv4 prefix, even if another customer uses the same address.
- Next hop 192.168.1.2. CE-A1, where the route came from. Origin: redistributed.
- Extended community RT:3:3. The route target we set on the VRF.
- OSPF domain ID. The OSPF process number encoded in hexadecimal (20 is 0x14). Something that was always local in OSPF now travels as an attribute.
- OSPF route type. Area, route type and options. It says whether the route was born inside the area (LSA type 1 or 2), between areas (type 3) or as an external (type 5).
- OSPF router ID. The 0.0.0.1 we configured in the VRF's OSPF.
Carrying OSPF information through BGP required new extended attributes. That's why send-community both (or extended) is mandatory: without it, the route target and the OSPF attributes never leave the PE and the other side imports nothing. Cisco marks it as mandatory in its basic MPLS VPN guide, and RFC 4577 defines these OSPF attributes.
OSPF RT; don't mistake it for a route tag.The other end: the VRF on PE-2
If you go to PE-2 and run show bgp vpnv4 unicast all, there is still nothing useful: no VRF exists to import those routes. Time to repeat PE-1's pattern with PE-2's own values.
PE-2(config)# ip vrf TU-CA2
PE-2(config-vrf)# rd 400:400
PE-2(config-vrf)# route-target both 3:3
PE-2(config-vrf)# exit
PE-2(config)# interface GigabitEthernet0/1
PE-2(config-if)# ip vrf forwarding TU-CA2
PE-2(config-if)# ip address 192.168.2.1 255.255.255.0
PE-2(config-if)# exit
PE-2(config)# do ping vrf TU-CA2 192.168.2.2
Look at the numbers. The RD changes (400:400 versus 300:300) because it identifies the VRF on each PE. The route target is the same (3:3) because it's what ties Customer A's two sites together. The RD distinguishes; the RT connects.
Then the VRF's OSPF toward CE-A2 and the mutual redistribution:
PE-2(config)# router ospf 20 vrf TU-CA2
PE-2(config-router)# router-id 0.0.0.2
PE-2(config-router)# network 192.168.2.0 0.0.0.255 area 0
PE-2(config-router)# redistribute bgp 100 subnets
PE-2(config-router)# exit
PE-2(config)# router bgp 100
PE-2(config-router)# address-family ipv4 vrf TU-CA2
PE-2(config-router-af)# redistribute ospf 20 vrf TU-CA2
PE-2(config-router-af)# end
PE-2# show ip vrf
PE-2# show ip route vrf TU-CA2
PE-2# write
Something instructive happened in class. Before configuring OSPF-into-BGP redistribution on PE-2, VRF TU-CA2 already showed 30.30.30.30 and 31.31.31.31. That makes sense: the half going from PE-1 to PE-2 was already complete. Route 30.30.30.30 was born in OSPF but reached PE-2 through iBGP. The return path was missing, and that's why PE-1 didn't see 40.40.40.40 yet.
Validating from the CE
The CE knows nothing about MPLS. It only speaks OSPF with its PE. That's why the real test is done from the CE:
CE-A1# show ip route
CE-A1# ping 40.40.40.40
CE-A1# ping 41.41.41.41
CE-A1# traceroute 40.40.40.40 source 30.30.30.30 ttl 1 10
CE-A2 receives 30.30.30.30 and 31.31.31.31 as OSPF routes, and CE-A1 receives 40.40.40.40 and 41.41.41.41. The loopback-to-loopback ping answers: there is end-to-end connectivity. The traceroute also shows the labels at each hop:
| Hop | Router | Labels shown | What happened |
|---|---|---|---|
| 1 | PE-1 | none | Native IP arrives at VRF TU-CA1 |
| 2 | P1 (10.10.10.2) | 202/405 | PE-1 pushed 405 (VPN) and 202 (transport) on top |
| 3 | P2 | 302/405 | P1 swapped 202 for 302; 405 stays the same |
| 4 | PE-2 | 405 | P2 removed the transport label (PHP) |
| 5 | CE-A2 | none | PE-2 removed 405 and delivered clean IP |
The two-label stack
That traceroute is the whole L3VPN in five lines. Every customer packet crosses the core with two labels, and each one has a different job.
PE-1 pushes two labels, P1 swaps only the top one, P2 removes it and PE-2 removes the VPN label. Diagram: The House of Routing.
- The VPN label (inner label), 405. PE-2 creates it and advertises it through MP-BGP along with the VPNv4 prefix. It tells PE-2 which VRF the packet belongs to. It never changes along the way.
- The transport label (outer label), 202 and then 302. It comes from LDP and carries the packet to the BGP next hop, loopback 4.4.4.4. This is the label that gets swapped at each P router.
MP-BGP supplies the VPN label; LDP supplies the transport label. PE-1 combines both. Diagram: The House of Routing.
Why does the packet reach PE-2 with only 405? Because of penultimate hop popping (PHP). PE-2 advertises the implicit-null label for its loopback 4.4.4.4 through LDP. P2, the penultimate hop, reads it as “remove the transport label before sending”. In P2's show mpls forwarding-table you see it as Pop Label for 4.4.4.4/32. So PE-2 does a single lookup: it reads 405, knows it means VRF TU-CA2 and hands the IP packet to CE-A2.
The operations have names: push (or impose) at the ingress PE, swap at the P routers, pop at the penultimate hop and a final pop (dispose) at the egress PE, the router that created the VPN label.
The same thing shows up in the capture we took on the PE-1 to P1 link. A ping from PE-1 to 4.4.4.4 leaves with label 202, but the reply comes back unlabeled. Same reason: for its connected network, P1 advertises implicit-null, so it does PHP before delivering to PE-1. You confirm it with show mpls ldp bindings on P1.
P1# show ip route 40.40.40.40
! no route: the core does not know customer prefixes
P1# ping 40.40.40.40
! fails for the same reason
P1# show mpls forwarding-table
P1# show mpls ldp bindings
The MPLS header bit by bit
In Wireshark the label sits between the Ethernet header and the IP header. That's why MPLS is called a “layer 2.5” protocol. The capture also shows the LDP hellos.
Each stack entry takes 32 bits. The S bit marks the last one. Diagram: The House of Routing.
| Field | Bits | What it does |
|---|---|---|
| Label | 20 | The label value. 0 to 15 are reserved; 3 is implicit-null and never travels on the wire |
| EXP | 3 | Experimental bits, used in practice to mark quality of service (QoS) |
| S | 1 | Bottom of stack: set to 1 on the last label in the stack |
| TTL | 8 | Time to live, as in IP. It can be hidden so the core hops don't show |
In our stack, 202 carries S=0 because another label sits below it, and 405 carries S=1 because it's the last one before the IP header.
The provider as a super cable
Try this on P1: ping 40.40.40.40. It fails. And show ip route 40.40.40.40 returns nothing. P1 doesn't know the customer's routes, and it has no reason to.
That's the idea we want you to keep: the provider is a super cable. It connects a user in Spain with another in Colombia, or one in Mexico with another in Argentina, and the core doesn't need to know where the destination is. It just moves the packet to the edge PE, and the PE takes care of delivering it. RFC 4364 puts it this way: the backbone doesn't even need routes to the CEs, only to the PEs.
This breaks the model we learn in CCNA. In traditional routing, each router de-encapsulates the frame, looks at the destination IP, checks the RIB with the longest-match rule and lets CEF re-encapsulate. With MPLS, the core router reads the label, checks its label table and switches. It doesn't look at the IP packet to decide. The IGP and LDP already did that work when they built the paths.
MTU: 4 bytes per label
Each label adds 4 bytes. An L3VPN carries two, so a 1500-byte IP packet takes 1508 bytes on the core links. If a core interface stays at 1500, that packet doesn't fit.
Per RFC 3032, if the labeled packet is too big and has the DF bit set, the router drops it and sends an ICMP “fragmentation needed”. Path MTU Discovery helps if that ICMP reaches the source, but the cleanest fix is to design the core with headroom.
- Cisco recommends that core-facing interfaces have a higher MTU than customer-facing interfaces, so the labels fit.
- The
mpls mtucommand can't exceed the interface MTU. If you try, IOS asks you to raise the interface MTU first. - The MTU must match on both ends of every link: OSPF and IS-IS require it to form an adjacency.
Class videos
This chapter goes with the sixth part of the first marathon. It is a live session recorded with Cisco routers in GNS3, with audio in Spanish and 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. Why is show ip bgp empty on PE-1 if BGP already has the customer's routes?
Answer. Because those routes aren't native IPv4 prefixes but VPNv4 prefixes (RD plus prefix). They live in another address family and you see them with show bgp vpnv4 unicast all, by RD or by VRF.
2. The traceroute shows 202/405 and then 302/405. Which one is the VPN label, and why doesn't it change?
Answer. 405. PE-2 created it for VRF TU-CA2 and advertised it through MP-BGP. The P routers only look at the top label, the transport one, so 405 reaches PE-2 untouched.
3. Who removes the transport label, and what triggers it?
Answer. P2, the penultimate hop. PE-2 advertised implicit-null for 4.4.4.4 through LDP, which tells P2 to pop before sending (penultimate hop popping).
4. You ping 40.40.40.40 from P1 and it fails. Is the VPN broken?
Answer. No. P routers don't hold customer routes; they only switch labels. The valid test is from the CE, or with ping vrf from the PE.
5. The core links have an MTU of 1500. What happens to a 1500-byte customer IP packet with DF set?
Answer. With two labels it weighs 1508 bytes and doesn't fit. With DF set it's dropped and the router sends an ICMP fragmentation-needed message. The fix is to raise the core MTU.
Key takeaways
- OSPF-into-BGP redistribution goes inside
address-family ipv4 vrf, with that VRF's OSPF process. - VPN routes are VPNv4 prefixes: they carry an RD, a route target and, with OSPF, the domain ID, route type and router ID.
- Without
send-community bothorextended, extended attributes don't travel and nothing is imported. - The RD changes on each PE; the route target is what ties the customer's sites together.
- The VPN label never changes; the transport label is swapped at each P and removed at the penultimate hop.
- P routers don't know customer routes: the provider is a super cable.
- Each label adds 4 bytes; design the core MTU with headroom.
Official resources
- Configure a Basic MPLS VPN Network (Cisco)cisco.com
- MPLS: Layer 3 VPNs Configuration Guide · Multiprotocol BGP MPLS VPN (Cisco)cisco.com
- MPLS MTU Command Changes (Cisco)cisco.com
- RFC 3032 · MPLS Label Stack Encodingrfc-editor.org
- RFC 4364 · BGP/MPLS IP Virtual Private Networksrfc-editor.org
- RFC 4577 · OSPF as the PE/CE Protocol for BGP/MPLS IP VPNsrfc-editor.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.