Configuring BGP
Starting in FortiSwitchOS 7.2.2, the set ebgp-requires-policy command (under config router bgp ) is set to enable by default, which prevents the BGP router from learning or advertising prefixes from or to its eBGP peers. |
Configuring BGP on the FortiSwitch unit includes the following major steps:
- Enter the BGP configuration mode.
- Set the autonomous system and router identifier.
- Configure the BGP neighbors.
- Redistribute non-BGP routes.
Advertise these non-BGP routes within BGP.
Enter the BGP configuration mode
Enter the BGP configuration mode to access all of the BGP configuration commands:
# config router bgp
Set the autonomous system and router identifier
Set the autonomous system. For iBGP, the AS value needs to match the remote-as
value in the neighbor router. For eBGP, the AS value differs from the remote-as
value in the neighbor router. You also need to specify a fixed router identifier for the FortiSwitch unit. These two commands are mandatory.
# set as <AS number>
# set router-id <IP_address>
Configure the BGP neighbors
Configure the BGP neighbors.
NOTE: For iBGP, if the IP address of the BGP neighbor is a loopback address, you must use the set update-source cmd
command to specify which interface address will be used as the source IP address in the outgoing BGP packet.
config neighbor
edit "<IPv4_or_IPv6 address>"
set remote-as <1-4294967295>
end
Redistribute non-BGP routes
Redistribute non-BGP IPv4 or IPv6 routes within BGP:
config redistribute {connected | isis | ospf | rip | static}
set status enable
set route-map <string>
end
config redistribute6 {connected | isis | ospf | rip | static}
set status {disable | enable}
set route-map <string>
end
Other BGP commands
Clearing the BGP routes
Use the following commands to clear the BGP routes:
execute router clear bgp all
execute router clear bgp ip <IPv4_or_IPv6_address>
execute router clear bgp ipv6 <IPv4_or_IPv6_address>
execute router clear bgp as <AS_number>
execute router clear bgp dampening <IP_address>
Checking the BGP configuration
The get router info bgp
and get router info6 bgp
commands have options to display different aspects of the BGP configuration and status.
For example:
get router info bgp neighbors
get router info bgp network
get router info6 bgp filter-list
get router info6 bgp route-map
Changing the maximum number of paths for ECMP
If you are using equal-cost multi-path (ECMP) routing with the eBGP or iBGP, the maximum number of paths is 1 by default. Use the following commands to change the default:
config router bgp
set maximum-paths-ebgp <1-64>
set maximum-paths-ibgp <1-64>
end