PacketLab
BGP · Advanced BGP Features

Private and Public AS Numbers

Choose private, documentation and allocated AS numbers deliberately, and recognize AS-loop rejection.

Why AS identity matters

R1 and R3 intentionally use the same AS in this isolated example. R2 can accept R1’s route, but a normal R3 rejects an advertisement containing its own AS. This is why unrelated publicly routed networks need appropriate unique identities.

Lab topologyPhysical links
.1 / .2.5 / .6R1AS 65001R2AS 65002R3AS 65001
Solid lines are physical links. Endpoint labels are the last octets of 192.0.2.x/30, first router then second router in the address table. Loopback0 is 10.255.0.N/32 on RN. Logical BGP peers are listed in the configurations.
LinkFirst endpointSecond endpoint
R1–R2GigabitEthernet1 192.0.2.1/30GigabitEthernet1 192.0.2.2/30
R2–R3GigabitEthernet2 192.0.2.5/30GigabitEthernet1 192.0.2.6/30
Complete baseline configurations

R1

hostname R1
ip cef
interface Loopback0
 ip address 10.255.0.1 255.255.255.255
exit
interface Loopback10
 ip address 198.51.100.1 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.1 255.255.255.252
 no shutdown
exit
router bgp 65001
 bgp router-id 10.255.0.1
 no bgp default ipv4-unicast
 neighbor 192.0.2.2 remote-as 65002
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.2 activate
  network 198.51.100.1 mask 255.255.255.255
 exit-address-family
end

R2

hostname R2
ip cef
interface Loopback0
 ip address 10.255.0.2 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.2 255.255.255.252
 no shutdown
exit
interface GigabitEthernet2
 ip address 192.0.2.5 255.255.255.252
 no shutdown
exit
router bgp 65002
 bgp router-id 10.255.0.2
 no bgp default ipv4-unicast
 neighbor 192.0.2.1 remote-as 65001
 neighbor 192.0.2.6 remote-as 65001
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.1 activate
  neighbor 192.0.2.6 activate
 exit-address-family
end

R3

hostname R3
ip cef
interface Loopback0
 ip address 10.255.0.3 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.6 255.255.255.252
 no shutdown
exit
router bgp 65001
 bgp router-id 10.255.0.3
 no bgp default ipv4-unicast
 neighbor 192.0.2.5 remote-as 65002
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.5 activate
 exit-address-family
end

Open plain-text configurations

Outputs are illustrative, not recorded router results. Each lab starts from its own baseline. Configuration and feature support vary by image and release; platform-specific examples identify their prerequisites.
R2# show ip bgp
     Network          Next Hop        Metric LocPrf Weight Path
*>   198.51.100.1/32  192.0.2.1            0             0 65001 i
R3# show ip bgp 198.51.100.1/32
% Network not in table

Read the reserved ranges

Range / valueUse
0Reserved.
1–64495Historical public allocation space, with special assignments such as AS_TRANS 23456.
64496–64511Documentation examples.
64512–65534Private use, 16-bit range.
65535Reserved.
65536–65551Documentation examples, four-byte range.
65552–4199999999Public allocation space subject to IANA/RIR assignment and special reservations.
4200000000–4294967294Private use, four-byte range.
4294967295Reserved.

A number being outside the private ranges does not mean you may use it on the Internet. Check its actual assignment in the registry. Public AS15169 is an example assigned to Google; an operator must use its own authorized allocation.

Use a private ASN inside an agreed boundary

Private AS numbers can be reused in independent networks and inside confederations. A single-homed customer may use one by agreement with its provider, which then removes or replaces private AS information at the public export boundary. This modifies a control-plane path; it does not translate packets or require NAT-style per-flow mappings.

Distinguish width from uniqueness

Four-byte AS capability expands the identifier space but does not change the basic loop check. Private four-byte ASNs are still private. Documentation ASNs are reserved for examples, not allocated public identities. When changing an ASN, plan peer expectations, policies, communities and route-origin authorizations together.

Audit before deployment

Check the local and remote AS in the neighbor configuration, the received AS path, and the IANA/RIR assignment. In this lab, make R3 a distinct ASN only as a separate test: update both ends of the R2–R3 session consistently. Using allowas-in instead changes loop acceptance and belongs to a different lesson.

Key Takeaways

  • Public routing requires an authorized globally unique AS identity.
  • Private ASNs have both 16-bit and four-byte ranges.
  • Documentation and reserved ASNs are not public assignments.
  • AS_TRANS 23456 is a compatibility marker.
  • Ordinary AS-loop detection rejects a path containing the local AS.

Private and Public AS Numbers Quiz

Six questions · four options each · select one answer per question. Submit all answers to see your score and explanations.

1. Why does R3 reject the example prefix?
2. Which four-byte range is private?
3. What is 64496 reserved for?
4. Is 65535 a usable private ASN?
5. What is AS23456 used for?
6. Does being outside a private range authorize Internet use?
Protocol and command references

IANA AS registry · Private AS reservations · Router-symbol attribution.