Oracle Cloud Infrastructure Documentation

Scenario C: Public and Private Subnets with a VPN

This topic explains how to set up Scenario C, which consists of a virtual cloud network (VCN) with a public subnet, an internet gateway, a private subnet, and an IPSec VPN. See the following figure. For more information, see Typical Networking Scenarios.

This image shows Scenario C: a VCN with both public and private subnets, an Internet Gateway, and a VPN IPSec connection.

Tip

The scenarios uses an IPSec VPN for connectivity; however, you could instead use Oracle Cloud Infrastructure FastConnect.

Prerequisites

To set up the VPN in this scenario, you need to get the following information from a network administrator:

  • IP address of the on-premises router at your end of the VPN
  • Static routes for your on-premises network

You will provide Oracle this information and in return receive the information your network administrator needs in order to configure the on-premises router at your end of the VPN.

Required IAM Policy

To use Oracle Cloud Infrastructure, you must be given the required type of access in a An IAM document that specifies who has what type of access to your resources. It is used in different ways: to mean an individual statement written in the policy language; to mean a collection of statements in a single, named "policy" document (which has an Oracle Cloud ID (OCID) assigned to it); and to mean the overall body of policies your organization uses to control access to resources. written by an administrator, whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you try to perform an action and get a message that you don’t have permission or are unauthorized, confirm with your administrator the type of access you've been granted and which A collection of related resources that can be accessed only by certain groups that have been given permission by an administrator in your organization. you should work in.

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

Setting Up Scenario C

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

Warning

Avoid entering confidential information when assigning descriptions, tags, or friendly names to your cloud resources through the Oracle Cloud Infrastructure Console, API, or CLI.

Important

Most of this process involves working with the Console or API (whichever you choose) for a short period to set up the desired Networking components. But there's also a critical step that requires a network administrator in your organization to take information you receive from setting up the components and use it to configure the on-premises router at your end of the VPN. Therefore you can't complete this process in one short session. You'll need to break for an unknown period of time while the network administrator completes the configuration and then return afterward to confirm communication with your instances over the VPN.

Using the Console

To create the cloud network and subnets
To add a VPN to your cloud network
To configure your on-premises router

Using the API

For information about using the API and signing requests, see REST APIs and Security Credentials. For information about SDKs, see Software Development Kits and Command Line Interface.

Use the following operations:

  1. CreateVcn: Make sure to include a DNS label if you want the VCN to use the VCN Resolver (see DNS in Your Virtual Cloud Network).
  2. CreateInternetGateway
  3. CreateRouteTable: Call it twice, once to create the Public Subnet Route Table and once to create the Private Subnet Route Table. To enable communication via the internet gateway, include this route: 0.0.0.0/0 > internet gateway.
  4. First call GetSecurityList to get the default security list, and then call UpdateSecurityList:

    • Change the existing stateful ingress rules to use your on-premises network's CIDR as the source CIDR, instead of 0.0.0.0/0.
    • If you plan to launch Windows instances, add this stateful ingress rule: Source type = CIDR, source CIDR = your on-premises network on TCP, source port = all, destination port = 3389 (for RDP).
  5. CreateSecurityList: Call it to create the Public Subnet Security List with these rules:

    • Stateful ingress: Source type = CIDR, source 0.0.0.0/0 on TCP, source port = all, destination port = 80 (HTTP)
    • Stateful ingress: Source type = CIDR, source 0.0.0.0/0 on TCP, source port = all, destination port = 443 (HTTPS)
    • Stateful egress: Destination type = CIDR, destination CIDR blocks of private subnets on TCP, source port = all, destination port = 1521 (for Oracle databases)
  6. CreateSecurityList: Call it again to create the Private Subnet Security List with these rules:

    • Stateful ingress: Source type = CIDR, source CIDR blocks of public subnets on TCP, source port = all, destination port = 1521 (for Oracle databases)
    • Stateful ingress: Source type = CIDR, source CIDR blocks of private subnets on TCP, source port = all, destination port = 1521 (for Oracle databases)
    • Stateful egress: Destination type = CIDR, destination CIDR blocks of private subnets on TCP, source port = all, destination port = 1521 (for Oracle databases)
  7. CreateSubnet: Call it four times, once each for Public Subnet 1 and Private Subnet 1 in the first availability domain, and then once each for Public Subnet 2 and Private Subnet 2 in a second availability domain. For the two private subnets, set the flag to prohibit public IP addresses on the VNICs in the subnet. Include a DNS label for each subnet if you want the VCN Resolver to resolve hostnames for VNICs in the subnet. For the public subnets, make sure to specify both the default security list and the Public Subnet Security List that you created earlier. Likewise, for the private subnets, make sure to specify both the default security list and the Private Subnet Security List that you created earlier. Use the default set of DHCP options.
  8. CreateDrg: This creates a new dynamic routing gateway (DRG).
  9. CreateDrgAttachment: This attaches the DRG to the VCN.
  10. CreateCpe: Here you'll provide the IP address of the router at your end of the VPN (see Prerequisites).
  11. CreateIPSecConnection: Here you'll provide the static routes for your on-premises network (see Prerequisites). In return, you'll receive the configuration information your network administrator needs in order to configure your router. If you need that information later, you can get it with GetIPSecConnectionDeviceConfig. For more information about the configuration, see Configuring Your CPE.
  12. UpdateRouteTable: To enable communication via the VPN, update the Private Subnet Route Table to include this route: 0.0.0.0/0 > dynamic routing gateway.
  13. LaunchInstance: Launch at least one instance in each subnet. By default, the instances in the public subnets will be assigned public IP addresses. For more information, see Launching an Instance.

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

Important

Although you can launch instances into the private subnets, you won't be able to communicate with them from your on-premises network until your network administrator configures your on-premises router (see Configuring Your CPE). After that, your IPSec connection should be up and running. You can confirm its status by using GetIPSecConnectionDeviceStatus. You can also confirm the IPSec connection is up by pinging the instances from your on-premises network.