BGP AS Number Conversion

An Autonomous System Number (ASN) uniquely identifies a network or group of IP prefixes under a single administrative control that uses BGP to exchange routing information with other networks.

Each ASN is used to tag routes in BGP so that routers can make loop-prevention and policy decisions.

When two networks peer, they exchange routes with their ASN attached.

Originally, ASNs were 16-bit values:

  • Range: 1 – 65,535
  • Example: AS64512

Later, to handle growth, the IETF expanded ASNs to 32-bit values:

  • Range: 1 – 4,294,967,295
  • Example: AS65538

ASN Conversion Cheat Sheet (Asplain ↔ Asdot)

So let’s start with ASDot -> ASplain:

64700.1 (ASDot -> Asplain)
(64700 x 65536) + 1 = 4240179201

We have 65536 because that is the maximum number of values.

Next let’s look at ASplain -> ASDot:

4240179201 (Asplain -> ASDot)
4240179201 ÷ 65536 = 64700
4240179201 mod 65536 = 1
= 64700.1

Leave a comment