BGP 4-Byte AS Number

Before January 2009, we only had 2 byte AS numbers in the range of 1-65535. 1024 of those (64512-65534) are reserved for private AS numbers.

Similar to IPv4, we started running out of AS numbers so IANA increased the AS numbers by introducing 4-byte AS numbers in the range of 65536 to 4294967295.

There are three ways to write down these new 4-byte AS numbers:

  • Asplain
  • Asdot
  • Asdot+

Asplain is the most simple to understand, these are just regular decimal numbers. For example, AS number 545435, 4294937295, 4254967294, 2294967295, etc. These numbers are simple to understand but prone to errors. It’s easy to make a configuration mistake or misread a number in the BGP table.

Asdot represents AS numbers less than 65536 using the asplain notation and AS numbers above 65536 with the asdot+ notation.

Asdot+ breaks the AS number in two 16-bit parts, a high-order value, and a low-order value, separated by a dot. All older AS numbers can fit in the second part where the first part is set to 0. For example:

  • AS 6541 becomes 0.6541
  • AS 54233 becomes 0.54233
  • AS 544 becomes 0.544

For AS numbers above 65535, we use the next high order bit value and start counting again at 0. For example:

  • AS 65536 becomes 1.0
  • AS 65537 becomes 1.1
  • AS 65538 becomes 1.2

These numbers are easier to read but harder to calculate than the asplain numbers, it’s also a bit trickier to create regular expressions.

If you want to convert an asplain AS number to an asdot+ AS number, you take the asplain number and see how many times you can divide it by 65536. This is the integer that we use for the high order bit value.

Then, you take the asplain number and deduct (65536 * the integer) to get your low order bit value. In other words, this is the formula:

integer (high order bit value) = asplain / 65536
remainder (low order bit value) = asplain - (integer * 65536)
asdot value = integer.remainder

Here are two examples:

#AS 5434995
5434995 / 65536 = 82
5434995 - (82 * 65536) = 61043
asdot = 82.61043
#AS 1499547
1499547 / 65536 = 22
1499547 - (22 * 65536) = 57755
asdot = 22.57755

Once you understand how the conversion is done, you can use the APNIC asplain to asdot calculator to convert this automatically and make your life a bit easier.

BGP speakers that support 4-byte AS numbers advertise this via BGP capability negotiation and there is backward compatibility. When a “new” router talks to an “old” router (one that only supports 2-byte AS numbers), it can use a reserved AS number (23456) called AS_TRANS instead of its 4-byte AS number. I’ll show you how this works in the configuration.

Configuration

Cisco routers support the asplain and asdot representations. The configuration is pretty straightforward and I’ll show you two scenarios:

  • Two routers that both have 4-byte AS support.
  • Two routers where one router only has 2-byte AS support.

4-byte AS support


We have two routers:

Bgp 4-byte Router

Both routers support 4-byte AS numbers. You can see this when you configure the AS number:

R1(config)#router bgp ?
  <1-4294967295>  Autonomous system number
  <1.0-XX.YY>     Autonomous system number

As you can see, this IOS router supports asplain and asdot numbers. Let’s pick asplain and establish a BGP neighbor adjacency:

R1(config)#router bgp 12000012
R1(config-router)#neighbor 192.168.12.2 remote-as 12000012
R2(config)#router bgp 12000012
R2(config-router)#neighbor 192.168.12.1 remote-as 12000012

You can see the asplain AS numbers in all bgp show commands:

R1#show ip bgp summary 
BGP router identifier 192.168.12.1, local AS number 12000012
BGP table version is 1, main routing table version 1

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.12.2    4     12000012       5       5        1    0    0 00:01:02        0

If you want, you can change the representation to the asdot format:

R1(config-router)#bgp asnotation ?   
  dot  asdot notation

Let’s change it:

R1(config-router)#bgp asnotation dot

You will now see the asdot format in all show commands:

R1#show ip bgp summary
BGP router identifier 192.168.12.1, local AS number 183.6924
BGP table version is 1, main routing table version 1

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.12.2    4     183.6924       6       6        1    0    0 00:02:38        0

AS 12000012 now shows up as AS 183.6924.

Configurations

Want to take a look for yourself? Here you will find the startup configuration of each device.

R1

hostname R1
!
ip cef
!
interface GigabitEthernet0/1
 ip address 192.168.12.1 255.255.255.0
!
router bgp 183.6924
 bgp asnotation dot
 neighbor 192.168.12.2 remote-as 183.6924
!
end

R2

hostname R2
!
ip cef
!
interface GigabitEthernet0/1
 ip address 192.168.12.2 255.255.255.0
!
router bgp 12000012
 neighbor 192.168.12.1 remote-as 12000012
!
end

2-byte AS support


Let’s use two routers. R1 only supports 2-byte AS numbers, R2 supports 4-byte AS numbers:

Bgp 2 Octet 4-byte Router

R1 has no clue what an AS number above 65535 is:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now!

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You’ve Ever Spent on Your Cisco Career!
  • Full Access to our 799 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)
560 Sign Ups in the last 30 days
satisfaction-guaranteed

  • 100% Satisfaction Guaranteed!
  • You may cancel your monthly membership at any time.
  • No Questions Asked!

Tags: ,


Forum Replies

  1. Hi Rene,
    Very Good Stuff.A quick questions for you …
    How R2 know R1 only 2 byte supported before sending any open message ??

    br//zaman

  2. Hi Zaman,

    It doesn’t. When R2 receives a reply from R1 without the “support for 4-octet AS number capability” in its OPEN message, it knows that R1 doesn’t support it.

    You can see it in the wireshark capture:

    https://www.cloudshark.org/captures/d8e5e9240959

    Take a look at the 1st packet from R2 and the 2nd packet from R1. R1 is missing the capability.

    Hope this helps!

    Rene

  3. Hi Rene,
    I have question in 2-Byte & 4-Byte AS compatibility situation.

    In case of we adding R3 (AS3) and connect it to R2. R1 advertises one prefix (for example: 1.1.1.1/32) to R2 and R2 will forward to R3.
    What will be in the AS path on R3? (22222222 1 or 23456 1)?

    Thanks,
    Minh

  4. Hello Minh

    This is an excellent question. Essentially what you are asking (allow me to put it more generally) is how is the AS path displayed when there is a 2-byte AS compatible router in the mix?

    Well, if you display the AS path on the 2-byte AS compatible router, then you will see the 23456 AS in place of the incompatible 4-byte AS number. So essentially the AS_TRANS attribute replaces the 4-byte AS number. However, the AS4 PATH number is an attribute that is received by the 2-byte AS compatible device, and is transitive. It may not understand it, but it

    ... Continue reading in our forum

  5. Thanks Laz for the explanation.

    Enjoy your weekend,
    Minh

29 more replies! Ask a question or join the discussion by visiting our Community Forum