close

DEV Community

Nagesh K
Nagesh K

Posted on

The Beginner’s Guide to Private vs Public IPs, Ex - Banking Systems

When I first studied IP addresses, I thought:
“Private IPs are only inside my router, and public IPs are only for the router itself.”

But that’s not the full story. In real production systems — like a banking website — both public and private IPs exist together. Each has a specific role, and understanding this is the key to mastering AWS networking.

🌍 Why Not Make Everything Public?

Imagine a bank has three servers:
Website Server
Application Server
Database Server

Option 1: Give all three public IPs.
Technically possible, but very dangerous.

Why? Because attackers could directly connect to the database server from anywhere on the internet. That’s exposing the vault to the street.

✅ Better Design: Public + Private Together

Here’s the safer architecture:
Customer

Internet

Website Server (Public IP)

Application Server (Private IP)

Database Server (Private IP)

🪜 Step‑Wise Banking Example

Step 1: Customer Opens Website
You type : **mybank.com
**Your browser reaches the Web Server at:
Public IP = 13.233.10.100
This must be public because customers worldwide need access.

Step 2: Login Request

You enter username + password.
The request hits the Web Server (Public IP).

Step 3: Web Server Needs Data

The web server doesn’t store balances. It calls the Application Server: Private IP = 10.0.2.10
This server is inside the bank’s private network.

Step 4: Application Server Queries Database

The app server asks the Database: Private IP = 10.0.3.20
Database returns: Balance = ₹50,000

Step 5: Response Flow

Database → App Server → Web Server → Customer Browser.
You see: Welcome Nagesh , Balance: ₹50,000

🔒 Why Use Private IP for Database?

Because the database contains:
Passwords
Balances
Transactions
Customer data

We don’t want random internet users scanning or attacking it.
With a private IP, the database is invisible from outside.

👨‍💻 How Do Bank Employees Access Private Systems?

This is the part most beginners get confused about. Employees don’t “log in” directly to a private IP from their laptops. Instead:

Method 1: Inside Bank Network
Employee PCs are already inside the private LAN. Their devices get private IPs (like 10.1.1.50) and can reach the database (10.0.3.20) internally.

Method 2: VPN (Very Common)
Employees working remotely connect via a VPN tunnel.
Their laptop joins the bank’s private network virtually.
Now they can reach private servers safely.

Method 3: Bastion Host (AWS)
In cloud setups, employees first connect to a bastion host (a secure jump server with a public IP). From there, they can access private servers inside the VPC.

🎯 The Most Important Rule

Private IP ≠ Nobody can access it.
Private IP = Cannot be directly reached from the public internet.

Access is possible only if:
You’re inside the private network, or You connect through VPN, bastion host, or secure tunnels.

☁️ AWS Translation

Banking Architecture → AWS Setup:
Internet

Load Balancer (Public IP)

EC2 Web Server (Public IP)

EC2 App Server (Private IP)

RDS Database (Private IP)

🚀 Final Reflection

At first, I thought public vs private IPs were just about routers and home devices. But now I see:
Public IPs are for systems that must be reachable from the internet.
Private IPs are for internal systems that should only communicate within trusted networks.
This banking example makes it crystal clear — and it’s the same principle AWS VPCs, subnets, NAT gateways, and security groups are built on.

Top comments (1)

Collapse
 
krupali_gadhiya profile image
Krupali Gadhiya

Thanks for sharing this. I found the section about machine learning particularly useful for beginners.