Implementing MPLS Static Labeling

The MPLS static feature enables you to statically assign local labels to an IPv4 prefix per VRF. Also, Label Switched Paths (LSPs) can be provisioned for these static labels by specifying the next-hop information that is required to forward the packets containing static label.

If there is any discrepancy between labels assigned statically and dynamically, the router issues a warning message in the console log. By means of this warning message, the discrepancy can be identified and resolved.

Static labels are more advantageous than dynamic labels because static labels:

  • Improve security because the risk of receiving unwanted labels from peers (running a compromised MPLS dynamic labeling protocol) is reduced.

  • Gives users full control over defined LSPs.Gives users full control over defined LSPs.

  • Utilize system resources optimally because dynamic labeling is not processed.

To perform static binding of MPLS labels, you need to:

Restrictions

  • Static labeling on IPv6 packets is not supported.

  • The router does not prevent label discrepancy at the time of configuring static labels. Any generated discrepancy needs to be subsequently cleared.

  • Equal-cost multi-path routing (ECMP) is not supported.

  • Interfaces must be explicitly configured to handle traffic with static MPLS labels.

  • The MPLS per-VRF labels cannot be shared between MPLS static and other applications.

Feature History for Implementing MPLS Static Labeling

Release

Modification

Release 5.1.1

This feature was introduced.

Enable MPLS Encapsulation on an Interface

By default, MPLS encapsulation is disabled on all interfaces. MPLS encapsulation has to be explicitly enabled on all ingress and egress MPLS interfaces through which the static MPLS labeled traffic travels.

SUMMARY STEPS

  1. configure
  2. mpls static
  3. interface interface
  4. commit

DETAILED STEPS


Step 1

configure

Step 2

mpls static

Example:

RP/0/RP0/CPU0:router(config)# mpls static

Enters MPLS-static configuration mode.

Step 3

interface interface

Example:

RP/0/RP0/CPU0:router(config-mpls-static)# interface gigabitethernet 0/0/0/3

Enables MPLS encapsulation on the specified interface.

Step 4

commit


What to do next

To verify the interfaces on which MPLS is enabled, use the show mpls interfaces command from the EXEC mode. For example:
RP/0/RP0/CPU0:router# show  mpls interfaces
Mon May 12 06:21:30.937 DST
Interface                  LDP      Tunnel   Static   Enabled
-------------------------- -------- -------- -------- --------
GigabitEthernet0/0/0/3     No       No       Yes      Yes

For the interface on which MPLS static is enabled, the "Static" column displays "Yes".

Define a Range for Static MPLS Labels

The MPLS label range configuration defines the dynamic label range. Any label that falls outside this dynamic range is available for manually allocating as static labels. The router does not verify statically-configured labels against the specified label range. Therefore, to prevent label discrepancy, ensure that you do not configure static MPLS labels that fall within the dynamic label range.


Note

The allocable range for MPLS labels is from 16 to 1048575. Label values from 0 to15 are reserved according to RFC-3032.


SUMMARY STEPS

  1. configure
  2. mpls label range minimum_value maximum_value
  3. commit

DETAILED STEPS


Step 1

configure

Step 2

mpls label range minimum_value maximum_value

Example:

RP/0/RP0/CPU0:router(config)# mpls label range 20000 30000

Specifies the range through which dynamic MPLS labels are allocated. All labels falling outside this range (16 to 19999 and 30001 to 1048575) can be manually allocated as static labels.

Step 3

commit


Setup a Static LSP

In this task, a static MPLS LSP is setup for a specific ingress label.

SUMMARY STEPS

  1. configure
  2. mpls static
  3. address-family ipv4 unicast
  4. local-label label-value allocate
  5. forward path path_id nexthop nexthop_address interface_type interface_id out-label outgoing_label
  6. commit

DETAILED STEPS


Step 1

configure

Step 2

mpls static

Example:

RP/0/RP0/CPU0:router(config)# mpls static

Enters MPLS-static configuration mode.

Step 3

address-family ipv4 unicast

Example:

RP/0/RP0/CPU0:router(config-mpls-static)# address-family ipv4 unicast

Applies the static configuration to an IPv4 address family in the default VRF.

Step 4

local-label label-value allocate

Example:

RP/0/RP0/CPU0:router(config-mpls-static-af)# local-label 30500 allocate

Specifies the incoming label value as 30500.

Step 5

forward path path_id nexthop nexthop_address interface_type interface_id out-label outgoing_label

Example:

RP/0/RP0/CPU0:router(config-mpls-static-af-lbl)# forward path 1 nexthop 10.2.2.2 gigabitEthernet 0/0/0/1 out-label 30501

For packets that are received with the label, 30500, the MPLS protocol swaps labels and applies the label, 30501. After applying the new label, it forwards the packets to the next hop, 10.2.2.2, through the GigabitEthernet interface, 0/0/0/1.

Step 6

commit


Allocate Static MPLS Label to an IP Prefix and Configure a LSP

Static MPLS label bindings for IP prefixes are used by MPLS applications such as Label Distribution Protocol (LDP) or Border Gateway Protocol (BGP) for MPLS switching. It is possible to define a static LSP for the static label.

SUMMARY STEPS

  1. configure
  2. mpls static
  3. address-family ipv4 unicast
  4. local-label label-value allocate per-prefix IPv4_prefix_entry
  5. forward path path_id nexthop nexthop_address out-label outgoing_label
  6. commit

DETAILED STEPS


Step 1

configure

Step 2

mpls static

Example:

RP/0/RP0/CPU0:router(config)# mpls static

Enters MPLS-static configuration mode.

Step 3

address-family ipv4 unicast

Example:

RP/0/RP0/CPU0:router(config-mpls-static)# address-family ipv4 unicast

Applies the static configuration to an IPv4 address family in the default VRF.

Step 4

local-label label-value allocate per-prefix IPv4_prefix_entry

Example:

RP/0/RP0/CPU0:router(config-mpls-static-af)# local-label 30500 allocate per-prefix 100.1.1.0/24

The MPLS protocol requests label 30500 to be statically bound as a local label for the prefix 100.1.1.0/24.

Step 5

forward path path_id nexthop nexthop_address out-label outgoing_label

Example:

RP/0/RP0/CPU0:router(config-mpls-static-af-lbl)# forward path 1 nexthop 10.2.2.2 out-label 30501

For packets that are received with the label, 30500, the MPLS protocol swaps labels and applies the label, 30501. After applying the new label, it forwards the packets to the next hop, 10.2.2.2.

Example:

RP/0/RP0/CPU0:router(config-mpls-static-af-lbl)# forward path 1 nexthop gigabitEthernet 0/0/0/4 out-label pop

For packets that are received with the label, 30500, the MPLS protocol removes the existing label. After removing the label, it forwards the packets to the next hop through the egress interface, GigabitEthernet 0/0/0/4.

Step 6

commit


Allocate Static MPLS Label for a Specific VRF

In this task, a static MPLS label is allocated to an IP prefix for a specific VRF.


Note

When a static MPLS label is allocated to an IP prefix for a specific VRF, it is not possible to define a static LSP for that static label.


SUMMARY STEPS

  1. configure
  2. mpls static
  3. vrf vrf_name address-family ipv4 unicast
    • local-label label-value allocate per-prefix IPv4_prefix_entry
    • local-label label-value allocate per-vrf forward path path-id pop-and-lookup
  4. commit

DETAILED STEPS


Step 1

configure

Step 2

mpls static

Example:

RP/0/RP0/CPU0:router(config)# mpls static

Enters MPLS-static configuration mode.

Step 3

vrf vrf_name address-family ipv4 unicast

Example:

RP/0/RP0/CPU0:router(config-mpls-static)# vrf vrf1 address-family ipv4 unicast

Applies the static configuration to an IPv4 address family in the VRF named vrf1.

Step 4

  • local-label label-value allocate per-prefix IPv4_prefix_entry
  • local-label label-value allocate per-vrf forward path path-id pop-and-lookup

Example:

RP/0/RP0/CPU0:router(config-mpls-static-vrf-af)# local-label 30500 allocate per-prefix 100.1.1.0/24

The MPLS protocol requests label 30500 to be statically bound as a local label for the prefix 100.1.1.0/24 in the VRF named vrf1.

Example:

RP/0/RP0/CPU0:router(config-mpls-static-vrf-af)# local-label 30500 allocate per-vrf forward path 1 pop-and-lookup

The MPLS protocol requests single label 30500 to be statically bound as a local label for all the prefixes in the VRF named vrf1. When the router receives packets with VRF label 30500, it removes the label and then performs IP-based lookup to forward the packets.

Step 5

commit


Verify MPLS Static Bindings

These are the show commands that can be used to verify MPLS static bindings and LSPs.

SUMMARY STEPS

  1. show mpls static local-label label_value
  2. show mpls label range
  3. show mpls lsd forwarding

DETAILED STEPS


Step 1

show mpls static local-label label_value

Example:

RP/0/RP0/CPU0:router#show mpls static local-label 200
Tue Apr 22 18:21:55.764 UTC
Label   VRF             Type         Prefix           RW Configured   Status   
------- --------------- ------------ ---------------- --------------- -------- 
200     default         Per-Prefix   10.10.10.10/32   Yes             Created

Verifies that the status is "Created" for the specified label value.

Step 2

show mpls label range

Example:

RP/0/RP0/CPU0:router#show mpls label range
Mon Apr 28 19:56:00.596 IST
Range for dynamic labels: Min/Max: 16000/1048575
Checks the dynamic range and ensures that the specified local-label value is outside this range.
Step 3

show mpls lsd forwarding

Example:

RP/0/RP0/CPU0:router#show mpls lsd forwarding         
Tue Apr 29 15:59:52.011 UTC
In_Label, (ID), Path_Info: <Type>
89, (IPv4, 'default':4U, 10.6.2.55/32), 1 Paths
   1/1: IPv4, 'default':4U, Gi0/0/0/21, nh=0.0.0.0, lbl=89, tun_id=0, flags=0x0 () 
110, (IPv4, 'default':4U, 172.16.0.1/32), 1 Paths
   1/1: IPv4, 'default':4U, Gi0/1/0/0, nh=10.12.1.2, lbl=Pop, tun_id=0, flags=0x0 () 
120, (IPv4, 'default':4U, 192.168.0.1/32), 1 Paths
   1/1: IPv4, 'default':4U, Gi0/1/0/0, nh=10.12.1.2, lbl=0, tun_id=0, flags=0x0 () 
130, (IPv4, 'default':4U, 209.165.201.1/32), 1 Paths
   1/1: IPv4, 'default':4U, Gi0/1/0/0, nh=10.12.1.2, lbl=200, tun_id=0, flags=0x0 () 
Verifies that the MPLS static configuration has taken effect, and the label forwarding is taking place.

Identify and Clear Label Discrepancy

During configuring or de-configuring static labels or a label range, a label discrepancy can get generated when:

  • A static label is configured for an IP prefix (per VRF) that already has a binding with a dynamic label.

  • A static label is configured for an IP prefix, when the same label value is dynamically allocated to another IP prefix.

Complete these steps to identify and clear the discrepancies.

Procedure


Step 1

To identify a label discrepancy, execute one of these:

  • show mpls static local-label discrepancy
  • show log

Example:

RP/0/RP0/CPU0:router#show mpls static local-label discrepancy 
Tue Apr 22 18:36:31.614 UTC
Label   VRF             Type         Prefix           RW Configured   Status   
------- --------------- ------------ ---------------- --------------- -------- 
16003   default         Per-Prefix   10.0.0.1/32       No              Discrepancy

Example:

RP/0/RP0/CPU0:router#show log
Thu Apr 24 14:18:57.655 UTC
Syslog logging: enabled (0 messages dropped, 0 flushes, 0 overruns)
    Console logging: level warnings, 199 messages logged
    Monitor logging: level debugging, 0 messages logged
    Trap logging: level informational, 0 messages logged
    Buffer logging: level debugging, 2 messages logged

Log Buffer (307200 bytes):

RP/0/RSP0/CPU0:Apr 24 14:18:53.743 : mpls_static[1043]: %ROUTING-MPLS_STATIC-7-ERR_STATIC_LABEL_DISCREPANCY : 
The system detected 1 label discrepancies (static label could not be allocated due to conflict with other applications).  
Please use 'clear mpls static local-label discrepancy' to fix this issue. 
RP/0/RSP0/CPU0:Apr 24 14:18:53.937 : config[65762]: %MGBL-CONFIG-6-DB_COMMIT : Configuration committed by user 'cisco'. 
Use 'show configuration commit changes 1000000020' to view the changes. 

Step 2

clear mpls static local-label discrepancy all

Example:

RP/0/RP0/CPU0:router# clear mpls static local-label discrepancy all

Clears label discrepancy by allocating a new label to those IP prefixes that are allocated dynamic label. The static label configuration takes precedence while clearing discrepancy. Traffic can be affected while clearing discrepancy.