In Oracle Cloud Infrastructure (OCI), routing is very important. It controls how data (network traffic) moves from one place to another. This helps systems communicate with each other, the internet, and other networks.
The main component used for routing in OCI is called a route table. A route table is used inside a Virtual Cloud Network (VCN).
What is a Route Table?
A route table is a list of rules. These rules tell the system where to send traffic.
Each rule has two main parts:
Destination CIDR block – This shows the IP address range where the traffic wants to go
Route target – This shows the next location (next hop) where the traffic should go
You can think of a route table like a map or GPS. It tells the data which path to take.

Routing Inside a VCN
Inside a VCN, there can be multiple subnets, such as:
Public subnet
Private subnet
If systems are inside the same VCN, they can communicate easily. OCI automatically handles this using internal routing.
This means:
No need to create route rules
No need to configure anything for this communication
For example, a server in a public subnet can talk to a server in a private subnet without using a route table.
Example: Traffic from a Private Subnet
Let's understand this with a simple example.
Imagine you have a database server inside a private subnet. This server needs to communicate with two places:
1. Accessing the Internet (Using NAT Gateway)
A private server cannot directly connect to the internet. But sometimes it needs to download updates or patches.
To do this, it uses a NAT Gateway.
A route rule will look like this:
Destination:
0.0.0.0/0(this means all internet traffic)Target: NAT Gateway
This rule tells the system:
"If the traffic is going anywhere on the internet, send it through the NAT Gateway."
2. Connecting to On-Premises Network (Using DRG)
Sometimes, the server needs to connect to systems in a company's local data center (on-premises). For example, it may need to use a DNS server.
This connection is done using a Dynamic Routing Gateway (DRG).
A route rule will look like this:
Destination: On-premises network (for example
10.0.0.0/16)Target: DRG
This rule tells the system:
"If the traffic is going to the company network, send it through the DRG."
How OCI Chooses the Correct Route
Sometimes there are multiple route rules. So how does OCI choose the correct one?
OCI uses something called:
Longest Prefix Match
This means:
The most specific route is selected
A CIDR block with more bits (like
/16) is more specific than/0
Example:
10.0.0.0/16→ more specific0.0.0.0/0→ less specific
So:
Traffic to
10.x.x.xgoes to DRGAll other traffic goes to NAT Gateway
This helps ensure that traffic goes to the correct destination.

VCN Peering (Connecting Multiple Networks)
Sometimes, one VCN is not enough. You may have multiple VCNs that need to communicate.
There are two main ways to connect them:
1. Local Peering (Same Region)
Used when VCNs are in the same OCI region
Uses a Local Peering Gateway (LPG)
This allows fast and secure communication between networks in the same location.

2. Remote Peering (Different Regions)
Used when VCNs are in different regions
Uses a Dynamic Routing Gateway (DRG)
This allows communication between networks in different data centers.

Handling Many VCNs (Scaling Problem)
In real-world environments, companies may have many VCNs.
For example:
10 VCNs
50 VCNs
Even 300 VCNs
Connecting each VCN one by one becomes very difficult and complex.
Solution: DRG Version 2 (DRG v2)
OCI introduced DRG v2 to solve this problem.
Features of DRG v2:
Connect many VCNs to one DRG
Supports up to 300 VCNs
Reduces the need for many direct connections
Makes network design simpler and easier to manage
If more connections are needed, multiple DRGs can be connected using remote peering.
Conclusion
OCI routing is used to manage how traffic flows in the cloud. It helps systems communicate with:
Other subnets inside the VCN
The internet (using NAT Gateway)
On-premises networks (using DRG)
Other VCNs (using peering)
Route tables play a very important role by defining rules for traffic flow. Features like NAT Gateway, DRG, and DRG v2 help make the system flexible, secure, and scalable.

Join the conversation! Your thoughts help the community grow.