BGP 4-byte ASN Backward Compatibility
In order to ensure backward compatibility between BGP routers for 4-byte ASNs, BGP speakers will use what is known as the AS_TRANS value for the ASN.
This value is included in the BGP OPEN message which is used to establish a BGP peering. Take a look at the BGP OPEN message format as indicated in RFC 4271 that defines BGP:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+ | Version | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | My Autonomous System | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Hold Time | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BGP Identifier | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Opt Parm Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | Optional Parameters (variable) | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Note that the “My Autonomous System” or "My AS" field is 16 bits in length, and it is fixed. If the BGP router is using 2-byte ASes, the AS value will simply be found in the “My AS” field. However, if the BGP router is using 4-byte ASNs, the value of the My AS field will always be 23456, which is AS_TRANS, and the value of the 4-byte ASN will be found in the optional parameters where 4-byte ASN number capability is expressed.
This way, if the neighboring BGP router is capable of reading 4-byte ASNs, it will see the AS_TRANS value of 23456 and it will know to look for the 4-byte ASN value in the optional capabilities field. If the neighboring BGP router is incapable of reading 4-byte ASNs, it will simply use the 23456 and ignore the optional parameter.
So you don’t have to establish ASN 4-byte compatibility between BGP neighbors before exchanging OPEN messages. It’s just a matter of interpretation of the information found in the OPEN message itself.
Links
https://networklessons.com/bgp/bgp-4-byte-number/ https://datatracker.ietf.org/doc/html/rfc4271#page-13