Attaching a DRG to a VCN
Create a VCN attachment on a Dynamic Routing Gateway (DRG) in Oracle Cloud Infrastructure.
To route traffic to a compute instance from an on-premises network or a DRG in another region, a DRG must be explicitly attached to a VCN. A VCN can be attached to only one DRG at a time, but a DRG can be attached to more than one VCN. The attachment is automatically created in the compartment that holds the VCN. An attached VCN doesn't need to be in the same compartment as the DRG.
You can choose to connect two or more VCNs in the same region by attaching them to a single DRG instead of with local peering gateways (for more information about that use case see Local VCN Peering Through an Upgraded DRG). If left unmodified, 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. Also, refer to Route Aggregation for more details on controlling the VCN routes advertised by BGP.
When you create a VCN attachment (the VCN can be in another tenancy in the same OCI region), attachments on both the DRG and VCN are created and connected in one step. If you create a remote peering connection (RPC) attachment, there are additional steps required to connect to the DRG on the other end. For more about using RPC attachments, see Remote VCN Peering through an Upgraded DRG.
You can't directly create other attachment types for a DRG (such as IPSEC TUNNEL, LOOPBACK, and VIRTUAL CIRCUIT attachments). When you create a FastConnect virtual circuit or IPSec tunnel for Site-to-Site VPN, a virtual circuit attachment or IPSec tunnel attachment is created for you. It's not necessary to explicitly create an attachment with those types.
Attaching a DRG to a VCN results in a DrgAttachment
object with its
own OCID. If you're setting up the advanced routing scenario called transit routing, you can optionally specify a
route table for a DRG attachment.
The following instructions have you navigate to the DRG and then choose which VCN to attach. You could instead navigate to the VCN and then choose a DRG to attach (as described in Attaching a VCN to a DRG).
If the VCN is in another tenancy, see Attaching a DRG to a VCN in a Different Tenancy
The attachment is listed on the DRG details page. If you attached the DRG to a VCN in another compartment, switch to that compartment to see the attachment.
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.
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.