# BASIC UNDERSTANDING OF 4-BYTE ASN

Rashmi Bhardwaj | Blog,BUZZ

2 Byte AS number provides us with 65,536 possible numbers (AS numbers 0 – 65535).

Out of these –

• Private AS Numbers = 64512 through 65535 &
• Public AS Numbers   = 1 through 64511.

Due to the fast depletion of the 2 byte AS number, 4 byte AS numbers have been introduced.

4 byte AS number will provide a total of 232 or 4,294,967,296 autonomous system numbers ranging from 0 to 4294967295

A thing to notice here is that from 0 – 65535 AS numbers are same as were with 2 byte AS. These AS numbers help in interoperability between AS using 2 byte ASNs and AS using 4 byte ASNs.

A 4-byte ASN between 0 and 65535 is called a mappable ASN, because it can be represented in just 2 bytes; the first 16 bits are in every case all zeroes.

4 Byte AS representation can be done in 3 ways as listed below:

1. asplain – simple decimal representation of the ASN. For example, ASN 7747 will be represented as 7747, while 123456 will be represented as 123456.
2. asdot+ – breaks the number up in two 16-bit values as low-order and high-order, separated by a dot. All the 2-byte ASNs can be represented in the low-order value. For example, ASN 65535 will be 0.65535, 65536 will be 1.0, 65537 will be 1.1 and so on. The last ASN 4294967296 will be 65535.65535.
3. asdot – it is a mixture of asplain and asdot+. Any ASN in the 2-byte range is represented as asplain and any ASN above the 2-byte range is represented as asdot+. For example, 65535 will be 65535 while 65536 will be 1.0. Cisco uses this form of implementation.

There are 5 RIRs (AfriNIC, APNIC, ARIN, LACNIC, and RIPE NCC) which are allocating ASs now. All the ASNs allocated now are 4 byte AS by default.

It is significant to understand the interoperability of the 2 Byte AS number with the 4 Byte AS number.

4 byte AS support is advertised via BGP capability negotiation. Speakers who support 4-byte AS are known as New-BGP speakers & those who do not are known as Old-BGP speakers.

For a New-BGP implementation we must consider whether a neighbor is New-BGP or Old-BGP. It does this by using the BGP Capability Advertisement when opening a BGP session. In addition to advertising itself as New-BGP, it includes its 4-byte ASN in the Capability advertisement.

If a neighbor is Old-BGP, it either responds that it does not support the 4-byte ASN capability or does not respond to the Capability advertisement at all. In this case, the New-BGP neighbor can still bring up a session with the Old-BGP neighbor. The New-BGP neighbor will not advertise its 4 byte ASN instead would advertise a reserved 2 byte ASN called AS_TRANS. Because AS_TRANS is reserved, no Old-BGP speaker can use it as its own ASN; only New-BGP speakers can use it.

Interoperable peering, then, is achieved because the New-BGP speaker “knows” its neighbor is an Old-BGP speaker and adapts to it; the Old-BGP speaker simply continues using legacy BGP rules.

### PATH ATTRIBUTE INTEROPERABILITY:

A New BGP Speaker advertises the routes to its New BGP neighbors with AS_PATH carrying 4-byte ASN, as compared to an AS_PATH carrying 2-byte ASN when advertising to an Old BGP neighbor during which it adds the AS_TRANS ASN instead of adding its own 4-byte ASN.

A new AS4_PATH attribute also comes into picture if AS path contains any 4 byte AS. The AS4_PATH attribute is an optional transitive attribute which carries the real AS_PATH list, carrying both 4-byte and 2-byte ASN.

When an Old BGP Speaker advertises routes with AS4_PATH and AS_PATH attributes to a New BGP Speaker, the New BGP Speaker uses both attributes to reconstruct the path: AS4_PATH for 4-byte ASNs and AS_PATH for 2-byte ASNs. The New BGP Speaker constructs the AS_PATH attribute by replacing 4-byte ASN with an AS_TRANS. In this way, the AS_PATH shows the correct number of hops.

A new attribute AS4_AGGREGATOR is introduced for similar reasons. If the New BGP Speaker has to send the AGGREGATOR attribute and if the aggregating ASN is a 4-byte ASN, then the speaker constructs the AS4_AGGREGATOR attributes by copying the attribute length and attribute value from the AGGREGATOR attribute, places the attribute length and attribute value in the AS4_AGGREGATOR attribute, and replaces the 4-byte ASN with AS_TRANS ASN. Again, if the aggregating ASN is 2-byte, then AS4_AGGREGATOR is not sent.