This article explains the calculation of the MPLS MTU and provides examples.
If the MPLS MTU is not explicitly configured in the configuration, Junos OS derives the MPLS MTU from the physical interface MTU. From this value, the software subtracts the encapsulation-specific overhead (14 bytes when VLAN tagging is not used, 18 bytes when single-level VLAN tagging is used ( vlan-tagging ) and 22 bytes when double-level VLAN tagging is used ( stacked-vlan-tagging or flexible-vlan-tagging ) and space required for the maximum number of labels that might be pushed in the Packet Forwarding Engine (PFE). By default, each interface supports 3 labels, so that the space for the maximum number of labels is 12 bytes (3*4 bytes). This value is then reported in the output of show interfaces command for a logical interface. Note, however, that this value represents the worst case scenario - the largest size of the IP packet when the maximum number of labels are stacked on top of it (in this case 3). The actual maximum size of the packet depends on the actual number of labels being stacked. For instance, on an untagged Ethernet interface (physical MTU = 1514 bytes), if MPLS MTU is not configured on the interface, the reported MPLS MTU on that interface is 1488 bytes and the reported maximum number of labels is 3, the egress interface will allow the following frames to leave the router via that interface:
vlan-tagging
stacked-vlan-tagging
flexible-vlan-tagging
show interfaces
family inet
The number of maximum labels can be changed via CLI command, under interface view, in order to support more labels. Example:
[edit interfaces so-2/1/0 unit 0 family mpls] labroot@mx480# set maximum-labels ? Possible completions: <maximum-labels> Protocol family maximum number of labels (3..5)
When maximum number of labels is changed, the auto-calculated MPLS MTU changes as well. For instance, when 5 labels are used the total byte space to store 5 labels is 20 bytes, so for an untagged Ethernet interface (physical MTU 1514 bytes), the auto-calculated worst case MPLS MTU value is 1480 bytes. However, for the M120 platform, the label space used to calculate MPLS MTU is always 8 bytes, no matter how many labels it actually supports.
If MPLS MTU size is configured manually, Junos OS expects that the user will include the MPLS label size to the calculation as well. In other words, if MPLS MTU is explicitly configured, Junos OS interprets is as total L3 payload size, equaling to the IP payload size plus the total size of MPLS label space being stacked on top of the IP packet (4 times number of labels being stacked). In that case the configured value will be reported in the output of show interfaces command. Refer to the examples below:
Check the protocol MPLS MTU:
> show interfaces ge-1/0/0 Physical interface: ge-1/0/0, Enabled, Physical link is Up <snip> Link-level type: Ethernet, MTU: 1514, MRU: 1522, LAN-PHY mode, <snip> Protocol mpls, MTU: 1488, Maximum labels: 3 <-- This value is auto-calculated from the physical interface MTU.
The calculation of PING payload for the worst case (3 labels stacked on top of IP packet) is:
1514 (physical interface MTU) - 14 (Layer 2 overhead) - 12 (MPLS label *3) - 20 (IP overhead) - 8 (ICMP header) = 1460 bytes
If less labels are stacked on top of IP packets, then we need to adjust this calculation as follows:
1 LABEL STACKED -> 1514 (physical interface MTU) - 14 (Layer 2 overhead) - 4 (MPLS label size *1) - 20 (IP overhead) - 8 (ICMP header) = 1468 bytes 2 LABELS STACKED -> 1514 (physical interface MTU) - 14 (Layer 2 overhead) - 8 (MPLS label size *2) - 20 (IP overhead) - 8 (ICMP header) = 1464 bytes 3 LABELS STACKED -> 1514 (physical interface MTU) - 14 (Layer 2 overhead) - 12 (MPLS label size *3) - 20 (IP overhead) - 8 (ICMP header) = 1460 bytes
Configuration:
# set interface ge-1/0/0 unit 0 family mpls mtu 1488
> show interfaces ge-1/0/0 Physical interface: ge-1/0/0, Enabled, Physical link is Up <snip> Link-level type: Ethernet, MTU: 1514, MRU: 1522, LAN-PHY mode, <snip> Protocol mpls, MTU: 1488, Maximum labels: 3 <-- This value equals to the manually set value!
As mentioned before, even though this value is equal to the auto-calculated value from Case 1 above, its interpretation differs. Junos OS takes into account that the value of 1488 is manually set within the logical interface configuration and interprets this value as maximum allowed L3 PDU size - the sum of the IP packet length and the size of all MPLS labels stacked on top of it. The calculation of PING payload in this case depends again on the amount of labels stacked on top of the IP packet:
1 LABEL STACKED -> 1488 (MPLS MTU configured manually) - 4 (MPLS label size *1) - 20 (IP overhead) - 8 (ICMP header) = 1456 bytes 2 LABELS STACKED -> 1488 (MPLS MTU configured manually) - 8 (MPLS label size *2) - 20 (IP overhead) - 8 (ICMP header) = 1452 bytes 3 LABELS STACKED -> 1488 (MPLS MTU configured manually) - 12 (MPLS label size *3) - 20 (IP overhead) - 8 (ICMP header) = 1448 bytes
Therefore, if you configure the MPLS MTU, remember to include the MPLS label stack size (4 times the total number of labels stacked on top of the IP packet) in the calculation.
# set interface ge-1/0/0 unit 0 family mpls mtu 1500
> show interfaces ge-1/0/0 Physical interface: ge-1/0/0, Enabled, Physical link is Up <snip> Link-level type: Ethernet, MTU: 1514, MRU: 1522, LAN-PHY mode, <snip> Protocol mpls, MTU: 1500, Maximum labels: 3 <-- This value equals to the manually set value!
Even though this value is different from the reported value from Case 1 above, it provides the same result. Junos OS takes into account that the value of 1500 is manually set within the logical interface configuration and interprets this value as maximum allowed L3 PDU size - the sum of the IP packet length and the size of all MPLS labels stacked on top of it. However, the frame size calculation is identical to the Case 1, regardless of differences on the output of show interfaces command.
The result of the calculation of PING payload is same as for Case 1, however the procedure to calculate the PING payload differs:
1 LABEL STACKED -> 1500 (MPLS MTU configured manually) - 4 (MPLS label size *1) - 20 (IP overhead) - 8 (ICMP header) = 1468 bytes 2 LABELS STACKED -> 1500 (MPLS MTU configured manually) - 8 (MPLS label size *2) - 20 (IP overhead) - 8 (ICMP header) = 1464 bytes 3 LABELS STACKED -> 1500 (MPLS MTU configured manually) - 12 (MPLS label size *3) - 20 (IP overhead) - 8 (ICMP header) = 1460 bytes
2018-12-25: Added M120 information. 2020-08-26: Rewritten to provide clarity. 2020-09-10: Added Case 3