peer as-number (for a BGP peer)

Use peer as-number to create a BGP peer and specify its AS number.

Use undo peer to delete a BGP peer.

Syntax

peer { ipv4-address [ mask-length ] | ipv6-address [ prefix-length ] } as-number as-number

undo peer { ipv4-address [ mask-length ] | ipv6-address [ prefix-length ] }

Default

No BGP peers exist.

Views

BGP instance view

BGP-VPN instance view

Predefined user roles

network-admin

Parameters

ipv4-address: Specifies the IPv4 address of a peer.

mask-length: Specifies a mask length in the range of 0 to 32. You can use the ipv4-address and mask-length arguments together to specify a subnet. If you specify a subnet, this command enables BGP to establish dynamic peer relationships with all devices in the subnet.

ipv6-address: Specifies the IPv6 address of a peer.

prefix-length: Specifies a prefix length in the range of 0 to 128. You can use the ipv6-address and prefix-length arguments together to specify a subnet. If you specify a subnet, this command enables BGP to establish dynamic peer relationships with all devices in the subnet.

as-number: Specifies an AS number for the peer, in the range of 1 to 4294967295. If the AS numbers of the peer and the local router are the same, the peer is an IBGP peer. If they are different, the peer is an EBGP peer.

Usage guidelines

You can also create a peer and add it to a peer group by using the peer group command.

To modify the AS number of a peer, do not execute the peer as-number command repeatedly. Instead, you must first delete the peer and configure it again.

After you create a peer, you must use the peer enable command to enable BGP to exchange routing information with the specified peer.

For a remote device to establish a peer relationship with the local device, you must specify the IP address of the local device on the remote device.

Examples

# In BGP instance view, create BGP peer 1.1.1.1 and set its AS number to 100.

<Sysname> system-view
[Sysname] bgp 100
[Sysname-bgp-default] peer 1.1.1.1 as-number 100

Related commands

display bgp peer

peer enable

peer group