Hello Thomas
Take a look at the BGP OPEN message format as indicated in RFC 4271:
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 (or 2 bytes) 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, 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.
The ASN appears only in the OPEN message. Once established, ASNs are no longer exchanged between BGP routers other than as part of the AS_PATH values.
I hope this has been helpful!
Laz