Ports & Protocols
In the Indian Postal System, every post office has different counters: one for speed post, one for registered letters, one for parcels, and one for money orders. Each counter serves a specific purpose, even though they all belong to the same post office.
Similarly, in networking, a single device (like a post office) can run multiple services at once. Each service is identified by a port number, and the rules for communication are defined by protocols.
Core Concepts
- Ports
- A port is a logical endpoint for communication.
- Just like postal counters, ports separate services on the same device.
- Examples:
- Port 80 → HTTP (ordinary letters).
- Port 443 → HTTPS (speed post with encryption).
- Port 22 → SSH (secure registered post).
- Port 25 → SMTP (mail dispatch counter).
- Protocols
- Protocols are the rules of service delivery.
- Examples:
- TCP (Transmission Control Protocol) → Reliable delivery, acknowledgment (like speed post with tracking).
- UDP (User Datagram Protocol) → Fast but no guarantee (like ordinary post without tracking).
- HTTP/HTTPS → Web communication (letters with standard formats).
- DNS → Resolves names to addresses (postal directory lookup).
- Well-Known Ports
- Range: 0–1023 → Reserved for common services.
- Example: HTTP (80), HTTPS (443), FTP (21).
- Ephemeral Ports
- Temporary ports used by clients during communication.
- Like temporary service tokens issued at a postal counter.
Hands‑On Exercise
DNS Lookup
nslookup google.com
Observe how DNS resolves a name into an IP address like finding the right PIN code in the postal directory.
Test a Port Connection
nc -zv google.com 80
nc -zv google.com 443
Check if HTTP/HTTPS counters are open at Google’s “post office.”
Check Open Ports
netstat -tuln # Linux
netstat -ano # Windows
See which services (counters) are active on your system.
Real‑World Relevance
- Web servers: Run multiple services (HTTP, HTTPS, SSH) on different ports.
- Cloud networking: Security groups and firewalls filter traffic by port numbers, just like postal counters with restricted services.
- Troubleshooting: Closed ports = counter shut down; misconfigured protocols = wrong delivery rules.
The Hackers Notebook
Ports are the postal counters of networking, and protocols are the rules of service delivery. Together, they ensure that packets (letters) reach the right service at the right destination, just like letters reaching the correct counter in an Indian post office.
