Manual:MPLS/EXP bit behaviour

From MikroTik Wiki
Jump to: navigation, search

MPLS label EXP field overview

When MPLS label is attached to packet, it increases packet length by 32 bits (4 bytes). These 32 bits are broken down as follows:

  • label value itself (20 bits)
  • EXP ("experimental") field (3 bits)
  • time to live field (8 bits)
  • bottom of stack field (1 bit)

Use of "experimental" bits is not specified by MPLS standards, but most common use is to carry QoS information, similar to 802.1q priority in VLAN tag. Note that EXP field is 3 bits only therefore it can carry values from 0 to 7 only, which allows to have 8 traffic classes.

EXP field treatment in RouterOS

When RouterOS receives MPLS packet, it sets "ingress priority" value for packet to that carried inside top label. Note that "ingress priority" is not a field inside packet headers - it can be thought of like additional mark assigned to packet while being processed by router. When RouterOS labels MPLS packet, it sets EXP bits to "priority" (not "ingress priority"!) assigned to packet. When RouterOS switches MPLS packet, "ingress priority" is automatically copied to "priority", this way regular MPLS switching communicates priority info over whole label switched path.

Additional info on "ingress priority" and "priority" handling is also in WMM.

Therefore what happens to EXP field depends based on what action is taken on packet:

  • if packet is MPLS switched (by popping label off packet and pushing on new one), EXP field in new label will be the same as in received label, because:
    • RouterOS sets "ingress priority" to EXP bits in received label
    • Switching automatically sets "priority" to "ingress priority"
    • RouterOS labels packet with new label and sets its EXP bits to value in "priority".
  • if packet is MPLS switched by using penultimate-hop-popping (received label is popped off and no new one is pushed on), EXP field of received priority stays in "priority" field of packet and may be used by some other MAC protocol, e.g. WMM or 802.1q VLAN, for example:
    • RouterOS sets "ingress priority" to EXP bits in received label
    • Switching automatically sets "priority" to "ingress priority"
    • RouterOS switches packet to next hop (without pushing on label) and that happens over VLAN interface
    • VLAN interface sets 802.1q priority in VLAN header to "priority" value of packet.

Note that penultimate-hop-popping can therefore loose QoS information carried over label switched path at the last hop. In cases where this is not desirable, penultimate-hop-popping behaviour should be disabled by using Explicit NULL label instead of Implicit NULL label for last hop in label switched path. Using Explicit NULL label for last hop is default behaviour for MPLS TE tunnels.

  • if packet is supposed to be sent over label switched path (first label will get pushed on packet), EXP bits will be set to value in "priority", which in turn can be set up properly using firewall rules or other means (e.g. from DSCP field in IP header)
  • if packet is received for local processing, "ingress priority" is set to EXP field of received packet and can therefore be used to update DSCP field of packet or set "priority" from "ingress priority" using firewall rules

See also