Back to Blog
Securing Your OCI Network: Practical Best Practices for Every Deployment

Securing Your OCI Network: Practical Best Practices for Every Deployment

   Mariusz Antonik    Networking    3 min read    513 views

1. Introduction

In this guide, I’ll show you how to secure your Oracle Cloud network with the same approach I use in production customer environments. OCI offers enterprise-grade networking features—if configured properly.

Security starts with the network. And in OCI, that means controlling access with VCNs, subnets, security lists, NSGs, IAM, gateways, and monitoring.


2. What Problem This Solves

Most tenants are exposed because:

  • 0.0.0.0/0 is allowed everywhere

  • Unnecessary public IPs

  • No segmentation between app and DB layers

  • No egress control

  • No flow logs or monitoring enabled

  • IAM policies too broad

This guide eliminates those risks.


3. Step-by-Step Guide

Step 1 — Lock Down SSH

Never allow:

 
source: 0.0.0.0/0 port: 22

Instead use:

  • your office IP

  • VPN

  • Bastion service


Step 2 — Replace Security Lists with NSGs

Network Security Groups allow instance-level control, not subnet-level.

Create NSG:

 
oci network nsg create \ --compartment-id <comp> \ --vcn-id <vcn> \ --display-name web-nsg

Add ingress rule:

 
oci network nsg rules add \ --network-security-group-id <nsg> \ --ingress-rules '[{"protocol":"6","source":"0.0.0.0/0","tcpOptions":{"destinationPortRange":{"min":443,"max":443}}}]'

Step 3 — Use Private Subnets Everywhere

Public subnet = only for:

  • Load balancers

  • Bastion host (if not using OCI Bastion)

App and DB should ALWAYS be private.


Step 4 — Enable VCN Flow Logs

 
oci logging log create \ --display-name vcn-flow \ --log-group-id <group> \ --source-service "flowlogs"

Use for:

  • blocked traffic troubleshooting

  • security audits


Step 5 — Configure IAM the Right Way

Never assign Administrators group to developers.

Follow least privilege:

  • network admins → manage virtual-network-family

  • db admins → manage database-family

  • devs → manage instance-family

Example policy:

 
Allow group DevOps to manage instance-family in compartment Dev

4. Architecture Diagram

 
Internet │ ┌───────────────────────┐ │ Public LB (NSG:443) │ └───────────────────────┘ │ ─────────────────┼────────────────────── Private App Subnet ┌─────────────────────────┐ │ App Servers (NSG:80) │ └─────────────────────────┘ │ ─────────────────┼────────────────────── Private DB Subnet ┌────────────────────────┐ │ MySQL / ATP (Port 3306)│ └────────────────────────┘ │ Service Gateway

5. Best Practices

  • Use NSGs per tier: web, app, db

  • Use Vault for secrets, not environment variables

  • Disable unused protocols (ICMP, UDP)

  • Use IPSec VPN or FastConnect for enterprise workloads

  • Add alarms (port scans, unusual traffic)


6. Common Errors / Troubleshooting

Problem Cause Resolution
App can't reach DB NSG blocking Add DB port in NSG
Slow traffic Wrong MTU Set MTU 1500 or test jumbo frames
Outbound internet blocked Missing NAT route Fix route table
Policy denied Wrong IAM Update group policy

7. Summary

Security is not a feature—it’s a discipline. By applying OCI’s VCN, NSG, IAM, and logging tools correctly, you build a hardened cloud environment that minimizes attack surface and maximizes reliability.

👉 Download your free guide:
7 OCI Networking Mistakes to Avoid

https://dmcloudarchitect.com/c/7_oci_mistakes_to_avoid.html

About the Author
Mariusz Antonik

Oracle Cloud Infrastructure expert and consultant specializing in database management and automation.

All Tags
#Advanced #alerts #Bash #bash cpu monitoring script #bash monitoring #bash scripting #Beginner #Best Practices #block volume backup #Capacity Planning #cloud backup strategy #cpu bottleneck #CPU Monitoring #cpu monitoring linux #cpu monitoring script linux #cpu trends #cpu usage trends #cpu usage trends linux #create oracle db system in oci #cron cpu monitoring #cron cpu monitoring linux #cron jobs #database monitoring #database performance #detect slow queries mysql #devops #disk capacity planning server #disk forecasting linux #Disk Monitoring #disk usage #disk usage script linux #disk usage trends #Early Detection #easy infrastructure monitoring #free-tier #Guide #health dashboards #Health Reporting #historical server monitoring #how to monitor cpu usage linux #infrastructure #infrastructure health #infrastructure health dashboard #infrastructure health reporting #infrastructure monitoring #infrastructure monitoring report #infrastructure trends monitoring #Infrastructure Visibility #lightweight linux monitoring #lightweight monitoring #linux #linux administration #linux cpu monitoring #linux cpu usage #linux disk capacity planning #linux disk usage #Linux monitoring #linux monitoring setup #linux monitoring tools #linux performance #linux performance monitoring #linux server #linux server monitoring #linux servers #linux storage #linux tools #low maintenance monitoring #monitor cpu usage over time linux #monitor linux server health #monitor server trends #monitor small production server #monitoring without complexity #MySQL #mysql health reporting #MySQL monitoring #mysql optimization #MySQL Performance #mysql performance degradation #mysql performance monitoring #mysql performance trends #mysql query performance issues #mysql server monitoring #mysql slow queries #mysql slow query analysis #mysql slow query monitoring #mysql trends #mysql-health #networking #nsg #OCI #oci backup #oci bastion tutorial #oci block volume #oci infrastructure as code #OCI monitoring #oci networking #oci oracle database private subnet setup #oci oracle database tutorial #oci security #oci setup guide #oci terraform tutorial #oci tutorial for beginners #oci vcn terraform #oci virtual machine db system guide #oracle base database service tutorial #oracle cloud bastion #oracle cloud free tier tutorial #oracle cloud infrastructure step by step #oracle cloud infrastructure tutorial #oracle cloud storage #oracle database on oci setup #oracle-cloud #Performance #Performance Degradation #performance monitoring #performance trend monitoring #performance trends #plan disk growth server #practical server monitoring #predict disk usage growth #private instance access #query optimization #Security #security lists #server health #server health reporting #server health weekly report #server monitoring #Server Performance #server trend analysis #server-trends #simple cpu monitoring linux #simple linux monitoring #simple monitoring small business #simple monitoring system #simple ops monitoring #slow queries #slow query reporting mysql #small business infrastructure #small business IT #small business servers #small infrastructure monitoring #small server monitoring #ssh bastion #storage capacity planning linux #storage monitoring #subnets #system health reporting #terraform oci compute #terraform oracle cloud infrastructure #Trend Monitoring #trends #Tutorial #vcn