Note:

Use NAT Gateway to allow Oracle Cloud Infrastructure Instances to Access the Internet

Introduction

By default RFC1918 IPv4 addresses cannot be routed to the internet and to reach the internet the private RFC1918 address needs to be translated to a public IP address. Within Oracle Cloud Infrastructure (OCI) we can do this using a Network Address Translation (NAT) gateway inside the corresponding virtual cloud networks (VCNs). This tutorial will explain how internet access is provided from an instance connected to a subnet using a private RFC1918 IPv4 address.

image

We will create a new compute instance connected to a private subnet. By default an instance connected to a private subnet is not able to reach the internet, so we will create a NAT gateway and route all traffic to that NAT gateway so that compute instance will be able to reach the internet.

image

Objectives

Task 1: Create a New VCN

Note: If there is an already existing VCN, you can skip this task and continue with Task 2.

Task 2: Create a Private Subnet inside the VCN

Task 3: Create a New Instance

Task 4: Create a Private Network Definition

Create a private network definition so that we can log in to the instance using OCI Cloud Shell.

Task 5: Verify Internet Connectivity on the Instance

Task 6: Create a NAT Gateway and Route the Internet Traffic to the NAT Gateway

We can now access the internet with an instance that is connected to a private subnet with a RFC1981 IPv4 address.

Acknowledgments

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.