Technical Tip: FortiGate BGP configuration to announce only a default static route (prefix list and route map)
Description
This article describes the available methods for advertising a default route using BGP.
Scope
FortiGate, BGP.
Solution
Solution 1.
This solution applies if the only static route present in the FortiGate routing table is the default route. Otherwise, it will advertise ALL static routes.
In this situation, configure BGP to redistribute all static routes without restriction :
config router bgp
config redistribute static
set status enable
end
end
Solution 2.
This solution applies when there are various static routes in the FortiGate routing table, but only the default route must be announced. In this scenario, a route-map can be used to filter out all routes (other than the default route) pulled in via static route redistribution:
- Create a prefix list to ONLY match the default route on FortiGate.
config router prefix-list
edit 'only_default'
config rule
edit 1
set prefix 0.0.0.0 0.0.0.0
unset ge
unset le
next
end
next
end - Configure a route map linked to the prefix list:
config router route-map
edit "routemap1"
config rule
edit 1
set match-ip-address "only_default"
next
end
next
end - Configure BGP to redistribute static routes using the route map:
config router bgp
config redistribute "static"
set status enable
set route-map "routemap1"
end
end
Once this is configured, run the command get router info bgp network to confirm that a default route is now being injected into the BGP RIB.
Solution 3.
Instead of performing static route redistribution, it is possible to announce default routes on a per-BGP neighbor basis by enabling capability-default-originate:
config router bgp
config[ neighbor | neighbor-group ]
edit <neighbor name>
set capability-default-originate enable
end
Then check that a default route is being advertised to the specified peer/set of peers using the command get router info bgp neighbors <neighbor address> advertised-routes.
Related Articles:
