Skip to main content
KenjiKang
Explorer III
September 17, 2025
Question

Routing Selection Rule with Mixed Dynamic and Static Routing

  • September 17, 2025
  • 1 reply
  • 569 views

Hi teams,

I am currently considering adding a non-preferred route for return traffic to make it follow an atypical path. Could you please explain the criteria for selecting routing preference when dynamic and static routing are mixed?

My understanding is as follows, but please correct me if I'm wrong:

  1. Longest match

  2. Distance Value
  3. Priority Value

Specifically, I am considering updating the routing table as follows:

I am concerned about whether the BGP metric value might affect the route selection when BGP and static routes are mixed.

# get router info routing-table all

B* 0.0.0.0/0 [20/100000] via XX , [1/0]

S  0.0.0.0/0 [20/0] via XX,port1 [100/0]

S  0.0.0.0/0 [20/0] via XX,port3 [100/0]


Thank you
Kenji

1 reply

Toshi_Esumi
SuperUser
SuperUser
September 17, 2025

First two are correct as Google AI says the same.
The Priority is only for static routes. You can't set any priorities any other types of routes and always 1 for those. 

BGP, or any other routing protocol decides its own best routes (unless ECMP is enabled) before sending them to RIB. So RIB wouldn't see all BGP routes to make the final routing decision. Only the best BGP routes would be considered as candidates in RIB.

For the routing-table's "metric", if you're using MED in BGP it would show up as metric. If it needs to be parallel with other types of routes (static default route in your example), you can't use MED in BGP. You need to use something else to select the best BGP routes.

Toshi  

KenjiKang
KenjiKangAuthor
Explorer III
September 17, 2025

Hi Toshi-san

Thank you for your kind advice.
I now understand that I can tune the routing using static routes. I'll test a mixed BGP and static environment in our test environment at a later date.


I also have a hypothesis that routes from different protocols can be reflected in the RIB even if their distance values are different.
In that case, for example, if I don't want the existing BGP default route to interfere, I could set the distance value to 21 or higher. I plan to test this as well.

 

# get router info routing-table all

B* 0.0.0.0/0 [20/100000] via XX , [1/0]

S  0.0.0.0/0 [100/0] via XX,port1 [100/0]

S  0.0.0.0/0 [100/0] via XX,port3 [100/0]


Thank you
Kenji
pri.jpg

Toshi_Esumi
SuperUser
SuperUser
September 17, 2025

If the admin distance is higher and the same route from another protocol exist with a lower distance, it shouldn't show up in RIB. Not sure about those static route with AD=100. Maybe static routes are special? I don't know.

Toshi