Configure the BGP identifier range for a Cloud Router
Sometimes referred to as a router ID, a Border Gateway Protocol (BGP) identifier is used to uniquely identify a Cloud Router in a network.
By convention, in Google Cloud, a Cloud Router uses the IPv4 peering address of one its IPv4 BGP sessions as the BGP identifier. However, for IPv6 BGP peering, a Cloud Router requires an explicit 32-bit BGP identifier in order to host IPv6 BGP sessions.
When you create a Cloud Router, you have the option to specify a range of allowed BGP identifiers for the Cloud Router.
Typically, you don't need to assign or modify the BGP identifier range. Google Cloud automatically assigns a BGP identifier range to a Cloud Router the first time that you create an interface on Cloud Router for an IPv6 BGP session.
However, for example, you might want to specify a special BGP identifier range if you want tighter control over the values used for your BGP identifiers. Alternatively, you might need to change the range if the automatically assigned range overlaps with values you want to use for an IPv4 BGP session.
Assign a BGP identifier range to Cloud Router
The procedures in this section describe how to assign a BGP identifier range manually to a Cloud Router.
gcloud
To assign a BGP identifier range when you create the Cloud Router,
use the --bgp-identifier-range
option.
gcloud beta compute routers create ROUTER_NAME \ --bgp-identifier-range=BGP_IDENTIFIER_RANGE
Replace BGP_IDENTIFIER_RANGE
with a link-local IPv4 range
from 169.254.0.0/16
with a size of at least /30
. The range must not overlap
with any existing IPv4 BGP session or BGP identifier ranges of
Cloud Routers in the same region.
API
Use the
routers.insert
method:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME { "bgp": { "asn": "ASN_NUMBER", "keepaliveInterval": KEEPALIVE_INTERVAL, "identifierRange": BGP_IDENTIFIER_RANGE }, "name": "ROUTER_NAME", "network": "NETWORK" }
Replace BGP_IDENTIFIER_RANGE
with a link-local IPv4 range
from 169.254.0.0/16
with a size of at least /30
. The range must not overlap
with any existing IPv4 BGP session or a BGP identifier range of a
Cloud Router in the same region.
Modify the BGP identifier range
The procedures in this section describe how to modify an existing BGP identifier range on a Cloud Router.
gcloud
To change the BGP identifier range, run the following command.
gcloud beta compute routers update ROUTER_NAME \ --bgp-identifier-range=BGP_IDENTIFIER_RANGE
Replace BGP_IDENTIFIER_RANGE
with a link-local IPv4 range
from 169.254.0.0/16
with a size of at least /30
. The range must not overlap
with any existing IPv4 BGP session or a BGP identifier range of a
Cloud Router in the same region.
API
Use the
routers.patch
method
to update the bgp.identifierRange
field:
PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME { "bgp": { "identifierRange": BGP_IDENTIFIER_RANGE } }
Replace BGP_IDENTIFIER_RANGE
with a link-local IPv4 range
from 169.254.0.0/16
with a size of at least /30
. The range must not overlap
with any existing IPv4 BGP session or a BGP identifier range of a
Cloud Router in the same region.