Scenario D: IPv6 Architecture

Learn how to set up on IPv6 architecture with a dual-stack VCN.

This scenario explains how to set up an IPv6 architecture within a dual-stack virtual cloud network (VCN) using regional IPv6-only public subnet to host internet facing resources (like web servers), and a regional dual-stack private subnet to connect private resources (like databases). Place your servers in separate availability domains (AD)and fault domains (FD) for redundancy (not shown).

Compute instances in both subnets can connect to each other over IPv6 automatically. Instances in the public subnet have direct access to the internet by way of an internet gateway over IPv6. Instances in the private subnet can initiate internet destined connections over IPv4 by way of a NAT gateway, while avoiding connections initiated from the internet directly on both IPv4 and IPv6. Also, the resources in the private subnet can connect to Oracle Services Network over IPv4 and IPv6 through a service gateway. The Oracle Services Network is a conceptual network in Oracle Cloud Infrastructure reserved for Oracle services. These services have public IP addresses that you typically reach over the public internet. However, you can access the Oracle Services Network without the traffic going over the public internet through a service gateway over both IPv4 and IPv6 as long as the service offers IPv6 support.

Each subnet uses the default security list, which has default rules for IPv4 and IPv6 protocols that are designed to make it easy to get started with Oracle Cloud Infrastructure. The rules enable typical required access (for example, inbound SSH connections and any type of outbound connections). The public subnet also has an additional security list to allow HTTPS traffic inbound over IPv6, while the private subnet has an extra security list to allow intra-VCN IPv6 traffic for SQL.

Tip

Security lists are one way to control traffic in and out of the VCN's resources. You can also use Network Security Groups.

The following figure shows a compute instance with public (GUA) and private (ULA) IPv6 addresses in a regional public subnet. The public subnet uses Oracle-GUA prefixes to enable internet accessibility over IPv6 with ULA for intra-VCN communications. In this scenario, the VCN's default route table (which is always empty to start with) is used for the public subnet, which requires only a single IPv6 rule for the internet gateway. It also has an implicit set of route rules that enable the public subnet to route to the private subnet. The subnet has two security lists applied, to allow flexibility in rule management and granular access controls for each subnet. The on-premises administrators must have public IPv6 addresses to communicate with VCN resources over the internet.

The figure also shows a compute instance with ULA IPv6 and IPv4 addresses in a regional private subnet. The private subnet uses IPv6 ULA to privately communicate with the public subnet compute instances and the Oracle Services Network. It also has IPv4 for egress-only OSN and internet connectivity. Similar to the public subnet, the private subnet also has two security lists: the VCN default and another custom security list to allow internal application connectivity across subnets.

Note

Not shown is deployment of redundant instances across several availability domains and fault domains as a recommended best practice.
Compute instance with ULA IPv6 and IPv4 addresses in a regional private subnet
Callout 1: Custom private subnet route table
Destination CIDR Route target
0.0.0.0/0 NAT Gateway
All OSN services in the region Service Gateway
Callout 2: Default public subnet route table
Destination CIDR Route target
::/0 Internet Gateway

Required IAM Policy

To use Oracle Cloud Infrastructure, an administrator must be a member of a group granted security access in a policy by a tenancy administrator. This access is required whether you're using the Console or the REST API with an SDK, CLI, or another tool. If you get a message that you don't have permission or are unauthorized, verify with the tenancy administrator what type of access you have, and which compartment your access works in.

If you're a member of the Administrators group, you already have the required access to implement Scenario D. Otherwise, you need access to Networking, and you need the ability to create instances. See IAM Policies for Networking.

Setting Up Scenario D in the Console

Setup is easy in the Console. Alternatively, you can use the Oracle Cloud Infrastructure API, which lets you implement the individual operations yourself.

Task 1: Create the VCN

  1. On the Virtual cloud networks list page, select Create VCN. If you need help finding the list page, see Listing VCNs.
  2. Enter a descriptive name for the VCN (this is required). It doesn't have to be unique, and it can't be changed later in the Console (but you can change it with the API or CLI). Avoid entering confidential information.
  3. Verify the compartment that you want to create the VCN in. Select another compartment if needed.
  4. In the IPv4 CIDR Blocks section, enter the following information:
    • IPv4 CIDR Blocks (Required) Specify up to five but at least one non-overlapping IPv4 CIDR blocks for the VCN. For example: 172.16.0.0/16. You can add or remove CIDR blocks later. See Allowed VCN Size and Address Ranges. It might be helpful to use a CIDR calculator.
    • Use DNS Hostnames in this VCN This option is required to assign DNS hostnames to hosts in the VCN, and required if you plan to use the VCN's default DNS feature (called the Internet and VCN Resolver). If you select this option you can specify a DNS Label for the VCN, or you can let the Console to generate one for you. The page automatically displays the corresponding DNS domain name for the VCN (<VCN_DNS_label>.oraclevcn.com). For more information, see DNS in a Virtual Cloud Network.
  5. In the IPv6 prefixes section, assign a single Oracle-allocated IPv6 /56 prefix to this VCN or assign a BYOIPv6 prefix. Also, add one ULA prefix to the VCN. For example, assign fd00:aaaa:0123::/56.
    This option is available for all commercial and government regions. For more information on IPv6, see IPv6 Addresses.
  6. (Optional) In the VN Encryption section, select whether to enable or disable encryption of all traffic between Compute instances that can use this feature. See VN Encryption for details on the consequences of enabling or disabling this feature. This feature is only available in the US Government Cloud.
  7. (Optional) In the Tags section, add one or more tags. If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later.
  8. (Optional) In the Show security attributes section, add up to three security attributes to restrict access to resources. If you have permissions to create a resource, then you might also have permissions to add security attributes to that resource. To add a security attribute, you must have permissions to use the security attribute namespace. For more information about security attributes and security attribute namespaces, see Zero Trust Packet Routing. If you're not sure whether to add security attributes, skip this option or ask an administrator. You can add security attributes later.
  9. Select Create VCN.
The VCN is then created and displayed on the Virtual Cloud Networks page in the compartment you chose.

Task 2: Create the public subnet security list

You must create a custom security list to be applied to the public subnet. You can apply it later, after the subnet is created.

For example: For a public subnet with an internet gateway, the (web server) instances you create might need to receive inbound HTTPS connections from the internet. Here's how to create a new security list in your VCN and add a security rule to allow HTTPS traffic from the internet:

  1. Open the details page of the VCN you created. For more information, see Getting a VCN's Details.
  2. Select Security.
  3. Select Create Security List.
    The Create Security List panel opens.
  4. Enter the following information:
    • Name: Enter a friendly name for the list (for example, "public subnet security list"). It doesn't have to be unique, and it can't be changed later in the Console (but you can change it with the API). Avoid entering confidential information.
    • Create in Compartment: Leave the default value (the compartment you're currently working in).
  5. Under Allow Rules for Ingress, select + Another Ingress Rule to permit HTTPS traffic inbound:
    • Stateless: Unselected (this is a stateful rule)
    • Source Type: CIDR
    • Source CIDR: ::/0
    • IP Protocol: TCP
    • Source Port Range: All
    • Destination Port Range: 443
    • Description: An optional description of the rule.
  6. Select Create Security List.
The custom security list for the public subnet is then created and listed in the Security list.

Task 3: Create the private subnet security list

You need to create a custom security list to be applied to the private subnet to permit inbound connections for client connectivity. You can apply it later, after the subnet is created.

For example: A private subnet for hosting a database might require client connections from public subnet clients. Here's how to create a new security list in your VCN and add a security rule to allow SQL traffic from the public subnet:

  1. In the Security Lists page, select Create Security List.
    The Create Security List panel opens.
  2. Enter the following information:
    • Name: Enter a friendly name for the list (for example, "private subnet security list"). It doesn't have to be unique, and it can't be changed later in the Console (but you can change it with the API). Avoid entering confidential information.
    • Create in Compartment: Leave the default value (the compartment you're working in).
  3. Under Allow Rules for Ingress, select + Another Ingress Rule to let SQL traffic inbound:
    • Stateless: Unselected (this is a stateful rule)
    • Source Type: CIDR
    • Source CIDR: IPv6 ULA prefix created in Task 1 step 5, as example fd00:aaaa:0123::/56.
    • IP Protocol: TCP
    • Source Port Range: All
    • Destination Port Range: 1521
    • Description: An optional description of the rule.
  4. Select Create Security List.
The custom security list for the private subnet is created and displayed in the Security list.

Task 4: Create the internet gateway

  1. From the VCN's details page, select Gateways.
  2. Find the Internet Gateways section.
  3. Select Create Internet Gateway.
    The Create Internet Gateway panel opens.
  4. Enter the following information:
    • Name: A friendly name for the internet gateway. It doesn't have to be unique, and it can't be changed later in the Console (but you can change it with the API). Avoid entering confidential information.
    • Create in Compartment: Leave as is.
    • You can select Show advanced options to set the following options:
      • Route Table Association: (Advanced option) Leave as is. You can associate a specific VCN route table with this gateway. After you associate a route table, the gateway must always have a route table associated with it. You can change the rules in the current route table or replace it with another route table.
      • Tags: (Advanced option) Leave as is. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later. For more information about tagging, see Resource Tags.
  5. Select Create Internet Gateway.
The new internet gateway is created and displayed under the Internet Gateways list. The gateway is already enabled, but you must add a route rule that allows traffic to flow to the gateway.

Task 5: Create the NAT gateway

  1. Select Gateways in the VCN's details page.
  2. Find the NAT Gateways section.
  3. Select Create NAT Gateway.
    The Create NAT Gateway panel opens.
  4. Enter the following information:
    • Name: A friendly name for the NAT gateway. It doesn't have to be unique, and it can't be changed later in the Console (but you can change it with the API). Avoid entering confidential information.
    • Create in Compartment: Leave as is.
    • Public IP Address: Select Ephemeral Public IP Address for a random oracle provided public IP.
    • You can select Show advanced options to set the following options:
      • Route Table Association: (Advanced option) Leave as is. You can associate a specific VCN route table with this gateway later. However, after you associate a route table, the gateway must always have a route table associated with it. You can change the rules in the current route table or replace it with another route table.
      • Tags: (Advanced option) Leave as is. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later. For more information about tagging, see Resource Tags.
  5. Select Create NAT Gateway.
The NAT gateway is created and displayed under the NAT Gateways list. The gateway is already enabled, but you must add a route rule that allows traffic to flow to the gateway.

Task 6: Create the service gateway

  1. In the Gateways page, find the Service Gateways section.
  2. Select Create Service Gateway.
    The Create Service Gateway panel opens.
  3. Enter the following information:
    • Name: A friendly name for the service gateway. It doesn't have to be unique, and it can't be changed later in the Console (but you can change it with the API). Avoid entering confidential information.
    • Create in Compartment: Leave as is.
    • Services: Select All Services In Oracle Services Network to access all services. If you just need Object Storage, you can select OCI Object Storage. Note – the service gateway provides access to only the local region’s OSN services.
    • You can select Show advanced options to set the following options:
      • Route Table Association: (Advanced option) Leave as is. You can associate a specific VCN route table with this gateway later. However, after you associate a route table, the gateway must always have a route table associated with it. You can change the rules in the current route table or replace it with another route table.
      • Tags: (Advanced option) Leave as is. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later. For more information about tagging, see Resource Tags.
  4. Select Create Service Gateway.
The service gateway is created and displayed under the Service Gateways list. The gateway is already enabled, but you must add a route rule that allows traffic to flow to the gateway.

Task 7: Create a custom private route table

The private subnet needs its own set of routes, different from the public subnet. To do this, a new route table needs created with rules added. In this case, you need to define routes to the OSN network and internet. The NAT Gateway prohibits traffic from the internet initiating into your private instances but allows them to connect outbound. Lacking any IPv4 or public IPv6 ingress security rules provide the protection to the private subnet itself.

No route rule is required to route traffic within the VCN itself.

  1. Select Routing in the VCN's details page.
  2. Find the Route Tables section.
  3. Select Create Route Table.
    The Create Route Table panel opens.
  4. Enter the following information:
    • Name: A friendly name for the route table (for example, private subnet route table). It doesn't have to be unique, and it can't be changed later in the Console (but you can change it with the API). Avoid entering confidential information.
    • Create in Compartment: Leave as is.
    • Select + Another Route Rule to add a route for the NAT Gateway.
      • Protocol Version: IPv4
      • Target Type: NAT Gateway
      • Destination CIDR block: 0.0.0.0/0 (which means that all traffic from the associated subnets to a destination outside the VCN that's not already covered by other rules in the route table goes to the target specified in this rule).
      • Compartment: The compartment containing the NAT Gateway.
      • Target: The NAT gateway you created.
      • Description: An optional description of the rule.
    • Select + Another Route Rule to add a route for the service gateway.
      • Protocol Version: IPv4. (If your subnet is enabled for IPv6, this creates IPv4, IPv6, or dual-stack routes automatically for you.)
      • Target Type: Service Gateway
      • Destination Service: All Services In Oracle Services Network
      • Compartment: The compartment containing the Service Gateway.
      • Target: The Service Gateway you created.
      • Description: An optional description of the rule.
  5. Select Create
You have created a custom route table with routes. But you still need to apply it to the private subnet once it's created. You do that task later.

Task 8: Update the VCN Default route table

The default route table starts out with no rules. You apply this route table to the public subnet. Here you add a rule that routes all IPv6 traffic destined for addresses outside the VCN to the internet gateway. The existence of this rule also allows inbound connections to come from the internet to the subnet's GUA prefixes, through the internet gateway. You use security list rules to control the types of traffic that are allowed in and out of the instances in the subnet.

No route rule is required to route traffic within the VCN itself.

  1. In the Route Tables section in the Routing page, select the route table named Default Route Table for <vcn_name>.
    Default Route Table for <vcn_name> details page opens.
  2. Select Route Rules.
    The Route Rules page opens.
  3. Select Add Route Rules.
    The Add Route Rules panel opens.
  4. Enter the following information:
    • Protocol Version: IPv6
    • Target Type: Internet Gateway
    • Destination CIDR block: ::/0 (which means that all traffic from the VCN to a destination outside the VCN that's not already covered by other rules in the route table goes to the target specified in this rule).
    • Compartment: The compartment containing the internet gateway.
    • Target: The internet gateway you created.
    • Description: An optional description of the rule.
  5. Select Add Route Rules.
The default route table now has a rule for the internet gateway. When you create the public subnet, you assign it to use this route table.

Task 9: Create the regional public subnet

  1. In the Route Rules page, select the VCN name link at the top of the page that's preceded by the left-pointing arrow.
    The VCN's details page opens.
  2. Select Subnets.
    The Subnets page opens.
  3. Select Create Subnet
    The Create Subnet panel opens.
  4. Enter the following information:
    • Name: A friendly name for the subnet (for example, Regional public subnet). It doesn't have to be unique, and it can't be changed later in the Console (but you can change it with the API). Avoid entering confidential information.
    • Regional or Availability Domain specific: Select Regional (recommended), which means the subnet spans all availability domains in the region. Later when you create an instance, you can create it in any availability domain in the region. For more information, see Availability Domains and VCNs.
    • CIDR blocks and prefixes: Select from the Oracle-allocated IPv6 Prefix list.
      • Subnet prefix: Enter two IPv6 hexadecimal characters in the range of 0-9 and a-f (for example, 00). For more information, see IPv6 Addresses.
    • Select + Another CIDR Block/Prefix.
    • CIDR blocks and prefixes: Select from the ULA IPv6 Prefix list.
      • ULA IPv6 Prefix: Select your preferred IPv6 ULA prefix from the list.
      • Enter two IPv6 hexadecimal characters in the range of 0-9 and a-f (for example, 00). For more information, see IPv6 Addresses.
    • Route Table: Select the default route table.
    • Private or public subnet: Select Public subnet, which means instances in the subnet can optionally have public IP addresses. For more information, see Access to the Internet.
    • Use DNS Hostnames in this Subnet: This option is available only if a DNS label was provided for the VCN when it was created. The option is required for assignment of DNS hostnames to hosts in the subnet, and also when you plan to use the VCN's default DNS feature (called the Internet and VCN Resolver). If you select the checkbox, you can specify a DNS label for the subnet, or let the Console generate one for you. The page automatically displays the corresponding DNS domain name for the subnet as an FQDN. For more information, see DNS in a Virtual Cloud Network.
    • DHCP Options: Select the set of DHCP options to associate with the subnet. If you already enabled compartment selection, first specify the compartment that contains the set of DHCP options.
    • Security Lists:
      • Select the security list that starts with Default Security List. Select + Another Security List.
      • Select the security list created in Step 2, optionally named public subnet security list.
    • Resource Logging: Optional, leave as-is.
    • Show Tagging Options: Select this link to display options for adding tags to the subnet. If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later.
  5. Select Create Subnet.
The subnet is then created and displayed on the Subnets page.

Task 10: Create the regional private subnet

  1. In the Subnets page, select Create Subnet.
    The Create Subnet panel opens.
  2. Enter the following information:
    • Name: A friendly name for the subnet (for example, Regional private subnet). It doesn't have to be unique, and it can't be changed later in the Console (but you can change it with the API). Avoid entering confidential information.
    • Regional or Availability Domain specific: Select Regional (recommended), which means the subnet spans all availability domains in the region. Later when you create an instance, you can create it in any availability domain in the region. For more information, see Availability Domains and VCNs.
    • CIDR blocks and prefixes: Select from the IPv4 CIDR Block list.
      • IPv4 CIDR Block: A single, contiguous CIDR block within the VCN's CIDR block(for example 10.0.0.0/17). You can change the mask value later, but not the network. For reference, here's a CIDR calculator.
    • Select + Another CIDR Block/Prefix.
    • CIDR blocks and prefixes: Select from the ULA IPv6 Prefix list.
      • ULA IPv6 Prefix: Select from the drop down your preferred IPv6 ULA prefix.
      • Enter two IPv6 hexadecimal characters in the range of 0-9 and a-f (for example, 01). For more information, see IPv6 Addresses.
    • Route Table: Select the new route table created in Task 7 named "private subnet route table."
    • Private or public subnet: Select Private subnet, which disallows the use of public IPv4 addresses and internet communication with IPv6 endpoints. For more information, see Public vs. Private Subnets.
    • Use DNS Hostnames in this Subnet: This option is available only if a DNS label was provided for the VCN when it was created. The option is required for assignment of DNS hostnames to hosts in the subnet, and also when you plan to use the VCN's default DNS feature (called the Internet and VCN Resolver). If you select the checkbox, you can specify a DNS label for the subnet, or let the Console generate one for you. The page automatically displays the corresponding DNS domain name for the subnet as an FQDN. For more information, see DNS in a Virtual Cloud Network.
    • DHCP Options: Select the set of DHCP options to associate with the subnet. If you already enabled compartment selection, first specify the compartment that contains the set of DHCP options.
    • Security Lists:
      • Select the security list that starts with Default Security List. Select + Another Security List.
      • Select the security list created in Step 2, optionally named private subnet security list.
    • Resource Logging: Optional, leave as-is.
    • Show Tagging Options: Select this link to display options for adding tags to the subnet. If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later.
  3. Select Create Subnet.
The subnet is created and displayed on the Subnets list.

Task 11: Create instances in separate availability domains

The next step is to create one or more instances in the subnet. The scenario's diagram shows instances in two different subnets. When you create the instance, you select the AD and FD, which VCN and subnet to use, and several other characteristics.

Each instance VNIC can have an automatic or manually assigned IP addresses. For public subnet instances, you must assign IPv6 addresses from the Oracle-GUA prefix to have internet accessibility. We recommend provisioning several instances across several availability domains and fault domains for high availability (Not shown).

After creating an instance in this scenario, you can connect using IPv6 from the internet with SSH. Additionally, you can SSH to the private instance from the public instance or set up Bastion service using IPv4 connectivity. For more instructions on deploying instances, see Creating an Instance. For more information and instructions with Bastions, see Bastion Overview.

Using the API

For information about using the API and signing requests, see REST API documentation and Security Credentials. For information about SDKs, see SDKs and the CLI.

Use the following operations:

  • CreateVcn: Always include a DNS label if you want the VCN to use the VCN Resolver (see DNS in a Virtual Cloud Network).
  • CreateSecurityList: Call it to create the public subnet security list with these rules:
    • Stateful ingress: Source type = CIDR, source ::/0 on TCP, source port = all, destination port = 443 (HTTPS)
  • CreateSecurityList: Call it again to create the private subnet security list with these rules:
    • Stateful ingress: Source type = CIDR, source IPv6 ULA prefix of public subnet on TCP, source port = all, destination port = 1521 (for Oracle databases)
  • CreateInternetGateway
  • CreateNatGateway
  • CreateServiceGateway
  • CreateRouteTable: Call it to create the private subnet route table. To enable IPv4 communication by way of the NAT gateway, add a route rule with destination = 0.0.0.0/0, and destination target = the NAT gateway you created earlier. Also add a route toward OSN Services prefixes.
  • UpdateRouteTable Call it to update the default VCN route table associated with the public subnet. To enable communication by way of the internet gateway, add a route rule with destination = ::/0, and destination target = the internet gateway you created earlier.
  • CreateSubnet: Call it to create regional public subnet. Include a DNS label for the subnet if you want the VCN Resolver to resolve hostnames for VNICs in the subnet. Use the public subnet route table you created earlier. Use both the default security list and the public subnet security list that you created earlier. Use the default set of DHCP options.
  • CreateSubnet: Call it again to create regional private subnet. Include a DNS label for the subnet if you want the VCN Resolver to resolve hostnames for VNICs in the subnet. Use the private subnet route table you created earlier. Use both the default security list and the private subnet security list that you created earlier. Use the default set of DHCP options.
  • First call GetRouteTable to get the private subnet route table. Then call UpdateRouteTable to add a route rule with destination = the on-premises network CIDR (10.0.0.0/16 in this example), and destination target = the DRG you created earlier.
  • LaunchInstance: Launch at least one instance in each subnet. By default, the instances in the public subnets are assigned public IP addresses. For more information, see Creating an Instance.

You can now communicate from your on-premises network with the instances in the public subnet over the internet gateway.