Note:

Configure Per-resource Routing in Oracle Cloud Infrastructure

Introduction

Per-resource Routing refers to the ability to define routing rules directly on a specific VNIC or an individual IP address associated with that Virtual Network Interface Card (VNIC). This offers enhanced routing control tailored to each resource in a single subnet, in case they have different requirements, rather than relying solely on the subnet-level route table. This allows organizations to optimize network traffic and ensure better performance by routing data to the appropriate destination resource based on the source.

With Per-resource Routing, Oracle Cloud Infrastructure (OCI) users can configure routing policies that apply to individual resources, ensuring that traffic is directed in a way that optimally supports the application architecture. It enhances network control, making it easier to manage complex cloud environments. This method of routing helps in improving traffic flow by defining how traffic should be routed to specific resources.

Objectives

In this tutorial, we will provide a comprehensive understanding of Per-resource Routing within OCI.

image

Prerequisites

Note: Each example is prepared independently from the other. You can work on them in any order.

Example 1: Inspect Internet Traffic for only one Virtual Machine (VM) through OCI Network Firewall

Example Objectives:

In this example, we focus on routing the outbound Internet traffic of one specific VM through an OCI Network Firewall to inspect and secure it before it reaches the NAT gateway, and bypass firewall for the second VM in the same subnet. Without Per-resource Routing, you will have to place each instance in a different subnet in order to achieve this scenario.

image

Example Prerequisites:

Configure some essential components to align with this design. It is basically two compute instances in a private subnet, in addition to a network firewall in a separate subnet in the same VCN.

image

Task 1: Prepare OCI Network Firewall to Inspect Traffic from Linux-VM-2 to Internet

Task 1.1: Set up Firewall Subnet Routing and Security

In this task, we have created and assigned a subnet-level route table, meaning that all resources deployed within this subnet will be governed by the defined routing rules.

Task 1.2: Create and Assign NAT Gateway Route Table

Task 1.3: Enable Firewall Logs and Check the Policy

Note: In this tutorial, we use OCI Network Firewall, but you can replicate the same scenario with any third-party firewall.

Task 2: Create Custom Route Tables

Task 3: Assign Custom Route Tables to the VNICs

Task 4: Test and Validate

Example 2: Separate Internet Traffic from Oracle Services Network only Traffic

Example Objectives:

In this example, we will demonstrate how two resources within the same subnet can be configured with different routes, directing traffic to the Oracle services network and the Internet through separate gateways. Linux-VM-1 requires access only to the Oracle services network especially OCI Object Storage without routing through the public Internet, restricted to Oracle Jeddah data center, whereas Linux-VM-2 requires outbound Internet access, that means access to any public IP address, including those within the Oracle services network. Without Per-resource Routing, you will have to place each instance in a different subnet in order to achieve this scenario.

image

Example Prerequisites:

Configure some essential components to align with this design. It is basically two compute instances in a private subnet.

image

Task 1: Create Custom Route Tables

Task 2: Assign Custom Route Tables to the VNICs

Task 3: Create an OCI Object Storage Bucket

An OCI Object Storage bucket is a logical container used to store and organize objects (files and data) in OCI.

Task 4: Test and Validate

Task 4.1: Prepare the VMs to have access to Oracle Services Network

Task 4.2: Test Linux-VM-1 to Oracle Services Network Access

Task 4.3: Test Linux-VM-2 to Internet Access

Conclusion

With two in-depth technical examples, this tutorial showcased how Per-resource Routing in OCI provides precise control over network traffic by allowing custom route tables to be applied directly to individual VNICs within the same subnet. It also highlighted the key differences between Per-resource Routing and traditional subnet-level route tables, emphasizing the flexibility and efficiency this feature brings to modern cloud network design.

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.