Description

This article illustrates the change in behavior of Label Distribution Protocol (LDP) Egress Policy for routes that are received from BGP Labeled Unicast (LU).

Beginning with Junos 16.1, LDP Egress Policy does not work if the route is learned from BGP Labeled Unicast.

 

Symptoms

Consider the following topology:

alt

                                                                                            
4.4.4.4 is an LDP route in R3.
The Policy is being used to redistribute this route in both inet.0 and inet.3 from R3 to R2 via bgp

lab@R3# run show route 4.4.4.4/32
 
inet.0: 15 destinations, 15 routes (15 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

4.4.4.4/32         *[OSPF/10] 00:49:31, metric 1
                    > to 100.0.34.4 via ge-0/0/3.10

inet.3: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

4.4.4.4/32         *[LDP/9] 00:49:28, metric 1
                    > to 100.0.34.4 via ge-0/0/3.10

lab@R3# run show ldp database
 
Input label database, 3.3.3.3:0--4.4.4.4:0
Labels received: 2
  Label     Prefix
299776      3.3.3.3/32
      3      4.4.4.4/32

Output label database, 3.3.3.3:0--4.4.4.4:0
Labels advertised: 2
  Label     Prefix
      3      3.3.3.3/32
299776      4.4.4.4/32

lab@R3# run show route advertising-protocol bgp 2.2.2.2
 
inet.0: 15 destinations, 15 routes (15 active, 0 holddown, 0 hidden)
  Prefix                    Nexthop                   MED     Lclpref    AS path
* 4.4.4.4/32              Self                 1                  I

inet.3: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
  Prefix                    Nexthop                   MED     Lclpref    AS path
* 4.4.4.4/32              Self                 1                  I


R2 receives 4.4.4.4 in inet.0 and inet.3. However, the route is not installed in LDP database.

lab@R2# run show route receive-protocol bgp 3.3.3.3
 
inet.0: 16 destinations, 16 routes (16 active, 0 holddown, 0 hidden)
  Prefix                    Nexthop                   MED     Lclpref    AS path
* 4.4.4.4/32              3.3.3.3              1                  65002 I

inet.3: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
  Prefix                    Nexthop                   MED     Lclpref    AS path
* 4.4.4.4/32              3.3.3.3              1                  65002 I

mpls.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)

inet6.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)


lab@R2# run show ldp database
 
Input label database, 2.2.2.2:0--1.1.1.1:0
Labels received: 2
  Label     Prefix
      3      1.1.1.1/32
299808      2.2.2.2/32

Output label database, 2.2.2.2:0--1.1.1.1:0
Labels advertised: 2
  Label     Prefix
299808      1.1.1.1/32
      3      2.2.2.2/32
      3      10.102.176.0/20
      3      100.0.12.0/24
      3      100.0.23.0/24


R2 LDP configuration in set format:
 
set protocols ldp egress-policy test
set protocols ldp interface ge-0/0/1.0
set protocols ldp interface fxp0.0 disable
set protocols ldp interface lo0.0

set policy-options policy-statement test term 10 from protocol bgp
set policy-options policy-statement test term 10 from rib inet.3
set policy-options policy-statement test term 10 then accept
set policy-options policy-statement test term 20 from interface lo0.0
set policy-options policy-statement test term 20 then accept


Observing the R1 outputs, it is seen that 4.4.4.4 is not present in the inet.3 routing table

lab@R1# run show route protocol LDP
 
inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

224.0.0.2/32       *[LDP/9] 01:23:12, metric 1
                      MultiRecv

inet.3: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)   <<<<<<<<< no 4.4.4.4 route is seen.
+ = Active Route, - = Last Active, * = Both

2.2.2.2/32         *[LDP/9] 01:14:58, metric 1
                    > to 100.0.12.2 via ge-0/0/1.0

mpls.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

299808             *[LDP/9] 01:14:58, metric 1
                    > to 100.0.12.2 via ge-0/0/1.0, Pop      
299808(S=0)        *[LDP/9] 01:14:58, metric 1
                    > to 100.0.12.2 via ge-0/0/1.0, Pop 

Solution

Beginning with Junos 16.1, LDP Egress Policy will not consider BGP LU routes in inet.3 for policy processing. As a result, LU routes will not be advertised despite a matching condition in a policy. To resolve this issue, the inet.3 route in R2 should be copied to inet.0. Then the egress-policy is to be applied to redistribute this BGP LU route to R1 as follows:


Create RIB group to Import Routes from inet.3 to inet.0:
 
set routing-options rib-groups inet3-to-inet0 import-rib inet.3
set routing-options rib-groups inet3-to-inet0 import-rib inet.0
set routing-options rib-groups inet3-to-inet0 import-policy TEST
set policy-options policy-statement TEST term 1 from route-filter 4.4.4.4/32 exact
set policy-options policy-statement TEST term 1 then accept

Apply rib group to bgp routes:
 
set protocols bgp group ebgp family inet labeled-unicast rib-group inet3-to-inet0

Create policy matching BGP LU routes in inet.0
 
set policy-options policy-statement BGP-LDP term 1 from protocol bgp
set policy-options policy-statement BGP-LDP term 1 from rib inet.0
set policy-options policy-statement BGP-LDP term 1 then accept
set policy-options policy-statement BGP-LDP term 2 from interface lo0.0
set policy-options policy-statement BGP-LDP term 2 the accept

Apply as egress policy under LDP
 
set protocols ldp egress-policy BGP-LDP

lab@R1> show route table inet.3   
  
inet.3: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

2.2.2.2/32         *[LDP/9] 00:04:57, metric 1
                    > to 100.0.12.2 via ge-0/0/1.0
4.4.4.4/32         *[LDP/9] 00:00:27, metric 1
                    > to 100.0.12.2 via ge-0/0/1.0​