Networking โ€ข Quick Reference

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.

โฑ๏ธ 9 min ref๐ŸŸข Beginner๐Ÿ“… Updated: Nov 2026

The 3-Protocol Journey

๐Ÿ’ป New Device 0.0.0.0 โ†’ IP Joins Wi-Fi / LAN UDP 67/68 ๐Ÿท๏ธ 1. DHCP DORA IP + Mask + GW + DNS Server IP UDP 53 ๐Ÿ“– 2. DNS Lookup shekharit.com โ†’ 104.21.x.x (A) TCP 443 ๐Ÿ”’ 3. HTTPS (TLS) GET /index.html 200 OK (Encrypted)

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
Clean IPv4 lookup
Returns only the IP address(es) without verbose header clutter.
dig @1.1.1.1 example.com MX Linux / macOS
Query a specific DNS resolver
Bypasses your local router/ISP cache by asking Cloudflare (1.1.1.1) directly for mail records.
dig -x 8.8.8.8 +short Linux / macOS
Reverse DNS (PTR) lookup
Finds the hostname registered to an IP address (dns.google.).
nslookup -type=TXT example.com Windows / Cross-Platform
Inspect TXT records (SPF/DMARC)
Works out-of-the-box on Windows CMD/PowerShell and Linux.

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.
T1 Timer (50% of Lease)
Unicast Renewal
At half-life (e.g., 12h of a 24h lease), client sends a quiet unicast DHCPREQUEST directly to the original server.
T2 Timer (87.5% of Lease)
Broadcast Rebinding
If T1 failed, at 87.5% (21h of 24h) client broadcasts DHCPREQUEST to any available DHCP server.

DHCP Client Commands

sudo dhclient -r && sudo dhclient Linux (ISC dhclient)
Release & request a fresh DHCP lease
Forces a full DORA cycle to pick up new DNS or IP settings.
ipconfig /release && ipconfig /renew Windows CMD / PowerShell
Release & renew IPv4 lease on Windows
Drops the current IP and triggers a fresh DHCPDISCOVER.

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+
Show HTTP status + response headers + body
Use -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
Send a JSON POST request
Tests REST APIs and prints the full HTTP status line and headers.

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).

Flight 1 (Client โ†’ Server)ClientHelloSends TLS 1.3 support + Key Share right away
Flight 2 (Server โ†’ Client)ServerHello + CertSends server Key Share, Cert, & Finished
Flight 3 (Encrypted)Finished + HTTPClient verifies cert & sends GET / immediately
๐Ÿง  TLS 1.3 Memory Trick: 1-RTT + Forward Secrecy

In 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

โš ๏ธ Common Outages & Security Mistakes
1. Plugging in a Rogue DHCP Server: Connecting a second home router (with DHCP enabled) into an office LAN hands out wrong gateways/IPs to coworkers, taking down the network. Enable DHCP Snooping on managed switches.
2. Leaving DNS 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.
3. HTTP โ†’ HTTPS Mixed Content: Loading an 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.
4. Putting a 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.