neighbor [ip] remote-as [asn]
Defines a BGP neighbor peer relationship by IP address and remote AS number.
Definition: neighbor [ip] remote-as [asn] is a Cisco IOS router config command. Defines a BGP neighbor (peer) by specifying its IP address and AS number. If the remote AS matches the local AS, this creates an iBGP session; if different, it creates an eBGP session.
neighbor <ip-address> remote-as <autonomous-system-number>When to Use This Command
- Configuring an eBGP peer to an ISP router.
- Setting up iBGP full mesh within the same AS.
- Adding a new peer to an existing BGP process.
- Connecting two enterprise networks using private AS numbers.
Command Examples
eBGP to ISP (different AS number)
R1(config)# router bgp 65001
R1(config-router)# neighbor 203.0.113.1 remote-as 100R1(config-router)# %BGP-5-ADJCHANGE: neighbor 203.0.113.1 Up
The session establishes when the peer is reachable and configured correctly. AS 100 (ISP) differs from AS 65001 (local), making this an eBGP session. The syslog message confirms the adjacency came up.
iBGP between two routers in the same AS
R1(config)# router bgp 65001
R1(config-router)# neighbor 10.0.0.2 remote-as 65001R1(config-router)#
Both routers use the same AS (65001), creating an iBGP session. iBGP peers are usually loopback-sourced and require 'neighbor update-source' for stability.
Understanding the Output
No direct output from the command. Verify the neighbor relationship with 'show ip bgp summary'. Look for the State/PfxRcd column — 'Established' shows as a number of received prefixes (e.g., 5), while a failing session shows Idle, Active, Connect, or OpenSent.
CCNA Exam Tips
CCNA exam tip: eBGP = different AS numbers; iBGP = same AS numbers. The exam tests this distinction.
CCNA exam tip: eBGP neighbors must be directly connected (TTL=1 by default). iBGP uses 'neighbor update-source Loopback0' and 'neighbor ebgp-multihop' for non-direct paths.
CCNA exam tip: Both routers must configure each other as a neighbor — BGP is not auto-discovered.
CCNA exam tip: If 'show ip bgp summary' shows 'Active' state, the most common causes are wrong IP, wrong AS number, or firewall blocking TCP 179.
Common Mistakes
Mistake 1: Specifying the wrong remote-as — the session negotiation fails (BGP OPEN message mismatch).
Mistake 2: Only configuring one side of the peering — both routers must have 'neighbor' statements.
Mistake 3: For iBGP: not using a loopback update source — if the direct link goes down, the iBGP session drops even if another path exists.
neighbor [ip] remote-as [asn] vs router bgp [asn]
The `neighbor [ip] remote-as [asn]` and `router bgp [asn]` commands are both fundamental to BGP configuration, but they serve distinct roles: `router bgp` initiates the BGP routing process and enters BGP configuration mode, while `neighbor remote-as` defines a specific peer within that process. They are often confused because both require an autonomous system number and are used together.
| Aspect | neighbor [ip] remote-as [asn] | router bgp [asn] |
|---|---|---|
| Scope | Per-peer definition | Global BGP process creation |
| Configuration Mode | BGP router configuration mode | Global configuration mode |
| Persistence | Persists in running config as part of BGP config | Persists as top-level BGP process |
| Precedence | Requires `router bgp` to already be configured | Must be configured before any neighbor statements |
| Typical Use | Defines individual BGP peers | Enables BGP and sets local AS number |
| Relationship | Child command under the BGP process | Parent command that creates the BGP context |
Use neighbor [ip] remote-as [asn] when you need to define a specific BGP peer, specifying its IP address and remote autonomous system number.
Use router bgp [asn] when you need to start BGP configuration and set the local autonomous system number for the router.
Related Commands
neighbor [ip] update-source [interface]
Specifies the source interface for BGP TCP sessions to a neighbor. Used in iBGP configurations to source sessions from a loopback interface for stability — if the physical link fails but another path exists, the loopback remains reachable and the session stays up.
router bgp [asn]
Enters BGP router configuration mode and creates a BGP process with the specified autonomous system (AS) number. This is the first command required to configure BGP on a Cisco router.
show ip bgp summary
Displays a summary of the BGP neighbor status and prefix counts, used to quickly verify BGP peering and routing table health.
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions