Courseiva
BGPRouter Config

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.

Syntax·Router Config
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 100
R1(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 65001
R1(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

1.

CCNA exam tip: eBGP = different AS numbers; iBGP = same AS numbers. The exam tests this distinction.

2.

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.

3.

CCNA exam tip: Both routers must configure each other as a neighbor — BGP is not auto-discovered.

4.

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.

Aspectneighbor [ip] remote-as [asn]router bgp [asn]
ScopePer-peer definitionGlobal BGP process creation
Configuration ModeBGP router configuration modeGlobal configuration mode
PersistencePersists in running config as part of BGP configPersists as top-level BGP process
PrecedenceRequires `router bgp` to already be configuredMust be configured before any neighbor statements
Typical UseDefines individual BGP peersEnables BGP and sets local AS number
RelationshipChild command under the BGP processParent 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

Practice for the CCNA 200-301

Test your knowledge with practice questions covering all CCNA 200-301 exam domains.

Practice CCNA 200-301 Questions