DNS, DHCP & HTTP/HTTPS Protocols
Every time you open a website, three core protocols fire in order: DHCP gives your device an IP, DNS translates the domain name, and HTTP/HTTPS fetches the page securely.
The 3-Protocol Journey
Sequence: DHCP leases an IP & DNS server โ DNS resolves the domain โ HTTPS/TLS 1.3 loads the web page.
01 DNS Record Types & CLI Lookup
DNS is the internet's phonebook (Port 53 UDP for normal queries, TCP for large responses
& zone transfers). Each record type stores a different kind of answer.
| Type | Purpose | Example Value | When You Use It |
|---|---|---|---|
A |
Domain โ IPv4 address | 93.184.216.34 |
Pointing a domain/subdomain to an IPv4 server |
AAAA |
Domain โ IPv6 address | 2606:2800:220:1:... |
Dual-stack / IPv6 web hosting |
CNAME |
Alias โ another domain name | www โ example.com |
Subdomains pointing to CDNs, SaaS, or load balancers |
MX |
Mail Exchange server + priority | 10 mail.example.com |
Routing incoming email (lower number = higher priority) |
TXT |
Arbitrary text strings | "v=spf1 include:..." |
Domain ownership verification, SPF, DKIM, DMARC |
NS |
Authoritative Name Servers | ns1.cloudflare.com |
Delegates which DNS provider controls the zone |
PTR |
Reverse DNS (IP โ Domain) | 1.1.1.1 โ one.one.one.one |
Email anti-spam checks & traceroute hostnames |
SRV |
Service location (host + port) | _sip._tcp โ 5060 sip.ex.com |
Active Directory, VoIP/SIP, Minecraft, XMPP |
DNS Troubleshooting Commands
dig example.com A +short
Linux / macOS
dig @1.1.1.1 example.com MX
Linux / macOS
1.1.1.1) directly for mail records.dig -x 8.8.8.8 +short
Linux / macOS
dns.google.).nslookup -type=TXT example.com
Windows / Cross-Platform
02 DHCP DORA & Lease Renewal
DHCP automatically leases an IP address, subnet mask, default gateway, and DNS server to a client over UDP Port 67 (server) and UDP Port 68 (client).
| Step | Message | Direction | Delivery | What Happens |
|---|---|---|---|---|
| 1. D | DHCPDISCOVER |
Client โ Network | Broadcast | Client has 0.0.0.0 and shouts to 255.255.255.255: "Any
DHCP servers out there?" |
| 2. O | DHCPOFFER |
Server โ Client | Unicast / Bcast | Server reserves an IP (e.g., 192.168.1.50) and offers it with a lease
time. |
| 3. R | DHCPREQUEST |
Client โ Network | Broadcast | Client accepts one offer (broadcast so any other DHCP servers know to release their offers). |
| 4. A | DHCPACK |
Server โ Client | Unicast / Bcast | Server confirms the lease; client configures its NIC with IP, Mask, Gateway & DNS. |
DHCPREQUEST directly to the original server.DHCPREQUEST to any available DHCP server.DHCP Client Commands
sudo dhclient -r && sudo dhclient
Linux (ISC dhclient)
ipconfig /release && ipconfig /renew
Windows CMD / PowerShell
03 HTTP Methods & Status Codes
HTTP runs over TCP Port 80 (plaintext) or 443 (HTTPS/TLS). Methods define
what action the client wants; status codes tell you what happened.
| Method | Action (CRUD) | Safe? | Idempotent? | Example Use |
|---|---|---|---|---|
GET |
Read | Yes | Yes | Fetch a web page or /api/users list |
POST |
Create | No | No | Submit a login form or create a new order |
PUT |
Replace | No | Yes | Overwrite an entire resource at /api/users/42 |
PATCH |
Partial Update | No | No* | Update only the email field of user 42 |
DELETE |
Delete | No | Yes | Remove /api/users/42 |
Status Code Cheat Sheet
| Range | Key Codes | Meaning |
|---|---|---|
| 2xx Success | 200 OK, 201 Created, 204 No Content |
Request succeeded. 204 is common after DELETE. |
| 3xx Redirect | 301 Moved Perm, 302 Found, 304 Not Modified
|
Go elsewhere (e.g., HTTP โ HTTPS), or use cached copy (304). |
| 4xx Client Error | 400 Bad Req, 401 Unauth, 403 Forbidden,
404 Not Found, 429 Too Many Req |
Your request has a problem (missing auth, bad URL, rate-limited). |
| 5xx Server Error | 500 Internal, 502 Bad Gateway, 503 Unavail,
504 GW Timeout |
The server or upstream proxy (Nginx/ALB) crashed or timed out. |
HTTP Inspection with curl
curl -i https://example.com
Linux / macOS / Win 10+
-I (uppercase) for headers only, or
-iL to follow 301/302 redirects.curl -i -X POST -H "Content-Type: application/json" -d '{"ping":true}' https://httpbin.org/post
Cross-Platform
04 TLS 1.3 & HTTPS Handshake
TLS 1.3 (RFC 8446) cut the HTTPS handshake down to 1 Round-Trip Time (1-RTT)โtwice as fast as TLS 1.2โand removed weak legacy ciphers (no RSA key transport, no CBC, no SHA-1).
GET / immediatelyIn TLS 1.2, the client waited to hear from the server before sending its
key exchange (2-RTT). In TLS 1.3, the client guesses the key-exchange
algorithm (usually X25519) in ClientHello, so encrypted HTTP data flows after just
one round tripโand every session uses ephemeral keys (Perfect Forward Secrecy).
05 Danger Zone: Protocol Pitfalls
TTL Too High Before a Migration: If your
A record has a TTL of 86400 (24 hours), users will
still hit your old server for a full day after you switch IPs. Lower TTL to
300 (5 min) at least 24 hours before migrating.
http:// script, CSS,
or image inside an https:// page causes browsers to block the asset and show
"Not Secure" warnings. Always use https:// or protocol-safe relative paths.
CNAME on the Zone Apex (@):
Standard DNS forbids a CNAME at the root domain (example.com)
because it collides with NS and MX recordsโbreaking your email!
Use an A record or provider-specific ALIAS/ANAME.