Attaching a VCN to a DRG
Attach a Virtual Cloud Network (VCN) to a Dynamic Routing Gateway (DRG).
A VCN can be attached to only one DRG at a time, but a DRG can be attached to many VCNs (see Networking Limits). The attachment is automatically created in the compartment that holds the VCN. The VCN and DRG don't need to be in the same compartment. You can optionally specify a display name for the attachment itself, otherwise a default is provided. You can decide to connect VCNs in the same region using a single DRG instead of local peering gateways (see Local VCN Peering Through an Upgraded DRG for more information about that use case). The default routing policies in a DRG allow traffic to be routed between all VCNs attached to it. If you're attaching a DRG to a VCN in another tenancy, you need to have IAM configurations in both tenancies as described in IAM Policies for Routing Between VCNs. You also need the OCID of the VCN.
When you create an attachment to a DRG (the DRG can be in another tenancy in the same OCI region), attachments on both the DRG and VCN are created and connected in one step. Attaching a DRG to a VCN results in a DrgAttachment
object with its own OCID.
The attachment is in the Attaching state for a short period.
When the attachment is ready, create a route rule in the subnet's route table directing subnet traffic to the DRG. See To route a subnet's traffic to a DRG.
From the Dynamic Routing Gateway Attachments list, you can also select the
for the DRG attachment to view its details, manage its tags, and delete it.Use the network drg-attachment create command and required parameters to attach a VCN to a DRG:
oci network drg-attachment create --drg-id drg-ocid --network-details [complex type] ...[OPTIONS]
For a complete list of parameters and values for CLI commands, see the CLI Command Reference.
Run the CreateDrgAttachment operation to create a DRG attachment to a VCN.