35:OCI:NW ‐ Create Internet Gateway and attach is to Public subnet using custom route table - pavankumarchittajallu/OCI_DOC GitHub Wiki

step-by-step process to create an Internet Gateway in Oracle Cloud Infrastructure (OCI)

and attach it to a Public subnet using a custom route table:

Step-by-Step Process

1. Create an Internet Gateway (IGW)

  • Navigate to the Networking section in the OCI Console.
  • Open your Virtual Cloud Network (VCN).
  • Under the “Gateways” menu, go to Internet Gateways.
  • Click Create Internet Gateway.
    • Enter a friendly name.
  • Choose the appropriate compartment.
  • Click Create Internet Gateway. Your IGW is now attached to this VCN but not yet in use by any subnet.

2. Create/Identify the Route Table

  • Still within your VCN, click on Routing tab.
  • For good practice and better management, create a new custom route table for your public subnet, or identify the one you want to use.
    • Click Create Route Table or use an existing one.
    • Give it a descriptive name.

3. Add a Route Rule to the Route Table

  • In the chosen custom route table, click Add Route Rules.
  • Enter the following for the route rule:
    • Destination CIDR Block: 0.0.0.0/0 (routes all outbound traffic to the internet)
    • Target Type: Internet Gateway
    • Target Internet Gateway: Select the IGW you just created.
  • Click Add Route Rule to save it.

4. Attach Route Table to Public Subnet

  • In VCN's menu, click Subnets.
  • Click on your public subnet.
  • Click Edit.
  • Change/Set the associated route table to your new (or desired) custom route table.
  • Save changes.

5. Configure Security Rules (if needed)

  • Make sure the security list or network security group (NSG) associated with your public subnet has the necessary ingress (e.g., TCP/22 for SSH, HTTP/80, HTTPS/443) and egress rules to allow internet access.
  • If you use the default security list, review default rules and add custom ones if required.

Summary Table

Task Where to Do It Key Setting or Action
Create Internet Gateway VCN > Internet Gateways Name, Compartment, Enable
Create/Choose Custom Route Table VCN > Route Tables Name, (optional: Description)
Add Route Rule for IGW Selected Route Table Dest: 0.0.0.0/0 → Target: IGW
Attach Route Table to Public Subnet VCN > Subnets > [Subnet Name] Set Route Table to Custom Table
Set Security Rules for Subnet VCN > Security Lists/NSGs Ingress/Egress for required ports