π Networking Basics for Cloud & DevOps β Part 2: Public vs Private IP, NAT, Ports, and More

π In Part 1 of our Networking series we learned the fundamentals of IP addresses, Subnetting, and CIDR notation.
Now, letβs take a step further into cloud networking concepts that every beginner in Cloud, DevOps, and Docker must know.
Most students and professionals get confused about IP types, NAT, gateways, and ports β so in this blog, weβll break everything down with simple explanations and examples.
πΉ 1. Public vs Private IP
π Private IP
Used inside local/private networks.
Not routable on the internet.
Common ranges:
10.0.0.0 β 10.255.255.255
172.16.0.0 β 172.31.255.255
192.168.0.0 β 192.168.255.255
π‘ Example:
Your home Wi-Fi router assigns devices IPs like
192.168.1.10
.These can only communicate within your local network unless translated by NAT.
π Public IP
Globally unique IP, used to access resources on the internet.
Assigned by Internet Service Providers (ISP) or Cloud Providers (AWS, Azure, GCP).
π‘ Example:
- If your VM in Azure has Public IP
20.50.100.25
, you can SSH into it from anywhere in the world.
πΉ 2. Static vs Dynamic IP
Dynamic IP (Default): Assigned automatically by DHCP. May change if VM restarts.
Static IP: Reserved and fixed. Useful for databases, DNS servers, or load balancers.
π‘ Example in Azure:
A VM by default gets a Dynamic private IP.
You can change it to Static to avoid IP changes when restarting.
πΉ 3. NAT (Network Address Translation)
NAT allows devices with Private IPs to connect to the internet using a Public IP.
It hides internal IPs for security.
π‘ Example:
Laptop:
192.168.1.10
β NAT Gateway β Public IP49.205.120.15
β Google.comGoogle only sees the public IP, not your private one.
π In cloud:
- Azure NAT Gateway or AWS NAT Gateway is used for private VMs that need internet access.
πΉ 4. VPC / VNet Basics
VPC (Virtual Private Cloud β AWS) or VNet (Virtual Network β Azure) = A virtual private network in the cloud.
You can divide it into subnets (smaller networks).
π‘ Example:
VPC CIDR:
10.0.0.0/16
Public Subnet:
10.0.1.0/24
β Internet accessPrivate Subnet:
10.0.2.0/24
β Internal only
π In DevOps, you often deploy Jenkins, Databases, or K8s clusters inside VNets/VPCs.
πΉ 5. Default Gateway & Routing
A Gateway connects your subnet to another network (like internet).
Usually, the first IP in a subnet is reserved as the Gateway.
π‘ Example:
Subnet:
192.168.1.0/24
Gateway:
192.168.1.1
Devices in subnet send external traffic to this gateway.
πΉ 6. Ports & Protocols (TCP vs UDP)
π TCP (Transmission Control Protocol)
Reliable, connection-based.
Ensures data reaches destination correctly.
Used for web traffic, SSH, email.
π UDP (User Datagram Protocol)
Faster, connectionless.
No error-checking, often used in streaming/gaming.
π‘ Common Ports in DevOps/Cloud:
22 β SSH (secure login to servers)
80 β HTTP (websites)
443 β HTTPS (secure websites)
1433 β SQL Server
3306 β MySQL
53 β DNS
πΉ 7. Practical Cloud Example
Imagine you deploy a VM in Azure:
Private IP:
10.0.0.5
(inside VNet, accessible only internally)Public IP:
20.50.100.25
(accessible from internet)NAT Gateway: Translates
10.0.0.5
β20.50.100.25
for outbound trafficPort 22 (SSH): Open in NSG (firewall) so you can log in remotely
Same in AWS:
Inside VPC β VM gets
172.31.20.15
(private).Attach Elastic IP β VM gets
52.15.220.55
(static public).
π― Interview Questions & Answers
Q1. Difference between Public and Private IP?
π Private IP works only within internal networks, Public IP is globally routable on internet.
Q2. What is NAT and why is it used?
π NAT converts Private IPs into Public IPs for internet access and hides internal IPs for security.
Q3. Static vs Dynamic IP in Cloud?
π Dynamic = default, may change; Static = reserved, does not change.
Q4. What is VPC/VNet?
π A logically isolated private network in the cloud where you can create subnets.
Q5. Difference between TCP and UDP?
π TCP = reliable, connection-oriented. UDP = faster, connectionless.
Q6. What is a Gateway?
π A gateway is the router connecting subnet to another network (e.g., internet).
Q7. Which ports are commonly used in DevOps setups?
π 22 (SSH), 80 (HTTP), 443 (HTTPS), 3306 (MySQL), 53 (DNS).
π Wrapping Up
In this Networking Part 2 blog, we covered:
β Public vs Private IP
β Static vs Dynamic IP
β NAT & its role in cloud
β VPC/VNet basics
β Gateway & routing
β TCP vs UDP with common ports
π With this, you now understand how cloud networking actually works.
In the next blog, weβll connect these concepts with Docker Networking to see how containers talk to each other and the outside world.
π In case you missed it, check out Networking Part 1 where we explained IP addresses, subnetting, and CIDR with examples.
Subscribe to my newsletter
Read articles from Harshal Sonar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
