neighbor

To configure a Border Gateway Protocol (BGP) neighbor (router or VRF) and enter the neighbor configuration mode, use the neighbor command. To remove an entry, use the no form of this command.

neighbor { ip-addr | ip-prefix / length } [ remote-as { as-num [. as-num ] | route-map name }

no neighbor { ip-addr | ip-prefix / length } [ remote-as { as-num [. as-num ] | route-map name }]

Syntax Description

ip-addr
IP address of the neighbor in this format: A.B.C.D.
ip-prefix / length
IP prefix and the length of the IP prefix. The format is x.x.x.x/ length . The length range is from 1 to 32.
remote-as
(Optional) Specifies the autonomous system (AS) number of the neighbor.
as-num
Number of an AS that identifies the router to other BGP routers and tags the routing information passed along. The range is from 1 to 65535.
. as-num
(Optional) Number of an AS that identifies the router to other BGP routers and tags the routing information passed along. The range is from 1 to 65535.
route-map name
(Optional) Specifies a route map that matches the BGP peer AS number against a list of AS numbers or a regular expression. The name can be any case-sensitive, alphanumeric string up to 63 characters.

Command Default

None

Command Modes

Neighbor address-family configuration mode
Router bgp configuration mode

Command History

Release
Modification
5.0(3)N1(1)
This command was introduced.

Usage Guidelines

This command requires the LAN Enterprise Services license.

Examples

This example shows how to configure a single-hop eBGP peering session between two BGP peers that are reachable on the same network segment through a local loopback interfaces on each router:

BGP Peer 1

switch(config)# interface loopback 1
switch(config-if)# ip address 10.0.0.100 255.255.255
switch(config-if)# exit
switch(config)# router bgp 64497
switch(config-router)# neighbor 192.168.0.200 remote-as 64496
switch(config-router-neighbor)# update-source loopback 2
switch(config-router-neighbor)# disable-connected-check
switch(config-router-neighbor)#

BGP Peer 2

switch(config)# interface loopback 2
switch(config-if)# ip address 192.168.0.200 255.255.255
switch(config-if)# exit
switch(config)# router bgp 64496
switch(config-router)# neighbor 10.0.0.100 remote-as 64497
switch(config-router-neighbor)# update-source loopback 1
switch(config-router-neighbor)# disable-connected-check
switch(config-router-neighbor)#
 

This example shows how to source BGP TCP connections for the specified neighbor with the IP address of the loopback interface rather than the best local address:

switch(config)# router bgp 64496
switch(config-router)# neighbor 172.16.0.0 remote-as 64496
switch(config-router-neighbor)# update-source Loopback0
switch(config-router-neighbor)#
 

Related Commands

Command
Description
feature bgp
Enables BGP on the router.
route-map
Creates a route map.