remote-as [asn]
Configures the remote AS number for a BGP neighbor in Cisco IOS-XR.
Overview
The 'remote-as' command in Cisco IOS-XR is used to specify the Autonomous System (AS) number of a BGP neighbor. This command is essential for establishing BGP peering sessions, as BGP uses AS numbers to identify routing domains and enforce loop prevention. In BGP, each neighbor must be configured with the correct remote AS number that matches the neighbor's BGP configuration. For eBGP (external BGP), the remote AS must be different from the local AS; for iBGP (internal BGP), it must be the same. The command is entered in BGP neighbor configuration mode, which is accessed after defining the neighbor's IP address under the BGP router configuration. On Cisco IOS-XR, the configuration is hierarchical: 'router bgp <asn>' enters BGP configuration, then 'neighbor <ip-address>' enters neighbor configuration, where 'remote-as <asn>' is applied. This command is fundamental for any BGP deployment, whether for simple eBGP peering with an ISP or complex iBGP meshes in a service provider network. It is also used in advanced scenarios like BGP confederations and route reflectors. In troubleshooting workflows, verifying the remote AS is one of the first steps when a BGP session fails to establish.
remote-as [asn]When to Use This Command
- Establishing eBGP peering with an external ISP using their public AS number.
- Configuring iBGP peering within the same AS for route propagation.
- Setting up BGP confederation peers with a private AS number.
- Defining a BGP neighbor in a VRF context for MPLS L3VPN.
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| asn | <1-4294967295> | The Autonomous System number of the BGP neighbor. Can be a 16-bit (1-65535) or 32-bit (65536-4294967295) AS number. Must match the neighbor's configured BGP AS. |
Command Examples
Configure eBGP neighbor with remote AS 65001
router bgp 65000
neighbor 192.0.2.1
remote-as 65001RP/0/RP0/CPU0:router(config-bgp-nbr)#remote-as 65001
The command sets the remote AS to 65001 for neighbor 192.0.2.1. No output indicates success.
Configure iBGP neighbor with same AS
router bgp 65000
neighbor 10.0.0.2
remote-as 65000RP/0/RP0/CPU0:router(config-bgp-nbr)#remote-as 65000
Sets the remote AS to 65000, matching the local AS, establishing iBGP peering.
Understanding the Output
The remote-as command does not produce any output on successful configuration. It simply sets the AS number for the BGP neighbor. To verify, use 'show bgp neighbors <ip-address>' and look for the 'Remote AS' field. A correct configuration will show the configured AS number. If the remote AS is incorrect, the BGP session will not establish, and the neighbor state will remain in Idle or Active. In 'show bgp neighbors', the 'BGP state' field will indicate the session status; a healthy session shows 'Established'.
Configuration Scenarios
eBGP Peering with ISP
A customer router with AS 65000 connects to an ISP router with AS 65001.
Topology
Customer (AS 65000) -- eBGP -- ISP (AS 65001)Steps
- 1.Enter BGP configuration: router bgp 65000
- 2.Define neighbor: neighbor 192.0.2.1
- 3.Set remote AS: remote-as 65001
router bgp 65000 neighbor 192.0.2.1 remote-as 65001 address-family ipv4 unicast route-policy PASS-ALL in route-policy PASS-ALL out
Verify: Use 'show bgp neighbors 192.0.2.1' to verify remote AS and session state.
Watch out: Ensure the ISP's router has the customer's AS (65000) configured as remote-as; otherwise, session won't establish.
Troubleshooting with This Command
When a BGP session fails to establish, the first step is to verify the remote AS configuration. Use 'show bgp neighbors <ip>' and check the 'Remote AS' field. If it does not match the neighbor's actual AS, correct it. Also check the 'BGP state' field; if it is 'Idle', the router is not attempting to connect; if 'Active', it is trying but failing. Common causes include AS mismatch, ACL blocking TCP port 179, or incorrect update-source. On IOS-XR, you can also use 'debug bgp' commands with caution. Always ensure the remote AS is correctly set for both eBGP and iBGP. For iBGP, the remote AS must equal the local AS; for eBGP, it must be different. In confederation scenarios, the remote AS is the confederation AS, not the global AS.
CCNA Exam Tips
Remember that remote-as must match the neighbor's BGP AS number; mismatch prevents session establishment.
In IOS-XR, the remote-as command is configured under the neighbor configuration mode, not as a single-line command like in IOS.
For iBGP, the remote-as must equal the local AS; for eBGP, it must be different.
Common Mistakes
Configuring remote-as with the local AS number for eBGP, causing session failure.
Forgetting to enter neighbor configuration mode before applying remote-as.
Using an AS number that is not allowed (e.g., reserved or private AS in public peering).
Platform Notes
In Cisco IOS-XR, the 'remote-as' command is configured under the neighbor sub-mode, unlike classic IOS where it is often a single command. IOS-XR also supports 32-bit AS numbers (ASN.4 format). The configuration is committed only after 'commit', which is a key difference from IOS where changes take effect immediately. For equivalent commands on other platforms: Juniper uses 'peer-as <asn>' under 'group' or 'neighbor' hierarchy; Nokia (Alcatel-Lucent) uses 'peer-as <asn>' under 'bgp' configuration. In IOS-XR, the command is mandatory for each neighbor; without it, the neighbor configuration is incomplete.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions