In Oracle Cloud Infrastructure (OCI), a subnet is a subdivision of a Virtual Cloud Network (VCN). It provides a range of IP addresses and defines the networking boundaries for your OCI resources like compute instances, databases, load balancers, etc.
🔹 Key Concepts of a Subnet in OCI:
Feature | Description |
---|---|
Part of VCN | Subnet resides inside a Virtual Cloud Network. |
CIDR Block | Subnet has its own CIDR block (e.g., 10.0.1.0/24 ), a subset of the VCN CIDR. |
Availability Domain (AD) | Subnet can be AD-specific (regional subnets are also available). |
Public or Private | You must specify whether the subnet is public or private: - Public Subnet: Allows access to/from the internet using Internet Gateway. - Private Subnet: No direct internet access; can use NAT Gateway or Service Gateway. |
Security Controls | Associated with Route Tables, Security Lists, and optionally Network Security Groups (NSGs). |
🔸 Subnet Use Case Example:
Imagine a VCN 10.0.0.0/16
, and you define:
-
A public subnet
10.0.1.0/24
– for a bastion host or load balancer. -
A private subnet
10.0.2.0/24
– for backend application servers or databases.
🔸 Diagram:
VCN: 10.0.0.0/16
├── Public Subnet: 10.0.1.0/24 (Internet Gateway)
│ └── Compute Instance (Bastion Host)
│
└── Private Subnet: 10.0.2.0/24 (NAT Gateway / Service Gateway)
└── Compute Instance (App Server)
🔹 Common Route Table Setup:
Destination CIDR | Target |
---|---|
0.0.0.0/0 | Internet Gateway (for public subnet) |
0.0.0.0/0 | NAT Gateway (for private subnet outbound access) |
OCI Services CIDR | Service Gateway (to access Oracle services privately) |
🔹 What Is a Route Table?
A Route Table contains a set of Route Rules that tell traffic where to go — for example, whether it should stay within the VCN, go to the internet, to another VCN via a Dynamic Routing Gateway (DRG), or to Oracle Services via a Service Gateway.
Each subnet in a VCN is associated with exactly one route table, which governs the routing behavior for resources in that subnet.
🔸 Key Components:
Component | Description |
---|---|
Route Table | A collection of route rules associated with a subnet. |
Route Rule | Each rule defines the destination CIDR block and the target to which the traffic should go. |
Target Types | Can be Internet Gateway, NAT Gateway, DRG, Local Peering Gateway (LPG), Service Gateway, etc. |
🔹 Common Targets in Route Rules:
Destination CIDR | Target Gateway | Purpose |
---|---|---|
0.0.0.0/0 | Internet Gateway | For outbound internet access from public subnets. |
0.0.0.0/0 | NAT Gateway | For private subnets to access the internet outbound only. |
All Oracle Services CIDR | Service Gateway | Private access to Oracle services like Object Storage. |
Another VCN CIDR | DRG | To route traffic to on-prem or other VCNs via VPN / FastConnect. |
Peered VCN CIDR | LPG | To route traffic to another VCN in the same region using Local Peering. |
🔸 Example Route Table:
For a private subnet:
Route Table:
- 0.0.0.0/0 → NAT Gateway (for outbound internet)
- 10.0.0.0/16 → local (within the VCN)
- 192.168.0.0/16 → DRG (for on-prem communication)
For a public subnet:
Route Table:
- 0.0.0.0/0 → Internet Gateway (for full internet access)
🔹 Summary:
-
Attached to subnet.
-
Directs traffic based on destination CIDRs.
-
Targets can be gateways depending on use case (public internet, private access, peering, etc.).
No comments:
Post a Comment