Technical Tip: Understanding and configuring BGP security feature 'set enforce-first-as'.
| Description | This article describes FortiGate's BGP configuration 'set enforce-first-as' is a security feature that helps prevent BGP route leaks and AS_PATH spoofing. |
| Scope | FortiGate. |
| Solution | When 'set enforce-first-as' is enabled, FortiGate checks incoming BGP UPDATE messages from eBGP peers. The leftmost (first) AS number in the AS_PATH attribute must match the configured remote-as of the sending peer.
If it matches: The update is processed normally.
This prevents scenarios where malicious or misconfigured peers inject routes with spoofed AS paths. Default behavior: Enabled in FortiOS v6.2+.
Configuration:
config router bgp
Disable (For route server or special cases):
config router bgp
After changing, clear the affected BGP sessions:
execute router clear bgp all
Or for a specific neighbor:
execute router clear bgp ip <neighbor-ip>
Verification and debugging:
get router info bgp summary
Debug: Violation Occurs (enforce-first-as enabled):
BGP: 10.68.15.2-Outgoing [DECODE] Update: Starting UPDATE decoding... |

