gcloud compute routers add-bgp-peer

NAME
gcloud compute routers add-bgp-peer - add a BGP peer to a Compute Engine router
SYNOPSIS
gcloud compute routers add-bgp-peerNAME--interface=INTERFACE--peer-asn=PEER_ASN--peer-name=PEER_NAME[--advertised-route-priority=ADVERTISED_ROUTE_PRIORITY][--advertisement-mode=MODE][--async][--custom-learned-route-priority=PRIORITY][--[no-]enable-ipv4][--[no-]enable-ipv6][--[no-]enabled][--export-policies=[EXPORT_POLICY,…]][--import-policies=[IMPORT_POLICY,…]][--instance=INSTANCE][--instance-zone=INSTANCE_ZONE][--ipv4-nexthop-address=IPV4_NEXTHOP_ADDRESS][--ipv6-nexthop-address=IPV6_NEXTHOP_ADDRESS][--md5-authentication-key=MD5_AUTHENTICATION_KEY][--peer-ip-address=PEER_IP_ADDRESS][--peer-ipv4-nexthop-address=PEER_IPV4_NEXTHOP_ADDRESS][--peer-ipv6-nexthop-address=PEER_IPV6_NEXTHOP_ADDRESS][--region=REGION][--set-advertisement-groups=[GROUP,…]][--set-advertisement-ranges=[CIDR_RANGE=DESC,…]][--set-custom-learned-route-ranges=[CIDR_RANGE,…]][--bfd-min-receive-interval=BFD_MIN_RECEIVE_INTERVAL--bfd-min-transmit-interval=BFD_MIN_TRANSMIT_INTERVAL--bfd-multiplier=BFD_MULTIPLIER--bfd-session-initialization-mode=BFD_SESSION_INITIALIZATION_MODE][GCLOUD_WIDE_FLAG]
DESCRIPTION
Add a BGP peer to a Compute Engine router.
POSITIONAL ARGUMENTS
NAME
Name of the router to operate on.
REQUIRED FLAGS
--interface=INTERFACE
The name of the interface for this BGP peer.
--peer-asn=PEER_ASN
The BGP autonomous system number (ASN) for this BGP peer. Must be a 16-bit or32-bit private ASN as defined in https://tools.ietf.org/html/rfc6996, forexample--asn=64512.
--peer-name=PEER_NAME
The name of the new BGP peer being added.
OPTIONAL FLAGS
--advertised-route-priority=ADVERTISED_ROUTE_PRIORITY
The priority of routes advertised to this BGP peer. In the case where there ismore than one matching route of maximum length, the routes with lowest priorityvalue win. 0 <= priority <= 65535. If not specified, will useGoogle-managed priorities.
--advertisement-mode=MODE
The new advertisement mode for this peer.MODE must beone of:
CUSTOM
Custom (user-configured) BGP advertisements.
DEFAULT
Default (Google-managed) BGP advertisements.
--async
Return immediately, without waiting for the operation in progress to complete.
--custom-learned-route-priority=PRIORITY
An integral value0 <= priority <=65535, to beapplied to all custom learned route IP address ranges for this peer. If notspecified, a Google-managed priority value of 100 is used. The routes with thelowest priority value win.
--[no-]enable-ipv4
If IPv4 is enabled, the peer connection can be established with IPv4 routeexchange. If disabled, no IPv4 route exchange is allowed on any active session.By default enabled for IPv4-based BGP sessions. Use--enable-ipv4to enable and--no-enable-ipv4 to disable.
--[no-]enable-ipv6
If IPv6 is enabled, the peer connection can be established with IPv6 routeexchange. If disabled, no IPv6 route exchange is allowed on any active session.Disabled by default. Use--enable-ipv6 to enable and--no-enable-ipv6 to disable.
--[no-]enabled
If enabled, the peer connection can be established with routing information. Ifdisabled, any active session with the peer is terminated and all associatedrouting information is removed. Enabled by default. Use--enabledto enable and--no-enabled to disable.
--export-policies=[EXPORT_POLICY,…]
Comma-separated list of export policies. Passing an empty string removes allexport policies.
--import-policies=[IMPORT_POLICY,…]
Comma-separated list of import policies. Passing an empty string removes allimport policies.
--instance=INSTANCE
Router appliance instance of the BGP peer being added.
--instance-zone=INSTANCE_ZONE
Zone of the instance to operate on. If not specified, you might be prompted toselect a zone (interactive mode only).gcloud attempts to identify theappropriate zone by searching for resources in your currently active project. Ifthe zone cannot be determined,gcloud prompts you for a selection withall available Google Cloud Platform zones.

To avoid prompting when this flag is omitted, the user can set thecompute/zone property:

gcloudconfigsetcompute/zoneZONE

A list of zones can be fetched by running:

gcloudcomputezoneslist

To unset the property, run:

gcloudconfigunsetcompute/zone

Alternatively, the zone can be stored in the environment variableCLOUDSDK_COMPUTE_ZONE.

--ipv4-nexthop-address=IPV4_NEXTHOP_ADDRESS
If IPv4 route exchange is enabled for IPv6-based BGP, the IPv4 next hop addressof the Cloud Router interface for this BGP peer. Ignored otherwise. Must be aGoogle owned link-local IPv4 address in the range 169.254.0.0/16 and must belongto the same subnet as the interface address of the peer router.
--ipv6-nexthop-address=IPV6_NEXTHOP_ADDRESS
If IPv6 route exchange is enabled for IPv4-based BGP, the IPv6 next hop addressof the Cloud Router interface for this BGP peer. Ignored otherwise. Must be aGoogle owned global unicast IPv6 address belonging to the range2600:2d00:0:2:0:0:0:0/64 or 2600:2d00:0:3:0:0:0:0/64 and must belong to samesubnet as the interface address of the peer router.
--md5-authentication-key=MD5_AUTHENTICATION_KEY
The MD5 authentication key for this BGP peer. Maximum length is 80 characters.Can contain only printable ASCII characters.
--peer-ip-address=PEER_IP_ADDRESS
The address of the peer router. Must be a link-local IPv4 address in the range169.254.0.0/16 or an ULA IPv6 address in the range fdff:1::/64.
--peer-ipv4-nexthop-address=PEER_IPV4_NEXTHOP_ADDRESS
If IPv4 route exchange is enabled for IPv6-based BGP, the IPv4 next hop addressof the peer router. Ignored otherwise. Must be a Google owned link-local IPv4address in the range 169.254.0.0/16.
--peer-ipv6-nexthop-address=PEER_IPV6_NEXTHOP_ADDRESS
If IPv6 route exchange is enabled for IPv4-based BGP, the IPv6 next hop addressof the peer router. Ignored otherwise. Must be a Google owned global unicastIPv6 address belonging to the range 2600:2d00:0:2:0:0:0:0/64 or2600:2d00:0:3:0:0:0:0/64.
--region=REGION
Region of the router to operate on. If not specified, you might be prompted toselect a region (interactive mode only).

To avoid prompting when this flag is omitted, you can set thecompute/region property:

gcloudconfigsetcompute/regionREGION

A list of regions can be fetched by running:

gcloudcomputeregionslist

To unset the property, run:

gcloudconfigunsetcompute/region

Alternatively, the region can be stored in the environment variableCLOUDSDK_COMPUTE_REGION.

--set-advertisement-groups=[GROUP,…]
The list of pre-defined groups of IP ranges to dynamically advertise on thispeer. This list can only be specified in custom advertisement mode.

GROUP must be (only one value is supported):

ALL_SUBNETS
Automatically advertise all available subnets. This excludes any routes learnedfor subnets that use VPC Network Peering.
--set-advertisement-ranges=[CIDR_RANGE=DESC,…]
The list of individual IP ranges, in CIDR format, to dynamically advertise onthis peer. Each IP range can (optionally) be given a text description DESC. Forexample, to advertise a specific range, use--set-advertisement-ranges=192.168.10.0/24. To store a descriptionwith the range, use--set-advertisement-ranges=192.168.10.0/24=my-networks. This listcan only be specified in custom advertisement mode.
--set-custom-learned-route-ranges=[CIDR_RANGE,…]
The list of user-defined custom learned route IP address ranges for this peer.This list is a comma separated IP address ranges such as1.2.3.4,6.7.0.0/16,2001:db8:abcd:12::/64where each IP address range must be a valid CIDR-formatted prefix. If an IPaddress is provided without a subnet mask, it is interpreted as a /32 singularIP address range for IPv4, and /128 for IPv6.
Arguments to configure BFD (Bidirectional Forwarding Detection) settings:
--bfd-min-receive-interval=BFD_MIN_RECEIVE_INTERVAL
The minimum receive interval between BFD control packets. The default is 1000milliseconds. See $gcloud topicdatetimes for information on duration formats.
--bfd-min-transmit-interval=BFD_MIN_TRANSMIT_INTERVAL
The minimum transmit interval between BFD control packets. The default is 1000milliseconds. See $gcloud topicdatetimes for information on duration formats.
--bfd-multiplier=BFD_MULTIPLIER
The number of consecutive BFD control packets that must be missed before BFDdeclares that a peer is unavailable.
--bfd-session-initialization-mode=BFD_SESSION_INITIALIZATION_MODE
The BFD session initialization mode for this BGP peer. Must be one of:

ACTIVE - The Cloud Router will initiate the BFD session for this BGP peer.

PASSIVE - The Cloud Router will wait for the peer router to initiate the BFDsession for this BGP peer.

DISABLED - BFD is disabled for this BGP peer.

BFD_SESSION_INITIALIZATION_MODE must be one of:

ACTIVE
The Cloud Router will initiate the BFD session for this BGP peer.
DISABLED
BFD is disabled for this BGP peer.
PASSIVE
The Cloud Router will wait for the peer router to initiate the BFD session forthis BGP peer.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

NOTES
These variants are also available:
gcloudalphacomputeroutersadd-bgp-peer
gcloudbetacomputeroutersadd-bgp-peer

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-05-07 UTC.