How to modify ingress and egress rule for OCI instance
Published July 30, 2025, 5:40 a.m. by cloudblog
To modify ingress and egress rules for an OCI (Oracle Cloud Infrastructure) instance, typically need to update the Network Security Group (NSG) or Security List associated with the subnet or instance. Here's a step-by-step guide for both options:
🔹 Option 1: Using Security Lists (for subnet-level rules)
📍 Step 1: Navigate to VCN
-
Log in to the OCI Console.
-
Go to Networking > Virtual Cloud Networks.
-
Choose your VCN.
-
Click on the Subnet where your instance resides.
📍 Step 2: Open Security List
-
In the subnet details, scroll to Security Lists.
-
Click on the security list (default or custom one).
📍 Step 3: Modify Rules
-
To add an ingress rule (incoming traffic):
-
Click Add Ingress Rules.
-
Define:
-
Source Type: CIDR or Security Group
-
Source CIDR (e.g.,
0.0.0.0/0
for open access) -
Protocol (e.g., TCP)
-
Destination Port Range (e.g.,
22
for SSH) -
Optional: Description
-
-
Click Add Ingress Rules.
-
-
To add an egress rule (outgoing traffic):
-
Click Add Egress Rules.
-
Define:
-
Destination Type: CIDR or Security Group
-
Destination CIDR (e.g.,
0.0.0.0/0
) -
Protocol (e.g., TCP)
-
Destination Port Range
-
Optional: Description
-
-
Click Add Egress Rules.
-
🔹 Option 2: Using Network Security Groups (NSG)
If instance is using NSGs (more fine-grained, instance-level rules):
📍 Step 1: Go to Compute > Instances
-
Navigate to your instance details.
-
Click on the Attached VNIC.
-
Note the NSG attached to the VNIC.
📍 Step 2: Modify NSG Rules
-
Go to Networking > Network Security Groups.
-
Select the NSG linked to your instance.
-
Under Security Rules, click Add Ingress Rule or Add Egress Rule.
-
Fill in:
-
Direction: Ingress / Egress
-
Protocol: e.g., TCP
-
Source/Destination CIDR
-
Port Range
-
Optional: Description
-
-
Click Add Security Rule.
✅ Example: Allow SSH Access (Port 22)
-
Source CIDR:
0.0.0.0/0
(open to all, not recommended for production) -
Protocol: TCP
-
Port Range: 22
-
Add this as an Ingress rule.
🛡️ Tips:
-
Use NSGs for more granular, instance-level security.
-
Always follow least privilege principle: restrict access to known IPs.
-
May need to open ports in the OS firewall (like
firewalld
orufw
) too.
Similar posts
How to login OCI with different tenancy
Comment 1 by vijomtxffi Aug. 6, 2025, 2:58 a.m.
gsmunsmxytspkskijrhtitinviexqs