MPLS label
1. 32-bit long.
2. First 20 bits for label, second 3 bits for EXP which is used for quality of service, third 1 bit for bottom of the stack, last 8 bits for time to live.
3. Here is the break down:
a. bit 0 to bit 19: Label.
b. bit 20 to bit 22: EXP.
c. bit 23: Bottom of the stack (BoS), 0 means it is not BoS, 1 means it is BoS.
d. bit 24 to 31: TTL.
4. If more than one label is imposed, the label is packed into a stack, the top of the stack is known as top label, and bottom of the stack is known as bottom label. MPLS VPN and AToM (Any Traffic over MPLS) requires two labels to work.
5. Each IP prefix has a unique label which is locally significant to the LSR.
Where does MPLS label reside?
MPLS is a shim between layer2 header (can be PPP, HDLC, Ethernet) and Layer3 header (IPv4, IPv6, IPX….).
MPLS is said to be layer 2.5, because it fits neither in layer2 nor layer3.
Label Switch Router (LSR)
1. Ingress LSR – Receives packet that is not labeled yet, it imposes label onto inbound traffic and send them away.
2. Egress LSR – Receives packet that has already been labeled, strips off the label and send the packet out unlabeled.
3. Intermediate LSR – Receives a labeled packet, swaps the label and sends the packet away labeled.
4. Ingress and Egress LSRs are the edge LSRs, in MPLS VPN terms they are the PE routers.
5. LSR performs push, pop or swap label.
Forward Equivalence Class (FEC)
1. A group of packets forwards along the same path with the same forwarding treatment.
2. The forwarding treatment is based on the bits set in EXP field of MPLS label.
3. All packet in the same FEC has the same label, however not all the packets with the same label belong to the same FEC, there might be difference with regards to the bits set in EXP field and will be treated unfairly.
4. In other words, packet with the same MPLS label i.e. from first 20-bit label field to the second 3-bit EXP field is in the same FEC.
Label distribution protocols
1. Tag distribution protocol (TDP) – Cisco proprietary protocol. Cisco came out its way of distributing label in MPLS network while IETF was finalizing LDP. Distributes labels to non-BGP routes.
2. Label distribution protocol (LDP) – IETF standard. Distributes labels to non-BGP routes.
3. MP-BGP – Distributes labels to BGP-route. Use in MPLS VPN.
4. RSVP – Resource Reservation Protocol distributes MPLS-TE labels only. Use in MPLS Traffic Engineering only.
m1#sh mpls interfaces Interface IP Tunnel BGP Static Operational Serial0/0/0 Yes (ldp) No No No Yes Serial0/1/0 Yes (ldp) No No No Yes m1#
This command shows whether MPLS is in operation or not, it also informs you which label distribution protocol the LSR is using.
Upstream LSR? Downstream LSR?
1. LSR is said to be an upstream if it is towards the source with reference to Route Information Base (routing table).
2. LSR is said to be a downstream if it is towards the destination with reference to Route Information Base.
Local and remote label/binding
1. For each IP prefix except for BGP prefix, a label is bound by the LSR and stored in Label Information Base (LIB). This is the local label/binding.
2. A LSR receives a label from its neighbour LSR and stores this label to its LIB, this is known as remote label/binding.
Label information base (LIB) and Label forwarding instance base (LFIB)
1. LIB stores all local and remote labels.
2. One remote label is chosen as the outgoing label from LIB, the chosen one is installed in LFIB.
3. The chosen one is based on the best path found in the routing table, LFIB like the routing table only chooses the best path to the destination.
m1#show mpls ldp binding lib entry: 10.1.1.0/30, rev 29 local binding: label: imp-null remote binding: lsr: 10.10.10.2:0, label: imp-null remote binding: lsr: 10.10.10.3:0, label: 19 lib entry: 10.1.1.4/30, rev 4 local binding: label: imp-null remote binding: lsr: 10.10.10.3:0, label: imp-null remote binding: lsr: 10.10.10.2:0, label: 25 lib entry: 10.1.1.8/30, rev 25 local binding: label: 22 remote binding: lsr: 10.10.10.3:0, label: imp-null remote binding: lsr: 10.10.10.2:0, label: imp-null lib entry: 10.1.1.12/30, rev 8 local binding: label: imp-null remote binding: lsr: 10.10.10.3:0, label: 17 remote binding: lsr: 10.10.10.2:0, label: 29 lib entry: 10.1.1.20/30, rev 10 local binding: label: 17 remote binding: lsr: 10.10.10.3:0, label: imp-null remote binding: lsr: 10.10.10.2:0, label: 28 lib entry: 10.10.10.1/32, rev 12 local binding: label: imp-null remote binding: lsr: 10.10.10.3:0, label: 18 remote binding: lsr: 10.10.10.2:0, label: 24 lib entry: 10.10.10.2/32, rev 27 local binding: label: 23 remote binding: lsr: 10.10.10.3:0, label: 16 remote binding: lsr: 10.10.10.2:0, label: imp-null lib entry: 10.10.10.3/32, rev 16 local binding: label: 19 remote binding: lsr: 10.10.10.3:0, label: imp-null remote binding: lsr: 10.10.10.2:0, label: 23 lib entry: 10.10.10.4/32, rev 18 local binding: label: 20 remote binding: lsr: 10.10.10.3:0, label: 20 remote binding: lsr: 10.10.10.2:0, label: 27 lib entry: 10.10.10.6/32, rev 20 local binding: label: 21 remote binding: lsr: 10.10.10.3:0, label: 21 remote binding: lsr: 10.10.10.2:0, label: 26 m1#
This is the LIB, as shown LIB stores all local bindings and remote bindings.
m1#show mpls forwarding-table Local Outgoing Prefix Bytes Label Outgoing Next Hop Label Label or Tunnel Id Switched interface 17 Pop Label 10.1.1.20/30 0 Se0/0/0 point2point 19 Pop Label 10.10.10.3/32 0 Se0/0/0 point2point 20 No Label 10.10.10.4/32 0 Fa0/0 10.1.1.14 21 21 10.10.10.6/32 0 Se0/0/0 point2point 22 Pop Label 10.1.1.8/30 0 Se0/1/0 point2point Pop Label 10.1.1.8/30 0 Se0/0/0 point2point 23 Pop Label 10.10.10.2/32 0 Se0/1/0 point2point m1#
This is the LFIB, only the chosen ones are installed here.
Implicit NULL label (imp-null) and Penultimate Hop Popping (PHP)
m1#sh mpls ldp binding 10.1.1.0 30 lib entry: 10.1.1.0/30, rev 29 local binding: label: imp-null remote binding: lsr: 10.10.10.2:0, label: imp-null remote binding: lsr: 10.10.10.3:0, label: 19 m1#
This LSR is the egress LSR of 10.1.1.0/30.
The egress LSR assigns a label 3 which is the imp-null label and sends upstream to its neighbour LSR, the neighbour LSR that receives imp-null label pops the top label when it receives an inbound traffic destined towards the egress LSR.
The upstream LSR that pops the label is known as penultimate hop popping LSR.
LSR m1 is an egress LSR as well as a PHP LSR, if the traffic is destined to 10.10.10.2, m1 pops the label and send to the egress router.
This method actually saves egress LSR from doing two lookups; one for LFIB lookup to decide the next destination, the other is IP lookup once the packet is popped.
Lab Scenario

LSR m1
! hostname m1 ! ip cef ! mpls label protocol ldp ! interface Loopback0 ip address 10.10.10.1 255.255.255.255 ! interface FastEthernet0/0 ip address 10.1.1.13 255.255.255.252 ip ospf network point-to-point duplex auto speed auto ! interface Serial0/0/0 ip address 10.1.1.5 255.255.255.252 mpls ip clock rate 2000000 ! interface Serial0/1/0 ip address 10.1.1.1 255.255.255.252 mpls ip ! router ospf 1 router-id 1.1.1.1 area 10 stub no-summary passive-interface default no passive-interface FastEthernet0/0 no passive-interface Serial0/0/0 no passive-interface Serial0/1/0 no passive-interface Loopback0 network 10.1.1.1 0.0.0.0 area 0 network 10.1.1.5 0.0.0.0 area 0 network 10.1.1.13 0.0.0.0 area 10 network 10.10.10.1 0.0.0.0 area 0 !
LSR m2
! hostname m2 ! ip cef ! mpls label protocol ldp ! interface Loopback0 ip address 10.10.10.2 255.255.255.255 ! interface FastEthernet0/0 no ip address shutdown duplex auto speed auto ! interface FastEthernet0/1 no ip address shutdown duplex auto speed auto ! interface Serial0/0/0 ip address 10.1.1.10 255.255.255.252 mpls ip clock rate 2000000 ! interface Serial0/1/0 ip address 10.1.1.2 255.255.255.252 mpls ip clock rate 2000000 ! router ospf 1 router-id 2.2.2.2 log-adjacency-changes passive-interface default no passive-interface Serial0/0/0 no passive-interface Serial0/1/0 no passive-interface Loopback0 network 10.1.1.2 0.0.0.0 area 0 network 10.1.1.10 0.0.0.0 area 0 network 10.10.10.2 0.0.0.0 area 0 !
LSR m3
! hostname m3 ! ip cef ! mpls label protocol ldp ! interface Loopback0 ip address 10.10.10.3 255.255.255.255 ! interface FastEthernet0/0 ip address 10.1.1.21 255.255.255.252 ip ospf network point-to-point duplex auto speed auto ! interface Serial0/0/0 ip address 10.1.1.9 255.255.255.252 mpls ip ! interface Serial0/1/0 ip address 10.1.1.6 255.255.255.252 mpls ip ! router ospf 1 router-id 3.3.3.3 log-adjacency-changes area 20 stub no-summary passive-interface default no passive-interface FastEthernet0/0 no passive-interface Serial0/0/0 no passive-interface Serial0/1/0 no passive-interface Loopback0 network 10.1.1.6 0.0.0.0 area 0 network 10.1.1.9 0.0.0.0 area 0 network 10.1.1.21 0.0.0.0 area 20 network 10.10.10.3 0.0.0.0 area 0 !
Router 1921-1
! hostname 1921-1 ! interface Loopback0 ip address 10.10.10.4 255.255.255.255 ! interface GigabitEthernet0/0 ip address 10.1.1.14 255.255.255.252 ip ospf network point-to-point duplex auto speed auto ! router ospf 1 router-id 4.4.4.4 log-adjacency-changes area 10 stub passive-interface default no passive-interface GigabitEthernet0/0 no passive-interface Loopback0 network 10.1.1.14 0.0.0.0 area 10 network 10.10.10.4 0.0.0.0 area 10 !
Router R5-2651-3
! hostname R5-2651-3 ! ! interface Loopback0 ip address 10.10.10.6 255.255.255.255 ! interface FastEthernet0/0 ip address 10.1.1.22 255.255.255.252 ip ospf network point-to-point duplex auto speed auto ! ! router ospf 1 router-id 6.6.6.6 log-adjacency-changes area 20 stub passive-interface default no passive-interface FastEthernet0/0 no passive-interface Loopback0 network 10.1.1.22 0.0.0.0 area 20 network 10.10.10.6 0.0.0.0 area 20 !