Configuring BGP shortcuts using next-hop MPLS

Configure BGP shortcuts using next-hop MPLS to enable BGP to use an MPLS tunnel as the preferred route to a destination network when a tunnel is available. By default, BGP considers only IP routes when building a routing table.

Before configuring next-hop MPLS, configure the LSPs.

To configure BGP shortcuts using next-hop MPLS, perform the following steps.

  1. In privileged EXEC mode, enter global configuration mode.
    device# configure terminal
    
  2. Enable BGP routing.
    device(config)# router bgp
    
  3. Configure the autonomous system number (ASN) in which your device resides.
    device(config-bgp-router)# local-as 10
    
  4. Configure the ASN for a remote neighbor.
    device(config-bgp-router)# neighbor 10.1.1.2 remote-as 20
    
  5. Configure the ASN for a second remote neighbor.
    device(config-bgp-router)# neighbor 10.10.1.2 remote-as 20
    
    Repeat this step for additional remote neighbors, as required.
  6. Enter BGP address-family IPv4 unicast configuration mode.
    device(config-bgp-router)# address-family ipv4 unicast
    
  7. Enable next-hop MPLS with the option to compare the LSP metrics.
    device(config-bgp-ipv4u)# next-hop-mpls compare-lsp-metric
    
    The compare-lsp-metric option enables BGP to compare the configured LSP metrics to determine which LSP has the lowest cost and is the preferred path. Without the option, BGP internally sets the cost of the LSPs with the lowest metric value to one instead of the actual value.
  8. Exit address family configuration mode.
    device(config-bgp-ipv4u)# Ctrl-z
    

Example

The following configuration is an example of the previous steps and includes the configuration of the LSPs and their metrics.

device(config)# router mpls
device(config-router-mpls)# lsp to2
device(config-router-mpls-lsp-to2)# no enable
device(config-router-mpls-lsp-to2)# to 10.1.1.2
device(config-router-mpls-lsp-to2)# from 10.1.1.1
device(config-router-mpls-lsp-to2)# metric 10
device(config-router-mpls-lsp-to2)# enable
device(config-router-mpls-lsp-to2)#exit
device(config-mpls)# lsp to2_sec
device(config-router-mpls-lsp-to2_sec)# no enable
device(config-router-mpls-lsp-to2_sec)# to 10.10.1.2
device(config-router-mpls-lsp-to2_sec)# from 10.10.1.1
device(config-router-mpls-lsp-to2_sec)# metric 10
device(config-router-mpls-lsp-to2_sec)# enable
device(config-router-mpls-lsp-to2_sec)# exit
device(config-router-mpls)# exit
device(config)# router bgp
device(config-bgp-router)# local-as 10
device(config-bgp-router)# neighbor 10.1.1.2 remote-as 20
device(config-bgp-router)# neighbor 10.10.1.2 remote-as 20
device(config-bgp-router)# address-family ipv4 unicast
device(config-bgp-ipv4u)# next-hop-mpls compare-lsp-metric
device(config-bgp-ipv4u)# Ctrl-z

Verifying the next-hop MPLS LSPs

The show mpls lsp command verifies the configuration of the LSPs.

device# show mpls lsp
LSP            To              Admin Oper  Tunnel   Up/Dn Retry Active
Name           Address         State State Intf     Times Num   Path
to2            10.1.1.2        UP    UP    tnl0     1     0     2
to2_sec        10.10.1.2       UP    UP    tnl2     1     0     3

Enter the show ip route command to verify that the LSPs are in the routing table. For example:

device# show ip route 111.111.111.0
IP Routing Table for VRF "default-vrf"

Total number of IP routes: 170

'*' denotes best ucast next-hop

'[x/y]' denotes [preference/metric]

111.111.111.0/24 

    *via DIRECT, Lsp 10, [200/0], 3m4s, iBgp, tag 0
    *via DIRECT, Lsp 12, [200/0], 3m4s, iBgp, tag 0