Skip to content

MPLS

MPLS (Multiprotocol Label Switching) is a high-performance packet forwarding technology that uses short labels rather than long network addresses to direct data packets through a network. MPLS creates virtual links (Label Switched Paths) between distant nodes regardless of underlying network topology, enabling traffic engineering, Quality of Service (QoS) prioritization, and VPN services. The label mode configuration determines how MPLS labels are allocated and distributed for VPN routes, with options including per-VRF (one label per VRF), per-prefix (unique label per route), per-CE (one label per customer edge router), and VRF connection aggregation modes. These label allocation strategies enable service providers to optimize label space utilization while maintaining traffic separation and scalability across their MPLS networks.

Diagram
NameTypeConstraintMandatoryDefault Value
mplsClass[mpls]No

NameTypeConstraintMandatoryDefault Value
label_protocolStringNo
label_mode_all_vrfs_all_afs_per_vrfBooleantrue, falseNo
label_mode_all_vrfs_all_afs_per_prefixBooleantrue, falseNo
label_mode_all_vrfs_all_afs_per_ceBooleantrue, falseNo
label_mode_all_vrfs_all_afs_vrf_conn_aggrBooleantrue, falseNo
label_mode_all_vrfs_bgp_vpnv4_per_vrfBooleantrue, falseNo
label_mode_all_vrfs_bgp_vpnv4_per_prefixBooleantrue, falseNo
label_mode_all_vrfs_bgp_vpnv4_per_ceBooleantrue, falseNo
label_mode_all_vrfs_bgp_vpnv4_vrf_conn_aggrBooleantrue, falseNo
label_mode_all_vrfs_bgp_vpnv6_per_vrfBooleantrue, falseNo
label_mode_all_vrfs_bgp_vpnv6_per_prefixBooleantrue, falseNo
label_mode_all_vrfs_bgp_vpnv6_per_ceBooleantrue, falseNo
label_mode_all_vrfs_bgp_vpnv6_vrf_conn_aggrBooleantrue, falseNo

Key Components:

  • Label Protocol (label_protocol): Configures the MPLS label distribution protocol (e.g., LDP, TDP).

  • Label Mode - All VRFs, All Address Families: Configures label allocation mode for all VRFs across all address families:

    • Per-VRF Mode (label_mode_all_vrfs_all_afs_per_vrf): Allocates one label per VRF, minimizing label space usage.
    • Per-Prefix Mode (label_mode_all_vrfs_all_afs_per_prefix): Allocates unique labels per route prefix for granular traffic engineering.
    • Per-CE Mode (label_mode_all_vrfs_all_afs_per_ce): Allocates one label per customer edge router.
    • VRF Connection Aggregation (label_mode_all_vrfs_all_afs_vrf_conn_aggr): Aggregates VRF connections for optimized label allocation.
  • Label Mode - BGP VPNv4 Specific: Configures label allocation mode specifically for BGP VPNv4 routes:

    • Per-VRF Mode (label_mode_all_vrfs_bgp_vpnv4_per_vrf): One label per VRF for VPNv4.
    • Per-Prefix Mode (label_mode_all_vrfs_bgp_vpnv4_per_prefix): Unique labels per VPNv4 prefix.
    • Per-CE Mode (label_mode_all_vrfs_bgp_vpnv4_per_ce): One label per customer edge for VPNv4.
    • VRF Connection Aggregation (label_mode_all_vrfs_bgp_vpnv4_vrf_conn_aggr): Aggregated VRF connections for VPNv4.
  • Label Mode - BGP VPNv6 Specific: Configures label allocation mode specifically for BGP VPNv6 routes:

    • Per-VRF Mode (label_mode_all_vrfs_bgp_vpnv6_per_vrf): One label per VRF for VPNv6.
    • Per-Prefix Mode (label_mode_all_vrfs_bgp_vpnv6_per_prefix): Unique labels per VPNv6 prefix.
    • Per-CE Mode (label_mode_all_vrfs_bgp_vpnv6_per_ce): One label per customer edge for VPNv6.
    • VRF Connection Aggregation (label_mode_all_vrfs_bgp_vpnv6_vrf_conn_aggr): Aggregated VRF connections for VPNv6.

Key Parameters Briefly Explained:

  • label_protocol: MPLS label distribution protocol (LDP, TDP).
  • label_mode_all_vrfs_all_afs_per_vrf: Per-VRF label allocation for all protocols and address families.
  • label_mode_all_vrfs_all_afs_per_prefix: Per-prefix label allocation for all protocols and address families.
  • label_mode_all_vrfs_all_afs_per_ce: Per-CE label allocation for all protocols and address families.
  • label_mode_all_vrfs_all_afs_vrf_conn_aggr: VRF connection aggregation for all protocols and address families.
  • label_mode_all_vrfs_bgp_vpnv4_*: BGP VPNv4-specific label modes.
  • label_mode_all_vrfs_bgp_vpnv6_*: BGP VPNv6-specific label modes.

You can use these MPLS label mode parameters to optimize label allocation across your MPLS VPN network. The per-VRF mode minimizes label consumption, per-prefix mode enables granular traffic engineering, per-CE mode simplifies multihoming scenarios, and VRF connection aggregation optimizes label space for hub-and-spoke topologies. Choose the appropriate label mode based on your network’s scale, traffic engineering requirements, and label space constraints.

The following configuration shows how to configure MPLS label modes on a Cisco IOS-XE device.

mpls label protocol ldp
mpls label mode all-vrfs protocol all-afs per-vrf

For BGP VPNv4-specific configuration:

mpls label protocol ldp
mpls label mode all-vrfs protocol bgp-vpnv4 per-prefix

For BGP VPNv6-specific configuration:

mpls label protocol ldp
mpls label mode all-vrfs protocol bgp-vpnv6 per-ce

The following YAML code defines MPLS label mode configuration on an IOS-XE device.

iosxe:
devices:
- name: Device1
configuration:
mpls:
label_protocol: ldp
label_mode_all_vrfs_all_afs_per_vrf: true

Example 2: Per-Prefix Label Mode for All Protocols

Section titled “Example 2: Per-Prefix Label Mode for All Protocols”
iosxe:
devices:
- name: CoreRouter1
configuration:
mpls:
label_protocol: ldp
label_mode_all_vrfs_all_afs_per_prefix: true

Example 3: BGP VPNv4 and VPNv6 Specific Configurations

Section titled “Example 3: BGP VPNv4 and VPNv6 Specific Configurations”
iosxe:
devices:
- name: PERouter1
configuration:
mpls:
label_protocol: ldp
label_mode_all_vrfs_bgp_vpnv4_per_vrf: true
label_mode_all_vrfs_bgp_vpnv6_per_prefix: true

Example 4: Per-CE Label Mode with VRF Connection Aggregation

Section titled “Example 4: Per-CE Label Mode with VRF Connection Aggregation”
iosxe:
devices:
- name: PERouter2
configuration:
mpls:
label_protocol: ldp
label_mode_all_vrfs_all_afs_per_ce: true
label_mode_all_vrfs_bgp_vpnv4_vrf_conn_aggr: true

Example 5: Service Provider Network Configuration

Section titled “Example 5: Service Provider Network Configuration”

This example shows a typical service provider PE router configuration with MPLS label modes optimized for scale.

iosxe:
devices:
- name: SP-PE-Router
configuration:
mpls:
label_protocol: ldp
label_mode_all_vrfs_all_afs_per_vrf: true