Technical Tip: Control BGP route advertisement using distribution-list
| Description | This article describes how to control outbound route advertisement using BGP distribution-list. |
| Scope | FortiGate. |
| Solution | The distribution-list allows control on route advertisement based on the prefixes or subnet mask defined in the access-list.
In the following example, FortiGate-A has 3 loopback networks, 1.1.1.1/32, 2.2.2.2/32, and 3.3.3.3/32. The distribution-list is applied on FortiGate-A so that it only advertises network 2.2.2.2/32 and 3.3.3.3/32 to FortiGate-B.
Configuration on FortiGate-A:
config router access-list edit "block001" config rule edit 1 set action deny next set prefix any next end next end
config router bgp config neighbor edit "10.10.10.2" set distribute-list-out "block001" next end end
Without a distribution-list, FortiGate-A advertises network 1.1.1.1/32 to FortiGate-B:
FortiGate-A # get router info bgp neighbors 10.10.10.2 advertised-routes Network Next Hop Metric LocPrf Weight RouteTag Path
FortiGate-B # # get router info bgp neighbors 10.10.10.1 received-routes Network Next Hop Metric LocPrf Weight RouteTag Path
With the distribution-list, FortiGate-A only advertises network 2.2.2.2/32 and 3.3.3.3/32. The network 1.1.1.1/32 is filtered out.
FortiGate-A # get router info bgp neighbors 10.10.10.2 advertised-routes Network Next Hop Metric LocPrf Weight RouteTag Path
FortiGate-B # get router info bgp neighbors 10.10.10.1 received-routes Network Next Hop Metric LocPrf Weight RouteTag Path
BGP debug on FortiGate-A shows that network 1.1.1.1/32 is filtered.
id=20300 msg="BGP: %BGP-5-ADJCHANGE: VRF 0 neighbor 10.10.10.2 Up " |

