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:
You can think of a route table like a map or GPS. It tells the data which path to take.
![Screenshot_9]()
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:
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:
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:
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:
Example:
So:
This helps ensure that traffic goes to the correct destination.
![Screenshot_10]()
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)
This allows fast and secure communication between networks in the same location.
![Screenshot_11]()
2. Remote Peering (Different Regions)
This allows communication between networks in different data centers.
![Screenshot_12]()
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.