To add an entry to the BGP or multiprotocol BGP neighbor table, use the
neighbor
remote-as command in router configuration mode. To remove an entry from the table, use the
no form of this command.
neighbor {ip-address | ipv6-address% | peer-group-name}remote-as autonomous-system-number [alternate-as autonomous-system-number ...]
no neighbor {ip-address | ipv6-address% | peer-group-name}remote-as autonomous-system-number [alternate-as autonomous-system-number ...]
Syntax Description
ip-address
|
IP address of the neighbor.
|
ipv6-address
|
IPv6 address of the neighbor.
|
%
|
(Optional) IPv6 link-local address identifier. This keyword needs to be added whenever a link-local IPv6 address is used
outside the context of its interface.
|
peer-group-name
|
Name of a BGP peer group.
|
autonomous-system-number
|
Number of an autonomous system to which the neighbor belongs in the range from 1 to 65535.
-
In Cisco IOS Release 12.0(32)SY8, 12.0(33)S3, 12.2(33)SRE, 12.2(33)XNE, 12.2(33)SXI1, Cisco IOS XE Release 2.4, and later
releases, 4-byte autonomous system numbers are supported in the range from 65536 to 4294967295 in asplain notation and in
the range from 1.0 to 65535.65535 in asdot notation.
-
In Cisco IOS Release 12.0(32)S12, 12.4(24)T, and Cisco IOS XE Release 2.3, 4-byte autonomous system numbers are supported
in the range from 1.0 to 65535.65535 in asdot notation only.
For more details about autonomous system number formats, see the
router
bgp command.
When used with the
alternate-as keyword, up to five autonomous system numbers may be entered.
|
alternate-as
|
(Optional) Specifies an alternate autonomous system in which a potential dynamic neighbor can be identified. Up to five autonomous
system numbers may be entered when this keyword is specified.
|
Command Default
There are no BGP or multiprotocol BGP neighbor peers.
Command Modes
Router configuration (config-router)
Command History
Release
|
Modification
|
10.0
|
This command was introduced.
|
11.0
|
The
peer-group-name argument was added.
|
11.1(20)CC
|
The
nlri
unicast ,
nlri
multicast , and
nlri
unicast
multicast keywords were added.
|
12.0(7)T
|
The
nlri
unicast ,
nlri
multicast , and
nlri
unicast
multicast keywords were removed.
|
12.2(4)T
|
Support for the IPv6 address family was added.
|
12.2(25)SG
|
This command was integrated into Cisco IOS Release 12.2(25)SG.
|
12.2(33)SRA
|
This command was integrated into Cisco IOS Release 12.2(33)SRA.
|
12.2(33)SRB
|
This command was modified. The
% keyword was added.
|
12.2(33)SXH
|
This command was integrated into Cisco IOS Release 12.2(33)SXH. The
alternate-as keyword was added to support BGP dynamic neighbors.
|
12.2(33)SB
|
This command was integrated into Cisco IOS Release 12.2(33)SB.
|
Cisco IOS XE Release 2.1
|
This command was introduced on Cisco ASR 1000 Series Routers.
|
12.0(32)S12
|
This command was modified. Support for 4-byte autonomous system numbers in asdot notation only was added.
|
12.0(32)SY8
|
This command was modified. Support for 4-byte autonomous system numbers in asplain and asdot notation was added.
|
12.4(24)T
|
This command was modified. Support for 4-byte autonomous system numbers in asdot notation only was added.
|
Cisco IOS XE Release 2.3
|
This command was modified. Support for 4-byte autonomous system numbers in asdot notation only was added.
|
12.2(33)SXI1
|
This command was modified. Support for 4-byte autonomous system numbers in asplain and asdot notation was added.
|
12.0(33)S3
|
This command was modified. Support for asplain notation was added and the default format for 4-byte autonomous system numbers
is now asplain.
|
Cisco IOS XE Release 2.4
|
This command was modified. Support for asplain notation was added and the default format for 4-byte autonomous system numbers
is now asplain.
|
12.2(33)SRE
|
This command was modified. Support for 4-byte autonomous system numbers in asplain and asdot notation was added.
|
12.2(33)XNE
|
This command was modified. Support for 4-byte autonomous system numbers in asplain and asdot notation was added.
|
15.0(1)S
|
This command was integrated into Cisco IOS Release 15.0(1)S.
|
15.1(1)SG
|
This command was modified. Support for 4-byte autonomous system numbers in asplain and asdot notation was added.
|
Cisco IOS XE Release 3.3SG
|
This command was modified. Support for 4-byte autonomous system numbers in asplain and asdot notation was added.
|
15.1(2)SNG
|
This command was implemented on the Cisco ASR 901 Series Aggregation Services Routers.
|
15.2(1)E
|
This command was integrated into Cisco IOS Release 15.2(1)E.
|
Usage Guidelines
Specifying a neighbor with an autonomous system number that matches the autonomous system number specified in the
router
bgp global configuration command identifies the neighbor as internal to the local autonomous system. Otherwise, the neighbor
is considered external.
If you specify a BGP peer group by using the
peer-group-name argument, all the members of the peer group will inherit the characteristic configured with this command.
By default, neighbors that are defined using the
neighbor
remote-as command in router configuration mode exchange only unicast address prefixes. To exchange other address prefix types, such
as multicast and Virtual Private Network (VPN) Version 4, neighbors must also be activated in the appropriate address family
configuration mode.
Use the
alternate-as keyword introduced in Cisco IOS Release 12.2(33)SXH to specify up to five alternate autonomous systems in which a dynamic
BGP neighbor may be identified. BGP dynamic neighbor support allows BGP peering to a group of remote neighbors that are defined
by a range of IP addresses. BGP dynamic neighbors are configured using a range of IP addresses and BGP peer groups. After
a subnet range is configured and associated with a BGP peer group using the
bgp
listen command and a TCP session is initiated for an IP address in the subnet range, a new BGP neighbor is dynamically created as
a member of that group. The new BGP neighbor will inherit any configuration or templates for the group.
The
% keyword is used whenever link-local IPv6 addresses are used outside the context of their interfaces. This keyword does not
need to be used for non-link-local IPv6 addresses.
In Cisco IOS Release 12.0(32)SY8, 12.0(33)S3, 12.2(33)SRE, 12.2(33)XNE, 12.2(33)SXI1, Cisco IOS XE Release 2.4, and later
releases, the Cisco implementation of 4-byte autonomous system numbers uses asplain--65538 for example--as the default regular
expression match and output display format for autonomous system numbers, but you can configure 4-byte autonomous system numbers
in both the asplain format and the asdot format as described in RFC 5396. To change the default regular expression match and
output display of 4-byte autonomous system numbers to asdot format, use the
bgp
asnotation
dot command followed by the
clear
ip
bgp
* command to perform a hard reset of all current BGP sessions.
In Cisco IOS Release 12.0(32)S12, 12.4(24)T, and Cisco IOS XE Release 2.3, the Cisco implementation of 4-byte autonomous
system numbers uses asdot--1.2 for example--as the only configuration format, regular expression match, and output display,
with no asplain support.
 Note |
In Cisco IOS releases that include 4-byte ASN support, command accounting and command authorization that include a 4-byte
ASN number are sent in the asplain notation irrespective of the format that is used on the command-line interface.
|
To ensure a smooth transition, we recommend that all BGP speakers within an autonomous system that is identified using a
4-byte autonomous system number, be upgraded to support 4-byte autonomous system numbers.
Examples
The following example specifies that a router at the address 10.108.1.2 is an internal BGP (iBGP) neighbor in autonomous
system number 65200:
router bgp 65200
network 10.108.0.0
neighbor 10.108.1.2 remote-as 65200
The following example specifies that a router at the IPv6 address 2001:0DB8:1:1000::72a is an external BGP (eBGP) neighbor
in autonomous system number 65001:
router bgp 65300
address-family ipv6 vrf site1
neighbor 2001:0DB8:1:1000::72a remote-as 65001
The following example assigns a BGP router to autonomous system 65400, and two networks are listed as originating in the
autonomous system. Then the addresses of three remote routers (and their autonomous systems) are listed. The router being
configured will share information about networks 10.108.0.0 and 192.168.7.0 with the neighbor routers. The first router is
a remote router in a different autonomous system from the router on which this configuration is entered (an eBGP neighbor);
the second
neighbor
remote-as command shows an internal BGP neighbor (with the same autonomous system number) at address 10.108.234.2; and the last
neighbor
remote-as command specifies a neighbor on a different network from the router on which this configuration is entered (also an eBGP
neighbor).
router bgp 65400
network 10.108.0.0
network 192.168.7.0
neighbor 10.108.200.1 remote-as 65200
neighbor 10.108.234.2 remote-as 65400
neighbor 172.29.64.19 remote-as 65300
The following example configures neighbor 10.108.1.1 in autonomous system 65001 to exchange only multicast routes:
router bgp 65001
neighbor 10.108.1.1 remote-as 65001
neighbor 172.31 1.2 remote-as 65001
neighbor 172.16.2.2 remote-as 65002
address-family ipv4 multicast
neighbor 10.108.1.1 activate
neighbor 172.31 1.2 activate
neighbor 172.16.2.2 activate
exit-address-family
The following example configures neighbor 10.108.1.1 in autonomous system 65001 to exchange only unicast routes:
router bgp 65001
neighbor 10.108.1.1 remote-as 65001
neighbor 172.31 1.2 remote-as 65001
neighbor 172.16.2.2 remote-as 65002
The following example, configurable only in Cisco IOS Release 12.2(33)SXH and later releases, configures a subnet range of
192.168.0.0/16 and associates this listen range with a BGP peer group. Note that the listen range peer group that is configured
for the BGP dynamic neighbor feature can be activated in the IPv4 address family using the
neighbor
activate command. After the initial configuration on Router 1, when Router 2 starts a BGP router session and adds Router 1 to its
BGP neighbor table, a TCP session is initiated, and Router 1 creates a new BGP neighbor dynamically because the IP address
of the new neighbor is within the listen range subnet.
Examples
enable
configure terminal
router bgp 45000
bgp log-neighbor-changes
neighbor group192 peer-group
bgp listen range 192.168.0.0/16 peer-group group192
neighbor group192 remote-as 40000 alternate-as 50000
address-family ipv4 unicast
neighbor group192 activate
end
Examples
enable
configure terminal
router bgp 50000
neighbor 192.168.3.1 remote-as 45000
exit
If the
show
ip
bgp
summary command is now entered on Router 1, the output shows the dynamically created BGP neighbor, 192.168.3.2.
Router1# show ip bgp summary
BGP router identifier 192.168.3.1, local AS number 45000
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
*192.168.3.2 4 50000 2 2 0 0 0 00:00:37 0
* Dynamically created based on a listen range command
Dynamically created neighbors: 1/(200 max), Subnet ranges: 1
BGP peergroup group192 listen range group members:
192.168.0.0/16
The following example configures a BGP process for autonomous system 65538 and configures two external BGP neighbors in different
autonomous systems using 4-byte autonomous system numbers in asplain format. This example is supported only on Cisco IOS Release
12.0(32)SY8, 12.0(33)S3, 12.2(33)SRE, 12.2(33)XNE, 12.2(33)SXI1, Cisco IOS XE Release 2.4, or later releases.
router bgp 65538
neighbor 192.168.1.2 remote-as 65536
neighbor 192.168.3.2 remote-as 65550
neighbor 192.168.3.2 description finance
!
address-family ipv4
neighbor 192.168.1.2 activate
neighbor 192.168.3.2 activate
no auto-summary
no synchronization
network 172.17.1.0 mask 255.255.255.0
exit-address-family
The following example configures a BGP process for autonomous system 1.2 and configures two external BGP neighbors in different
autonomous systems using 4-byte autonomous system numbers in asdot format. This example requires Cisco IOS Release 12.0(32)SY8,
12.0(32)S12, 12.2(33)SRE, 12.2(33)XNE, 12.2(33)SXI1, 12.4(24)T, Cisco IOS XE Release 2.3, or a later release.
router bgp 1.2
neighbor 192.168.1.2 remote-as 1.0
neighbor 192.168.3.2 remote-as 1.14
neighbor 192.168.3.2 description finance
!
address-family ipv4
neighbor 192.168.1.2 activate
neighbor 192.168.3.2 activate
no auto-summary
no synchronization
network 172.17.1.0 mask 255.255.255.0
exit-address-family