Use it when a session will not come up because the AS numbers do not agree, when choosing a private AS number, or to tell whether a neighbour is iBGP or eBGP.
Autonomous System
An autonomous system (AS) is a network under one routing policy, identified by an AS number. In BGP, router bgp <asn> sets your own AS and neighbor x remote-as <asn> the peer's; same AS means iBGP, different means eBGP.
1. show ip bgp summary — local AS and each neighbour's AS.
2. eBGP peers must use the AS the other side actually runs (remote-as).
3. Private ASNs: 64512–65534 and 4200000000–4294967294.
local AS (router bgp) → remote-as equals the peer's real AS on both sides → OPEN accepted → Established → link type internal/external → own AS prepended to AS_PATH on eBGP advertisements
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
router bgp <asn>Primary Commands
Configuration and operational commands for this Topic.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 First 30 seconds Verify boundary
Immediate answer: Confirm local and remote ASN expectations on both peers before interpreting AS_PATH or loop-prevention behavior.
Verification chain: local ASN → configured remote ASN → BGP OPEN → session acceptance → AS_PATH construction → policy/best path
Stop condition: Correct ASN configuration shows only that this identity boundary is plausible; transport, policy and forwarding remain separate.
Step 2 Operational verification and known-good state Verify boundary
show ip bgp summary
show ip bgp neighbors 192.0.2.2 | include remote AS|BGP state
show running-config | section router bgp
The summary header states the local AS; the table lists the AS of each neighbour and, in the last column, a prefix count when the session is up. The neighbour detail confirms the remote AS and whether the link is internal or external. The configuration shows what was typed.
Known-good: the local AS is the intended one, each neighbour's AS matches what that neighbour runs, and the link types are as designed.
Step 3 Verification and output interpretation Verify boundary
Confirm the local BGP ASN, the remote-as configured for the neighbor, session establishment and the AS_PATH of representative prefixes. For an eBGP session, a mismatch between expected and configured remote AS prevents the normal OPEN negotiation from completing. For received routes, inspect whether the path contains the expected upstream sequence and whether local loop prevention is rejecting a path because the local ASN appears in it.
Step 4 Verification & troubleshooting Narrow the fault
1. show ip bgp summary → local AS number in the header.
2. Compare the AS column for each neighbour with what that neighbour actually runs.
3. show ip bgp neighbors <ip> | include remote AS → internal link or external link.
4. If the session is not Established: show logging | include NOTIFICATION → peer in wrong AS.
5. Correct remote-as on the side that is wrong.
Step 5 Failure signatures and troubleshooting branches Narrow the fault
- Neighbour cycles between Idle and Active; the log says
peer in wrong AS.remote-asis wrong on one side. - Session is up, but routes from your other site are missing. Both sites use the same ASN and loop prevention drops the routes; see AS_PATH.
- A neighbour meant to be external shows
internal link. Itsremote-asequals the local ASN. router bgp <asn>is rejected because BGP is already running. A router has one BGP process; the existing ASN has to be removed first.- 23456 appears in an AS_PATH. The route crossed a router without four-byte AS support.
Step 6 When the problem is really fixed Narrow the fault
- Each neighbour's configured AS matches the AS it runs, on both ends.
- Sessions are Established with the designed link type.
- No
peer in wrong ASnotifications since the change. - Private AS numbers are not visible beyond your provider.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
neighbor … remote-as must be the AS the peer really runs, otherwise the peer rejects the OPEN ("peer in wrong AS") and the session never establishes. Same AS as yours = iBGP, different = eBGP. Private ranges: 64512–65534 and 4200000000–4294967294. A router runs one BGP process with one AS number.
show ip bgp summary → local AS number in the header and the AS column per neighbour. show ip bgp neighbors <ip> | include remote AS → internal link or external link. show logging | include NOTIFICATION → peer in wrong AS.
ReferenceWhat it is2 sections · depth on demand
BGP scope — internal and external paths
An Autonomous System is an administrative routing-policy boundary. Different-AS external peers use eBGP; same-AS peers normally use iBGP. An ASN is not a transport-reachability mechanism. Confederation member ASs and local-as overrides require their own explicit interpretation. The retained eBGP examples show one use of AS identity, rather than limiting the concept to external peering.
What it is
An autonomous system (AS) is a network, or a group of networks, run under one administration with one routing policy. BGP identifies each by a number, the ASN. A router's own ASN is set with router bgp <asn>, and every neighbour is declared together with the ASN it is expected to have.
ReferenceWhy it matters1 section · depth on demand
Why it matters
The AS number decides what kind of session two routers have: the same number on both sides makes it iBGP, different numbers make it eBGP, and the two follow different rules for next hop, AS_PATH, re-advertisement and administrative distance. The number also has to be right on both ends or the session never comes up. And it is what AS_PATH is built from, so it underlies both loop prevention and path length.
ReferenceImportant terms & boundaries7 sections · depth on demand
Key points
router bgp 65000— one BGP process and one ASN per router.neighbor <ip> remote-as <asn>must name the AS the neighbour really runs.- Same ASN as your own = iBGP; different = eBGP.
- Two-byte range 1–65535, private 64512–65534. Four-byte range up to 4294967295, private 4200000000–4294967294.
- Four-byte numbers are shown as plain numbers by default;
bgp asnotation dotshows them as1.0. - A route whose AS_PATH already contains your own ASN is rejected.
- A private ASN must not appear on the Internet;
remove-private-asstrips it on the way out. local-aslets a router present a different ASN to one neighbour, mainly during migrations.
In depth
Autonomous systems and AS numbers
An autonomous system (AS) is a network under one administration with one routing policy towards others. BGP identifies each AS by an AS number, and the AS_PATH attribute lists the ASes a route has crossed. The Catalyst 9300 BGP guide gives the router bgp range as 1–65535 and the private range as 64512–65535.
AS number ranges
| Range | Use |
|---|---|
| 1–64495 | Public 2-byte ASNs, assigned by RIRs |
| 64512–65534 | Private 2-byte ASNs (the guide states 64512–65535; 65535 is reserved) |
| 65536–4294967295 | 4-byte ASNs (RFC 6793), public except 4200000000–4294967294 (private) |
| 23456 | AS_TRANS: stands in for 4-byte ASNs towards old speakers |
R1(config)# router bgp 64500
R1(config-router)# neighbor 192.0.2.1 remote-as 64510
R1(config-router)# address-family ipv4 unicast
R1(config-router-af)# neighbor 192.0.2.1 remove-private-as
R1# show ip bgp summary | include local AS
BGP router identifier 10.0.0.1, local AS number 64500
R1# show ip bgp 203.0.113.0
64510 3356 15169
192.0.2.1 from 192.0.2.1 (198.51.100.1)
The AS path above reads right to left: AS 15169 originated the prefix, it passed through 3356, and 64510 sent it to us.
When you need a public ASN
| Situation | ASN |
|---|---|
| One ISP, the ISP announces your space | None, or a private ASN agreed with the ISP |
| Two or more ISPs, provider-independent space | Public ASN from your RIR |
| Internal BGP only (data centre, SD-WAN) | Private ASNs |
Private ASNs towards the Internet
Private ASNs must not appear in routes on the Internet. The guide documents neighbor … remove-private-as, which strips them when advertising to an eBGP peer, typically used by an ISP on routes from customers using private ASNs.
Loop prevention
A BGP router rejects a route whose AS_PATH already contains its own AS. That's why two sites using the same private ASN can't exchange routes through a provider without allowas-in or AS override.
Documented example, not captured output.
Platform, version and operating-envelope scope
Cisco IOS / IOS XE first; best-path tie breakers and command output vary by release and feature set.
Quick reference
An autonomous system (AS) is a network under a single routing policy, identified by an AS number. Public ASNs are assigned by RIRs; private ranges are 64512–65534 (2-byte) and 4200000000–4294967294 (4-byte).
router bgp 65010
bgp router-id 10.255.255.1
neighbor 203.0.113.1 remote-as 64500
show bgp summary
Documented example, not captured output.
AS numbers in AS_PATH let BGP detect loops: a router rejects routes whose AS_PATH already contains its own AS.
Mechanics and state ownership
When two routers open a session, each sends an OPEN message containing its own AS number. The receiver compares that with the remote-as it has configured for the neighbour. If they differ it answers with a NOTIFICATION — "bad peer AS" — and closes the connection. Both sides then retry, so the neighbour cycles between Idle and Active without ever reaching Established.
The same comparison sets the link type. If the neighbour's AS equals the local one the session is internal; otherwise it is external. Everything that differs between iBGP and eBGP follows from that.
Four-byte AS numbers do not fit in the original two-byte field of the OPEN message. Routers therefore announce the real number in a capability and put the placeholder 23456 in the old field. Seeing 23456 in an AS_PATH means the route passed a router that does not understand four-byte numbers.
State model and selection mechanics
An ASN identifies an administrative routing domain for BGP policy and loop detection. Modern BGP supports 32-bit ASNs while the protocol still interoperates with older 16-bit representations. When an eBGP speaker advertises a route, its ASN is normally added to AS_PATH. A receiving router rejects a route containing its own ASN under normal loop-prevention rules. The ASN therefore participates in both session semantics and path history, but it does not imply a particular IGP, physical topology or business organization inside the domain.
Limits and common misconceptions
ASNs are policy identifiers, not evidence of ownership, geography or transport. A route can traverse multiple private or public administrative boundaries, and AS_PATH can be intentionally prepended or modified by policy. Counting AS_PATH entries is therefore not a reliable latency or hop-count measurement, and a short AS_PATH is not automatically the desired business path.
ReferenceConfiguration & state1 section · depth on demand
Policy and configuration model
Configure the local ASN consistently with the intended peering relationship and document whether the peer is external or internal. Private ASNs can be appropriate inside controlled designs but should be handled deliberately at external boundaries. Renumbering or migration features such as local-as can alter loop checks and displayed path history, so treat them as policy exceptions rather than cosmetic identifiers.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Configuration & expected output
Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.
Configuration example
Assumptions: Lab addressing; local AS 65000; loopbacks carried in the IGP.
router bgp 65000
neighbor 192.0.2.2 remote-as 65010
neighbor 10.0.0.2 remote-as 65000
neighbor 10.0.0.2 update-source Loopback0Expected output
show ip bgp summaryExpected state: Local AS in the header; neighbour AS column matches the design.
BGP router identifier 1.1.1.1, local AS number 65000
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.0.0.2 4 65000 120 118 42 0 0 01:45:10 5
192.0.2.2 4 65010 210 205 42 0 0 03:12:44 12
! Illustrative output, not captured Evidence.10.0.0.2 has the same AS as the local router, so it is an iBGP peer; 192.0.2.2 in AS 65010 is eBGP. A number under State/PfxRcd means the session is Established.Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Routing → BGP → eBGP → Autonomous System. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc4271.html · confidence 94%Quick lookup tables
Autonomous System · routing reference
Compact path-selection and evidence boundaries for fast lookup.
| Evidence | Meaning |
|---|---|
| Local ASN | Local BGP policy domain |
| remote-as | Expected peer ASN |
| AS_PATH | AS sequence carried with route |
| Own ASN present | Normal loop-prevention concern |
Autonomous System operational reference
Topic-specific bounded interpretation: known-good BGP state, suspicious signatures and the next technical proof boundary.
| Boundary | Known-good for Autonomous System | Suspicious signature | Next proof |
|---|---|---|---|
| Session/input | Correct peer, AF and prefix context | Transport, FSM or prefix eligibility disagrees | Peer detail and exact prefix |
| Attribute/policy | BGP Autonomous System identity and policy scope, including local/remote ASN intent, four-octet ASN representation, loop-prevention consequences and the distinction between administrative identity and actual peer reachability matches intended policy | local and remote ASN mismatches, a peer OPEN rejected because the expected ASN differs, duplicate or unintended local-as behavior, a route rejected because the local ASN already appears in AS_PATH, or an operator treating the ASN itself as proof that TCP reachability and route exchange are healthy | Compare candidate paths and policy |
| Route/forwarding | Expected best path reaches RIB/FIB | BGP state exists but installed path disagrees | RIB/FIB/CEF and next-hop proof |
| Closure | Original test passes for explained reason | Symptom moved, was bypassed or state was forced | Regression/failover test |