| Description | This article describes the workaround for the issue on FortiGate when seeing 'Incorrect leftmost AS number' in BGP debugs |
| Scope | FortiGate. |
| Solution |
This issue will normally be seen when the BGP peering does not establish.
Enable BGP debugs:
diagnose ip router bgp all enable diagnose ip router bgp level info diagnose debug enable
To disable BGP debugs:
diagnose ip router bgp all disable diagnose ip router bgp level none diagnose debug reset
Note: Starting from v7.2.0+, it is possible to collect BGP debugs for a specific neighbor by using the filter command 'diag ip router bgp set-filter neighbor <neighbor address>'. Follow this KB articlefor more details: Technical Tip: Capture BGP debugs for a specific neighbor
The following would show up in debugs:
BGP: 10.10.10.2-Outgoing [DECODE] Update: Starting UPDATE decoding... Bytes To Read (4005), msg_size (86)
When performing a packet capture on Wireshark, it is possible to see this event: Internet Protocol Version 4, Src: 10.68.15.2, Dst: 10.68.15.10
While the BGP router configuration for the reported neighbor is defined as: config router bgp BGP debug on the FortiGate side shows the error and withdraws the received prefixes: BGP: 10.68.15.2-Outgoing [DECODE] Msg-Hdr: type 2, length 58
Check on the BGP peer to find out why FortiGate is receiving the 'incorrect AS number' error.
When this setting is enabled, BGP does a comparison between the remote AS and several BGP peers configured locally with the first AS in the path of received routes. Disabling this will resolve the issue. |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.