This article describes how to advertise IP Pool to BGP Peer.
Table of Contents
Network Diagram
Requirement
- FGT_A needs to advertise IP Pool 10.10.10.0/24 to FGT_B using BGP.
- For routes/prefixes to be advertised to BGP peers, those routes should be active on the FortiGate routing table.
Solution
Solution 1: Using Network command.
Step 1: Configure a static route for the IP Pool to Blackhole.
config router static edit 0 set dst 10.10.10.0 255.255.255.0 set blackhole enable next end
Step 2: Add the IP Pool subnet to the BGP network statement.
config router bgp config network edit 1 set prefix 10.10.10.0 255.255.255.0 next end end
Result:
FGT_A # get router info bgp neighbors 192.168.254.82 advertised-routes VRF 0 BGP table version is 4, local router ID is 192.168.254.81 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight RouteTag Path *> 10.10.10.0/24 192.168.254.81 100 32768 0 i <-/-> *> 192.168.100.0 192.168.254.81 32768 0 ? <-/-> *> 192.168.254.0 192.168.254.81 32768 0 ? <-/-> Total number of prefixes 3 FGT_B # get router info bgp neighbors 192.168.254.81 routes VRF 0 BGP table version is 2, local router ID is 192.168.254.82 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight RouteTag Path *> 10.10.10.0/24 192.168.254.81 0 0 0 100 i <-/1> *> 192.168.100.0 192.168.254.81 0 0 0 100 ? <-/1> * 192.168.254.0 192.168.254.81 0 0 0 100 ? <-/-> FGT_B # get router info routing-table all Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default Routing table for VRF=0 S* 0.0.0.0/0 [10/0] via 192.168.254.254, port1 B 10.10.10.0/24 [20/0] via 192.168.254.81 (recursive is directly connected, port1), 00:07:23 B 192.168.100.0/24 [20/0] via 192.168.254.81 (recursive is directly connected, port1), 00:20:51
Solution 2: Using redistribution.
Step 1:Configure a static route for the IP Pool to Blackhole similar to step 1 on Solution 1.
Step 2:Redistribute static routes to BGP.
config router bgp config redistribute "static" set status enable end end
Result:
FGT_A # get router info bgp neighbors 192.168.254.82 advertised-routes VRF 0 BGP table version is 6, local router ID is 192.168.254.81 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight RouteTag Path *> 10.10.10.0/24 192.168.254.81 32768 0 ? <-/-> *> 192.168.100.0 192.168.254.81 32768 0 ? <-/-> *> 192.168.254.0 192.168.254.81 32768 0 ? <-/-> FGT_B # get router info bgp neighbors 192.168.254.81 routes VRF 0 BGP table version is 2, local router ID is 192.168.254.82 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight RouteTag Path *> 10.10.10.0/24 192.168.254.81 0 0 0 100 ? <-/1> *> 192.168.100.0 192.168.254.81 0 0 0 100 ? <-/1> * 192.168.254.0 192.168.254.81 0 0 0 100 ? <-/-> Total number of prefixes 3 FGT_B # get router info routing-table all Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default Routing table for VRF=0 S* 0.0.0.0/0 [10/0] via 192.168.254.254, port1 B 10.10.10.0/24 [20/0] via 192.168.254.81 (recursive is directly connected, port1), 00:10:18 B 192.168.100.0/24 [20/0] via 192.168.254.81 (recursive is directly connected, port1), 00:43:30