← Back to Home
🌐

IP Addresses & Ports

How the network finds the right machine, and the right program on it.

⏱10 min readπŸ“šDevOps Fundamentals

To deliver a message, the network needs two things: which machine (the IP address) and which program on that machine (the port). Get these two ideas and a huge amount of networking suddenly makes sense.


🎯 Learning Objectives

By the end of this lesson you will:


IP Addresses β€” the Machine’s Location

An IP address is the address of a device on a network, like a street address for a house.

The most common form, IPv4, looks like 192.168.1.10 β€” four numbers (0–255) separated by dots.

Private vs Public

Type Reachable from Example ranges
Private Only inside your local network 10.x.x.x, 172.16–31.x.x, 192.168.x.x
Public Anywhere on the internet Anything not in the private ranges

πŸ’‘ Why this matters in the cloud

Inside a cloud VPC, servers usually talk to each other over private IPs. Only a load balancer or gateway gets a public IP. This is the foundation of a secure network design.


Ports β€” the Program’s Door

One machine runs many programs at once β€” a web server, a database, an SSH service. A port (a number from 0–65535) tells the network which program should receive the message.

An address plus a port is called a socket: 192.168.1.10:443.

Common ports to memorise

Port Service
22 SSH
80 HTTP
443 HTTPS
53 DNS
3306 MySQL
5432 PostgreSQL
6379 Redis

⚠ Firewalls block ports

If your app β€œwon’t connect,” a closed port in a firewall or cloud security group is one of the most common causes. Always check: is the port open, and is the service actually listening on it?


TCP vs UDP

Both live at the Transport layer, but they make different promises:

TCP UDP
Reliable? Yes β€” confirms delivery, resends lost data No β€” fire and forget
Ordered? Yes No
Speed Slightly slower (more checks) Faster, lighter
Used for Web, SSH, databases DNS, video calls, gaming, metrics

πŸ’‘ Rule of thumb

Use TCP when every byte must arrive correctly (a web page, a bank transaction). Use UDP when speed matters more than perfection (a live video frame that’s already out of date if it’s late).


See It Yourself

Check which ports are listening on your machine:

bash
ss -tulnp        # show listening TCP/UDP ports (Linux)
curl -v http://localhost:80   # connect to a program on port 80
bash β€” 80Γ—24
student@devops:~$ss -tuln | grep LISTEN

Here SSH (22) and a web server (80) accept connections from anywhere, while PostgreSQL (5432) only listens on 127.0.0.1 β€” localhost only. That’s a deliberate security choice.


πŸ§ͺ Hands-on Lab

πŸ“

Map the Ports on Your Machine

  1. List all listening ports
  2. Identify which service each open port belongs to
  3. Note which ones are bound to 127.0.0.1 (local only) vs 0.0.0.0 (all interfaces)

🧠 Knowledge Check

Knowledge Check

What does a port number identify?

Knowledge Check

Which protocol would you choose for a live video call where speed matters more than perfect delivery?


πŸ’Ό Interview Preparation

Interview Q&A

A user reports they can't reach your service. How do you approach it?


Summary

You now understand IP addresses (which machine), ports (which program), private vs public addressing, and the TCP/UDP trade-off. Next, we’ll see how human-friendly names like google.com turn into IP addresses using DNS.

Up Next

DNS β€” How Names Become Addresses

You've mastered this lesson. Continue your journey to becoming a DevOps Engineer.

Start Next Lesson→