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:
Longest match
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
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
Created on ‎09-17-2025 02:00 PM Edited on ‎09-17-2025 02:00 PM
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
Created on ‎09-17-2025 02:11 PM Edited on ‎09-17-2025 02:12 PM
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
User | Count |
---|---|
2588 | |
1380 | |
796 | |
658 | |
455 |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.