NSX route selection between a static route redistributed into BGP and the same prefix advertised by BGP
search cancel

NSX route selection between a static route redistributed into BGP and the same prefix advertised by BGP

book

Article ID: 390404

calendar_today

Updated On:

Products

VMware NSX

Issue/Introduction

This article explains the behaviour with respect to route selection in NSX when a given prefix is learnt from a BGP peer and the same prefix is configured as static route (higher admin distance) and redistributed into BGP.
The outcome of route selection is determined by the sequence of events. 

Route Selection

Scenario 1: BGP route is received first

Step 1: BGP receives the route advertisement from peer 10.254.80.254.
Step 2: BGP adds this route in RIB.
Step 3: Static route is added with admin distance 250 and redistributed into BGP.
Step 4: Best path selection takes place in RIB.

Best path selection in RIB is based on administrative distance. Route with lesser admin distance is preferred.

                      

 
 

 

Since administrative distance of static route in this scenario is more than BGP, BGP route is selected and installed in datapath.

 

BGP learnt route is installed
Edge(tier0_vrf_sr[7])> get route | find 192.168.0.1/32
b  > * 192.168.0.1/32 [20/0] via 10.254.80.254, uplink-339, 00:12:03
BGP route learnt from neighbor
Edge(tier0_vrf_sr[7])> get bgp | find 192.168.0.1/32
> 192.168.0.1/32                        10.254.80.254                         0            100     0        420 ?

 

Scenario 2: Static route is configured first

Step 1: Static route is added with admin distance 250 and redistributed into BGP.
Step 2: This route is added into BGP table.
Step 3: BGP receives the route advertisement from  peer 10.254.80.254.
Step 4: Best path selection takes place in BGP.

Best path selection in BGP is based on BGP path selection algorithm. 

                     

 
 

Best route selection is handled by BGP. BGP does not consider AD as one of the parameters during route selection. However BGP considers WEIGHT. Since WEIGHT of redistributed route is 32768 which is more than received route, the static route is preferred in BGP. No route add is sent from BGP to RIB. Static route is installed in datapath

Static route is installed
Edge(tier0_vrf_sr[7])> get route | find 192.168.0.1/32
t0s> * 192.168.0.1/32 [250/0] via 10.254.80.254, uplink-339, 00:17:31

 

 

Static route preferred in BGP
Edge(tier0_vrf_sr[7])> get bgp | find 192.168.0.1/32 
   192.168.0.1/32                        10.254.80.254                         0            100     0        420 ?  
 > 192.168.0.1/32                        10.254.80.254                         0            100     32768    ?

Environment

VMware NSX-T 3.x
VMware NSX 4.x

Cause

The product is working as designed and inline with industry standards.

Resolution

An inbound route-map can be used to set a higher weight to the routes received by BGP peer than the static route, i.e. more than 32678(default value) or any value set explicitly for the static route.
BGP RIB will have both routes, but now BGPd will select the BGP route because of higher weight, then will send BGP route to RIB.

RIB then has static route(with explicitly configured higher admin distance) and BGP. So, RIB now selects BGP route over static route because of lower admin distance value. It programs FIB with BGP route as the best path.

  1. Create a prefix-list with interested IP address. In this example it will be 192.168.0.1/32
  2. Create a route-map for the previously created prefix-list. Create a match criteria where we set weight to 40000 (more than default value)
  3. Attach the route-map to the BGP neighbor

Additional Information