MPLS labeled packet flow
Once LDP protocol has established a session and labels are distributed. How is a packet switched from ingress LSR to destination Egress LSR ?
Using below topology and an actual lab, let’s follow the process hop by hop. Validation show commands will be used at each step to validate and confirm how labeled switching is executed.
| Hostname | Loopback address | Node type |
|---|---|---|
| PE1 | 172.16.1.1 | Cisco IOS |
| P1 | 172.16.1.2 | Cisco IOS |
| P2 | 172.16.1.3 | Cisco IOS |
| P3 | 172.16.1.4 | Cisco XR |
| PE2 | 172.16.1.5 | Cisco XR |
Actual lab was ran on Cisco VIRL, but EVE-NG could also be used.
From PE1, we can reach PE2 loopback 172.16.1.
PE1#ping 172.16.1.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/9/10 ms
On PE1, we want to check which labels (local and outgoing) are imposed on the packet destined for 172.16.1.5 PE2. It is the outgoing label which will be used by the next hop LSR to switch the packet onward.
In our case, local label is 19 and outgoing is 18.
PE1#sh mpls forwarding-table 172.16.1.5
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
19 18 172.16.1.5/32 0 Gi0/1 10.1.1.0
On P1 the next LSR, let’s check how is label 18 switched. Here we see outgoing label value is 18.
P1#sh mpls forwarding-table labels 18
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
18 18 172.16.1.5/32 1180 Gi0/2 10.1.1.2
On P2 same command is applied, with one interesting point. Outgoing label value changes to 24002.
On P2, label for destination 172.16.1.5 is received rom P3, which happens to be a Cisco XR and not IOS. So you would see a slight change in the label numbering. Running the command “sh mpls label range” would confirm that IOS range is [16-100000] and XR is [24000-1048575]. Note that you can also set a range using the command “mpls label range value1 value2”
P2#sh mpls forwarding-table labels 18
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
18 24002 172.16.1.5/32 0 Gi0/2 10.1.1.5
On P3 we expect to see another label switching operation from the 24002 we received from P2 to another one sent by PE2. But in this case, a different operation is takes place, Penultimate hop popping or PHP. So what happens here ?
The Egress LSR PE2, knows that 172.16.1.5 is a local network and does not need a label. PE2 sends an implicit-NULL label (label3), essentially telling P3 to pop the outer label and forward the native IP packet.
RP/0/0/CPU0:P3#sh mpls forwarding labels 24002
Wed Jan 22 12:11:14.003 UTC
Local Outgoing Prefix Outgoing Next Hop Bytes
Label Label or ID Interface Switched
------ ----------- ------------------ ------------ --------------- ------------
24002 Pop 172.16.1.5/32 Gi0/0/0/1 10.1.1.7 14760
End to end connectivity testing was validated by using a plain ping command from PE1 to PE2 loopback. In reality, to test the label switching path (LSP) correctly, “ping mpls” should be used. This requires that “mpls oam” is enabled globally on the LSR node.
PE1(config)#mpls oam
PE1(config-mpls)#ex
PE1(config)#^Z
!
PE1#ping mpls ipv4 172.16.1.5 255.255.255.255
Sending 5, 100-byte MPLS Echos to 172.16.1.5/32,
timeout is 2 seconds, send interval is 0 msec:
Codes: '!' - success, 'Q' - request not sent, '.' - timeout,
'L' - labeled output interface, 'B' - unlabeled output interface,
'D' - DS Map mismatch, 'F' - no FEC mapping, 'f' - FEC mismatch,
'M' - malformed request, 'm' - unsupported tlvs, 'N' - no label entry,
'P' - no rx intf label prot, 'p' - premature termination of LSP,
'R' - transit router, 'I' - unknown upstream index,
'X' - unknown return code, 'x' - return code 0
Type escape sequence to abort.
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/9/12 ms
!
Your Content Goes Here
Traceroute mpls can be ran without a need for “mpls oam” . This is a good command to show the labels used in the path.
PE1#traceroute mpls ipv4 172.16.1.5 255.255.255.255
Tracing MPLS Label Switched Path to 172.16.1.5/32, timeout is 2 seconds
Codes: '!' - success, 'Q' - request not sent, '.' - timeout,
'L' - labeled output interface, 'B' - unlabeled output interface,
'D' - DS Map mismatch, 'F' - no FEC mapping, 'f' - FEC mismatch,
'M' - malformed request, 'm' - unsupported tlvs, 'N' - no label entry,
'P' - no rx intf label prot, 'p' - premature termination of LSP,
'R' - transit router, 'I' - unknown upstream index,
'X' - unknown return code, 'x' - return code 0
Type escape sequence to abort.
0 10.1.1.1 MRU 1500 [Labels: 18 Exp: 0]
L 1 10.1.1.0 MRU 1500 [Labels: 18 Exp: 0] 6 ms
L 2 10.1.1.2 MRU 1500 [Labels: 24002 Exp: 0] 9 ms
. 3 *
! 4 10.1.1.7 12 ms
PE1#
!
!
!
