DevOps

Ports & DNS

Ports

A port number is an addressing mechanism that identifies which application or service on a host machine should receive the data. IP gets data to the right machine; port gets it to the right program.

Types of Ports

TypeRangeDescription
Well-known Ports0 – 1023Reserved for standard services
Registered Ports1024 – 49151Assigned to applications
Ephemeral / Private49152 – 65535Dynamically assigned to client sessions

Common Port Numbers DevOps Engineers Must Know

PortProtocolService
22TCPSSH
25TCPSMTP (email)
53UDP/TCPDNS
80TCPHTTP
443TCPHTTPS
3306TCPMySQL
5432TCPPostgreSQL
6379TCPRedis
8080TCPCommon app/proxy port
2379TCPetcd (used by Kubernetes)
6443TCPKubernetes API server

DNS — Domain Name System

The DNS is a massive, distributed database that maps human-readable domain names to IP addresses.

Without DNS, you would need to type 142.250.191.46 instead of google.com.

DNS Resolution Flow

You type: google.com


Browser checks local cache
    │ (not found)

OS checks /etc/hosts file
    │ (not found)

Query sent to Recursive Resolver (your ISP or 8.8.8.8)


Recursive Resolver checks its cache
    │ (not found)

Query to Root DNS Server (knows where .com lives)


Query to TLD Server (.com nameserver)


Query to Authoritative DNS Server (knows google.com)


Returns IP address → Browser connects

DNS Record Types

RecordPurposeExample
AMaps domain to IPv4 addressgoogle.com → 142.250.191.46
AAAAMaps domain to IPv6 addressgoogle.com → 2607:f8b0:...
CNAMEAlias — one domain points to anotherwww → google.com
MXMail server for the domainmail.google.com
TXTArbitrary text (used for verification, SPF)"v=spf1 include:..."
NSNameservers responsible for the domainns1.google.com
PTRReverse DNS — IP to domain name142.250.191.46 → google.com

TTL (Time to Live)

Each DNS record has a TTL — how long (in seconds) resolvers should cache it. Lower TTL = faster propagation during changes (useful during deployments), but more DNS queries.