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:
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
- R1
- R2
Want to take a look for yourself? Here you will find the startup configuration of each device.
2-byte AS support
Let’s use two routers. R1 only supports 2-byte AS numbers, R2 supports 4-byte AS numbers:
R1 has no clue what an AS number above 65535 is:
R1(config)#router bgp ?
<1-65535> Autonomous system number
What value do we enter for R2 here? R2 is in AS 22222222 but we can’t configure that number. We need to use the reserved AS number (AS_TRANS) here:
R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.12.2 remote-as 23456
On R2, we configure the actual AS number:
R2(config)#router bgp 22222222
R2(config-router)#neighbor 192.168.12.1 remote-as 1
Here’s a capture of the neighbor adjacency. You can see that R2 adds the 4-byte AS number capability in its OPEN message:
BGP 4-byte AS number capability
Once the neighbor adjacency is established, R2 uses AS 23456 when talking with R1:
R1#show ip bgp summary
BGP router identifier 192.168.12.1, local AS number 1
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 23456 2 2 0 0 0 00:00:11 0
R2#show ip bgp summary
BGP router identifier 192.168.12.2, local AS number 22222222
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.1 4 1 2 2 1 0 0 00:00:25 0
Above, you can see that R1 thinks R2 is in AS 2345
Unit 1: Introduction to BGP
- Introduction to BGP
- Single/Dual (multi) homed connections
- eBGP (external BGP)
- eBGP Multi-Hop
- iBGP (internal BGP)
- How to read the BGP Table
- How to advertise networks in BGP
- iBGP Next Hop Self
- BGP Auto-summary
Unit 2: BGP Neighbor Adjacency
- BGP Neighbor Adjacency States
- BGP Messages
- Troubleshooting BGP Neighbor Adjacency
- Troubleshooting BGP Route Advertisement
Unit 3: BGP Attributes
- BGP Attributes and Path Selection
- BGP Weight Attribute
- BGP Local Preference
- BGP AS Path Prepending
- BGP Origin Code
- BGP MED (metric) Attribute
Unit 4: BGP Communities
Unit 5: BGP Filtering
- BGP Regular Expressions
- BGP Transit AS
- BGP IPv6 route filtering
- BGP AS Path Filter
- BGP Extended Access-List Filtering
Unit 6: Advanced BGP Features
- BGP Peer Groups
- BGP Route Reflector
- BGP Confederations
- BGP Synchronization
- BGP Backdoor Routes
- MP-BGP (multi-protocol BGP)
- BGP Private and Public AS Numbers
- BGP Remove Private AS Numbers
- BGP 4-byte AS numbers
- BGP Soft Reconfiguration
- BGP Route Refresh Capability
- BGP Allow AS in
- BGP AS Override
- BGP Aggregate AS-SET
- BGP Multipath eBGP and iBGP