Separate BGP RIBs for Labeled Routes

This chapter provides information about separate border gateway protocol (BGP) route information bases (RIBs) for labeled-unicast routes.

Applicability

This chapter was initially written for SR OS Release 14.0.R4, but the CLI in the current edition corresponds to SR OS Release 20.7.R2.

Release 14.0.R4 introduced separate BGP RIBs for labeled-unicast routes.

Overview

BGP separate labeled-IPv4 RIB implementation

RR-1 with separate labeled-IPv4 RIB implementation shows how RR-1 sends a labeled-IPv4 route to PE-2 with label X and next hop PE-1.

Figure 1. RR-1 with separate labeled-IPv4 RIB implementation

In SR OS Release 14.0.R4, and later, a separate RIB is used for labeled-IPv4 routes. With this implementation, client PE-2 learns the best labeled-IPv4 route and client PE-4 learns the best unlabeled IPv4 route. RR-1 does not need to set next-hop-self and traffic can be sent directly from PE-2 to PE-1 and from PE-4 to PE-3. The RR is used only for control traffic, as intended.

Seamless MPLS - Separate labeled-IPv4 implementation shows a seamless MPLS use case, which is a good example of the coexistence of labeled (AFI 1/SAFI 4) and unlabeled (AFI 1/SAFI 1) BGP sessions.

Figure 2. Seamless MPLS - Separate labeled-IPv4 implementation

RIB architecture

System architecture with separate RIBs for labeled-unicast and unlabeled routes shows the system architecture with four separate RIBs for IPv4 and IPv6 routes.

Figure 3. System architecture with separate RIBs for labeled-unicast and unlabeled routes

Labeled-unicast routes from peers are stored in a labeled RIB and unlabeled routes from the same or different peers are stored in a non-labeled RIB. Both labeled and unlabeled routes can be sent and received to and from the same peer. Different sets of routes can be advertised to labeled/unlabeled peers. Labeled and unlabeled BGP sessions are using the common equal cost multipath (ECMP) and multipath limit.

More user control is provided over the RTM route import process. By default, a RIB imports all non-BGP active routes from RTM, but a user-defined route policy can be applied. Route policies can be used to reduce BGP memory usage.

The address families mapped to the RIBs are: ipv4, label-ipv4, ipv6, label-ipv6. In route policies, protocol types bgp and bgp-label can be used.

The default RTM preference for labeled IP routes is configurable (label-preference) in the bgp context of the base router or a VPRN. The default preference is 170.

Configuration

All the examples are based on labeled and unlabeled IPv4 addresses. For IPv6, the configuration is similar.

Example IPv4 topology shows the example topology using IPv4 addresses.

Figure 4. Example IPv4 topology

The initial configuration includes:

  • Cards, MDAs, ports

  • Router interfaces

  • IS-IS in AS 64500 (PE-1, PE-2, PE-4)

  • LDP in AS 64500

  • Loopback addresses 3.3.3.3/32 in PE-3 and 4.4.4.4/32 in PE-4

  • Export policy "export-bgp" accepting routes from protocol direct on all nodes

The following will be configured and verified:

  1. Coexistence of labeled and unlabeled address families for BGP

  2. Applying next-hop-self

  3. Export policy to advertise route as labeled/unlabeled

  4. Behavior of RR with a mix of labeled and unlabeled iBGP sessions

Coexistence of labeled and unlabeled address families for BGP

BGP sessions shows the eBGP and iBGP sessions that are established between the nodes and the routes advertised for the loopback addresses.

Figure 5. BGP sessions

PE-1 acts as RR for PE-2 and PE-4, and it is an autonomous system border router (ASBR) toward PE-3. PE-1 has two single-family connections: unlabeled IPv4 to PE-3 and labeled IPv4 to PE-4. PE-1 also has one dual-family connection to PE-2. The BGP configuration on PE-1 is as follows:

# on PE-1:
configure
    router
        autonomous-system 64500
        bgp
            split-horizon
            group "eBGP"
                peer-as 64501
                neighbor 192.168.13.2
                    family ipv4
                exit
            exit
            group "iBGP"
                cluster 192.0.2.1
                export "export-bgp" 
                peer-as 64500
                neighbor 192.0.2.2
                    family ipv4 label-ipv4
                exit
                neighbor 192.0.2.4
                    family label-ipv4
                exit
            exit
            no shutdown
        exit

The BGP configuration on PE-2 is as follows:

# on PE-2:
configure
    router
        autonomous-system 64500
        bgp
            split-horizon
            group "iBGP"
                export "export-bgp"
                peer-as 64500
                neighbor 192.0.2.1
                    family ipv4 label-ipv4
                exit
            exit
            no shutdown
        exit

The BGP configuration on PE-3 in AS 64501 is as follows:

# on PE-3:
configure
    router
        autonomous-system 64501
        bgp
            split-horizon
            group "eBGP"
                export "export-bgp"
                peer-as 64500
                neighbor 192.168.13.1
                    family ipv4 
                exit
            exit
            no shutdown
        exit

The BGP configuration on PE-4 is as follows:

configure
    router
        autonomous-system 64500
        bgp
            split-horizon
            group "iBGP"
                export "export-bgp" 
                peer-as 64500
                neighbor 192.0.2.1
                    family label-ipv4
                exit
            exit
            no shutdown
        exit

The BGP summary on PE-1 shows that there is a dual-family connection with PE-2: IPv4 and Lbl-IPv4. PE-1 has an Lbl-IPv4 connection with PE-4 and an IPv4 connection with PE-3.

*A:PE-1# show router bgp summary all

===============================================================================
BGP Summary
===============================================================================
Legend : D - Dynamic Neighbor
===============================================================================
Neighbor
Description
ServiceId
                   AS PktRcvd InQ  Up/Down   State|Rcv/Act/Sent (Addr Family)
                      PktSent OutQ
-------------------------------------------------------------------------------
192.0.2.2
Def. Instance  64500        5    0 00h00m25s 2/0/6 (IPv4)
                            8    0           2/0/5 (Lbl-IPv4)
192.0.2.4
Def. Instance  64500        5    0 00h00m32s 3/1/4 (Lbl-IPv4)
                            7    0           
192.168.13.2
Def. Instance  64501        5    0 00h00m43s 3/2/0 (IPv4)
                            5    0           
-------------------------------------------------------------------------------

The unlabeled IPv4 routes on PE-1 include unlabeled routes imported from PE-2 and PE-3, including the loopback address 3.3.3.3/32 advertised by PE-3, as follows:

*A:PE-1# show router bgp routes ipv4 
===============================================================================
 BGP Router ID:192.0.2.1        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP IPv4 Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  3.3.3.3/32                                         None        None
      192.168.13.2                                       None        0
      64501                                                          -
*i    192.0.2.2/32                                       100         None
      192.0.2.2                                          None        10
      No As-Path                                                     -
u*>i  192.0.2.3/32                                       None        None
      192.168.13.2                                       None        0
      64501                                                          -
*i    192.168.12.0/30                                    100         None
      192.0.2.2                                          None        10
      No As-Path                                                     -
*i    192.168.13.0/30                                    None        None
      192.168.13.2                                       None        0
      64501                                                          -
-------------------------------------------------------------------------------
Routes : 5
===============================================================================

The labeled-unicast IPv4 routes on PE-1 include labeled routes imported from PE-2 and PE-4, including the loopback address 4.4.4.4/32 advertised by PE-4, as follows:

*A:PE-1# show router bgp routes label-ipv4 
===============================================================================
 BGP Router ID:192.0.2.1        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  4.4.4.4/32                                         100         None
      192.0.2.4                                          None        10
      No As-Path                                                     524284
*i    192.0.2.2/32                                       100         None
      192.0.2.2                                          None        10
      No As-Path                                                     524285
*i    192.0.2.4/32                                       100         None
      192.0.2.4                                          None        10
      No As-Path                                                     524284
*i    192.168.12.0/30                                    100         None
      192.0.2.2                                          None        10
      No As-Path                                                     524285
*i    192.168.14.0/30                                    100         None
      192.0.2.4                                          None        10
      No As-Path                                                     524284
-------------------------------------------------------------------------------
Routes : 5
===============================================================================

PE-2 imports the prefix 3.3.3.3/32 in its unlabeled RIB, as follows:

*A:PE-2# show router bgp routes 3.3.3.3/32 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP IPv4 Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  3.3.3.3/32                                         100         None
      192.168.13.2                                       None        20
      64501                                                          -
-------------------------------------------------------------------------------
Routes : 1
===============================================================================

PE-2 imports the prefix 4.4.4.4/32 in its labeled RIB, as follows:

*A:PE-2# show router bgp routes 4.4.4.4/32 label-ipv4 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  4.4.4.4/32                                         100         None
      192.0.2.4                                          None        20
      No As-Path                                                     524284
-------------------------------------------------------------------------------
Routes : 1
===============================================================================

As expected, the prefixes from address family label-ipv4 are advertised independently from the prefixes from address family ipv4.

Applying next-hop-self

PE-1 applies next-hop-self toward neighbor PE-2 shows that PE-1 applies next-hop-self for BGP updates toward PE-2.

Figure 6. PE-1 applies next-hop-self toward neighbor PE-2

On PE-1, next-hop-self is enabled for neighbor PE-2 only, as follows:

# on PE-1:
configure 
    router 
        bgp 
            group "iBGP" 
                neighbor 192.0.2.2 
                    next-hop-self
                exit

This applies to both address families. The next hop for unlabeled route 3.3.3.3/32 will be 192.0.2.1, as follows:

*A:PE-2# show router bgp routes 3.3.3.3/32 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP IPv4 Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  3.3.3.3/32                                         100         None
      192.0.2.1                                          None        10
      64501                                                          -
-------------------------------------------------------------------------------
Routes : 1
===============================================================================

The labeled-unicast route 4.4.4.4/32 also has next hop 192.0.2.1, as follows:

*A:PE-2# show router bgp routes 4.4.4.4/32 label-ipv4 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete
===============================================================================
BGP Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  4.4.4.4/32                                         100         None
      192.0.2.1                                          None        10
      No As-Path                                                     524283
-------------------------------------------------------------------------------
Routes : 1
===============================================================================

On PE-1, the next-hop-self configuration for neighbor PE-2 is removed as follows:

# on PE-1:
configure 
    router 
        bgp 
            group "iBGP" 
                neighbor 192.0.2.2 
                    no next-hop-self
                exit
            exit

An export policy is configured to ensure that next-hop-self is only applied for address family ipv4. The route policy is configured as follows:

# on PE-1:
configure
    router
        policy-options
            begin
            policy-statement "export-nhs"
                entry 10
                    from
                        protocol bgp
                    exit
                    action accept
                        next-hop-self
                    exit
                exit
                entry 20
                    from
                        protocol bgp-label
                    exit
                    action accept
                    exit
                exit
            exit
            commit

The export policy "export-nhs" is configured for neighbor PE-2, as follows:

# on PE-1:
configure
    router
        bgp
            group "iBGP"
                neighbor 192.0.2.2
                    export "export-nhs"
                exit

Applying next-hop-self to unlabeled IP-4 routes to neighbor PE-2 shows that next-hop-self is applied to unlabeled IPv4 routes only.

Figure 7. Applying next-hop-self to unlabeled IP-4 routes to neighbor PE-2

With this export policy, only the unlabeled route 3.3.3.3/32 will have next hop 192.0.2.1, while the BGP labeled-unicast (BGP-LU) route 4.4.4.4/32 will have next hop 192.0.2.4, as follows:

*A:PE-2# show router bgp routes 3.3.3.3/32 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP IPv4 Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  3.3.3.3/32                                         100         None
      192.0.2.1                                          None        10
      64501                                                          -
-------------------------------------------------------------------------------
Routes : 1
===============================================================================
*A:PE-2# show router bgp routes 4.4.4.4/32 label-ipv4 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete
===============================================================================
BGP Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  4.4.4.4/32                                         100         None
      192.0.2.4                                          None        20
      No As-Path                                                     524284
-------------------------------------------------------------------------------
Routes : 1
===============================================================================

The export policy "export-nhs" toward neighbor PE-2 is removed as follows:

# on PE-1:
configure 
    router 
        bgp 
            group "iBGP" 
                neighbor 192.0.2.2 
                    no export
                exit

Export policy to advertise route as labeled/unlabeled

PE-1 advertises prefixes 1.1.1.1/32 and 11.11.11.11/32 shows that two loopback addresses are configured in PE-1 to be advertised: prefix 1.1.1.1/32 and 11.11.11.11/32. Initially, there is no route policy applied for a selective export as labeled or unlabeled route.

Figure 8. PE-1 advertises prefixes 1.1.1.1/32 and 11.11.11.11/32

By default, these prefixes will be advertised as both labeled and unlabeled routes toward dual-family neighbor PE-2. On PE-2, the unlabeled IPv4 RIB contains prefixes 1.1.1.1/32 and 11.11.11.11/32, as follows:

*A:PE-2# show router bgp routes 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP IPv4 Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  1.1.1.1/32                                         100         None
      192.0.2.1                                          None        10
      No As-Path                                                     -
---snip---
u*>i  11.11.11.11/32                                     100         None
      192.0.2.1                                          None        10
      No As-Path                                                     -
---snip---

The labeled-IPv4 RIB on PE-2 also contains prefixes 1.1.1.1/32 and 11.11.11.11/32, as follows:

*A:PE-2# show router bgp routes label-ipv4 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     Label
      As-Path                                                        
-------------------------------------------------------------------------------
*>i   1.1.1.1/32                                         100         None
      192.0.2.1                                          None        10
      No As-Path                                                     524285
---snip---
*>i   11.11.11.11/32                                     100         None
      192.0.2.1                                          None        10
      No As-Path                                                     524285
---snip---  

In many cases, it is not required to advertise both a labeled route and an unlabeled route. The following policy is configured to advertise prefix 1.1.1.1/32 as a labeled-IPv4 route and prefix 11.11.11.11/32 as an unlabeled IPv4 route:

# on PE-1:
configure
    router
        policy-options
            begin
            prefix-list "1.1.1.1/32"
                prefix 1.1.1.1/32 exact
            exit
            prefix-list "11.11.11.11/32"
                prefix 11.11.11.11/32 exact
            exit
            policy-statement "export-bgp1"
                entry 10
                    from
                        prefix-list "1.1.1.1/32"
                    exit
                    to
                        protocol bgp-label
                    exit
                    action accept
                    exit
                exit
                entry 20
                    from
                        prefix-list "11.11.11.11/32"
                    exit
                    to
                        protocol bgp
                    exit
                    action accept
                    exit
                exit
                default-action drop
                exit
            exit
            commit

This policy is applied on PE-1 as an export policy for neighbor PE-2, as follows:

# on PE-1:
configure 
    router 
        bgp 
            group "iBGP" 
                neighbor 192.0.2.2 
                    export "export-bgp1"
                exit

Prefix 11.11.11.11/32 is received as an unlabeled route on PE-2 and stored in the unlabeled RIB, but prefix 1.1.1.1/32 is not, as follows:

*A:PE-2# show router bgp routes 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP IPv4 Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  11.11.11.11/32                                     100         None
      192.0.2.1                                          None        10
      No As-Path                                                     -
-------------------------------------------------------------------------------
Routes : 1

On PE-2, prefix 1.1.1.1/32 is received as a labeled route and stored in the labeled-IPv4 RIB, but prefix 11.11.11.11/32 is not, as follows:

*A:PE-2# show router bgp routes label-ipv4 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  1.1.1.1/32                                         100         None
      192.0.2.1                                          None        10
      No As-Path                                                     524285
-------------------------------------------------------------------------------
Routes : 1

This selective route advertisement from PE-1 reduces the memory usage for the RIBs on PE-2.

RR behavior with a mix of labeled and unlabeled BGP sessions

RR with labeled and unlabeled BGP sessions shows a slightly different setup, with all PEs in the AS 64500 and RR-1 acting as the RR for all PEs. There are no dual-family connections. PE-3 and PE-4 have an unlabeled BGP session with RR-1 and PE-2 has a labeled BGP connection with RR-1. RR-1 has add-path=2 capability configured for neighbor PE-2. RR-1 receives the same prefix 7.7.7.7/32 from two neighbors: PE-3 and PE-4.

Figure 9. RR with labeled and unlabeled BGP sessions

On RR-1, BGP is configured as follows:

# on RR-1:
configure
    router
        bgp
            split-horizon
            group "iBGP"
                cluster 192.0.2.1
                export "export-bgp" 
                peer-as 64500
                neighbor 192.0.2.2
                    family label-ipv4
                    add-paths
                        label-ipv4 send 2 receive
                    exit
                exit
                neighbor 192.0.2.3
                    family ipv4
                exit
                neighbor 192.0.2.4
                    family ipv4
                exit
            exit
            no shutdown
        exit

RR-1 receives the prefix 7.7.7.7/32 from neighbors PE-3 and PE-4, as follows:

*A:RR-1# show router bgp routes 7.7.7.7/32 
===============================================================================
 BGP Router ID:192.0.2.1        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP IPv4 Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  7.7.7.7/32                                         100         None
      192.0.2.3                                          None        10
      No As-Path                                                     -
*i    7.7.7.7/32                                         100         None
      192.0.2.4                                          None        10
      No As-Path                                                     -
-------------------------------------------------------------------------------
Routes : 2

Both routes are unlabeled and BGP updates from unlabeled sessions are by default not exported to a labeled-IPv4 session, as shown in Updates from unlabeled sessions not propagated to labeled sessions (default).

Figure 10. Updates from unlabeled sessions not propagated to labeled sessions (default)

PE-2 will not receive prefix 7.7.7.7/32, neither as unlabeled route, nor as labeled route, as follows:

*A:PE-2# show router bgp routes 7.7.7.7/32 ipv4 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP IPv4 Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
No Matching Entries Found
===============================================================================
*A:PE-2# show router bgp routes 7.7.7.7/32 label-ipv4 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
No Matching Entries Found
===============================================================================

A route policy is created on RR-1 to accept both labeled and unlabeled routes, as follows:

# on RR-1:
configure
    router
        policy-options
            begin
            policy-statement "import-all"
                entry 10
                    from
                        protocol bgp
                    exit
                    action accept
                    exit
                exit
                entry 20
                    from
                        protocol bgp-label
                    exit
                    action accept
                    exit
                exit
            exit
            commit

This policy accepts all routes, labeled and unlabeled. For route 7.7.7.7/32 to be advertised to the labeled peer PE-2, it is sufficient to have a policy with only entry 10 that says from protocol bgp action accept. However, the preceding policy can also be used to import labeled routes to be advertised to unlabeled peers.

The following policy is applied as route-table-import policy in BGP RIB management, both for unlabeled IPv4 routes and labeled-IPv4 routes on RR-1:

# on RR-1:
configure
    router
        bgp
            rib-management
                ipv4
                    route-table-import "import-all"
                exit
                label-ipv4
                    route-table-import "import-all"
                exit
            exit

For allowing unlabeled route 7.7.7.7/32 to be advertised on a labeled session, it is sufficient to have a route-table-import for labeled-IPv4 only. However, the configuration allows for RIB leaking in both ways: from unlabeled IPv4 BGP RIB to labeled-IPv4 BGP RIB and vice versa.

RIB leaking from IPv4 BGP RIB to labeled-IPv4 BGP RIB shows this RIB leaking process.

Figure 11. RIB leaking from IPv4 BGP RIB to labeled-IPv4 BGP RIB

After applying this RIB leaking, RR-1 will advertise prefix 7.7.7.7/32 to PE-2. Therefore, RR-1 needs to add a label to the route and RR-1 needs to set next-hop-self. RR-1 advertises only one labeled route for prefix 7.7.7.7/32, with next hop 192.0.2.1, as follows:

*A:RR-1# show router bgp neighbor 192.0.2.2 label-ipv4 advertised-routes 
===============================================================================
 BGP Router ID:192.0.2.1        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
i     7.7.7.7/32                                         100         None
      192.0.2.1                                          None        n/a
      No As-Path                                                     524282
---snip---

The BGP update message is as follows:

4 2020/10/14 13:41:23.925 UTC MINOR: DEBUG #2001 Base Peer 1: 192.0.2.2
"Peer 1: 192.0.2.2: UPDATE
Peer 1: 192.0.2.2 - Send BGP UPDATE:
    Withdrawn Length = 0
    Total Path Attr Length = 49
    Flag: 0x90 Type: 14 Len: 17 Multiprotocol Reachable NLRI:
        Address Family LBL-IPV4
        NextHop len 4 NextHop 192.0.2.1
        7.7.7.7/32 Label 524282
    Flag: 0x40 Type: 1 Len: 1 Origin: 0
    Flag: 0x40 Type: 2 Len: 0 AS Path:
    Flag: 0x40 Type: 5 Len: 4 Local Preference: 100
    Flag: 0x80 Type: 9 Len: 4 Originator ID: 192.0.2.3
    Flag: 0x80 Type: 10 Len: 4 Cluster ID:
        192.0.2.1
"

On PE-2, the following labeled BGP route is imported:

*A:PE-2# show router bgp routes 7.7.7.7/32 label-ipv4 
===============================================================================
 BGP Router ID:192.0.2.2        AS:64500       Local AS:64500      
===============================================================================
 Legend -
 Status codes  : u - used, s - suppressed, h - history, d - decayed, * - valid
                 l - leaked, x - stale, > - best, b - backup, p - purge
 Origin codes  : i - IGP, e - EGP, ? - incomplete

===============================================================================
BGP Routes
===============================================================================
Flag  Network                                            LocalPref   MED
      Nexthop (Router)                                   Path-Id     IGP Cost
      As-Path                                                        Label
-------------------------------------------------------------------------------
u*>i  7.7.7.7/32                                         100         None
      192.0.2.1                                          None        10
      No As-Path                                                     524282
-------------------------------------------------------------------------------
Routes : 1

Conclusion

The BGP RIB architecture with separate RIBs for unlabeled and labeled-unicast routes supports unlabeled sessions and labeled sessions in parallel. By default, labeled routes are not advertised to unlabeled sessions and vice versa. Route-table import policies for RIB management allow route leaking between separate RIBs: unlabeled BGP RIB and labeled-unicast BGP RIB.