A small collection of Python scripts I wrote while studying for the CompTIA Network+ certification. Instead of just memorizing concepts from the exam objectives (DNS resolution, subnetting, IP fragmentation, etc.), I implemented them in code so I'd actually understand the mechanics underneath.
These aren't production tools — they're learning artifacts. They show how I approach studying: when a topic clicks better by building it, I build it.
All scripts live in scripts/.
A DNS resolver with a TTL-aware in-memory cache. Performs a forward lookup using dnspython, prints the returned TTL, caches the result until expiry, and serves subsequent requests from cache while showing the remaining TTL. Demonstrates how recursive resolvers actually behave — TTL isn't just trivia, it dictates cache lifetime.
python scripts/dns_lookup.py example.com AMinimal reverse DNS (PTR) lookup. Takes an IP, builds the in-addr.arpa name via dns.reversename, and resolves the PTR record to a hostname.
A unified CLI that handles both forward (A, AAAA, MX, NS, TXT, …) and reverse (PTR) lookups in a single tool. Picks the right resolver path based on the record type argument.
python scripts/dns_tool.py 8.8.8.8 PTR
python scripts/dns_tool.py example.com MXSimulates IPv4 fragmentation. Given a payload and an MTU, it accounts for the 20-byte IP header and splits the data into MTU-sized fragments — the same logic a router applies when a packet exceeds the link MTU. Useful for visualizing why MTU mismatches and fragmentation overhead matter.
An implementation of the "seven-second subnetting" method using bitwise math. Given an IP and CIDR, it computes:
- the subnet mask (
0xffffffff << (32 - cidr)) - the network ID (
ip & mask) - the broadcast address (
ip | ~mask)
Writing this out forced me to internalize why the shortcut method works rather than just memorizing the table.
- I learn by building. Reading about subnet math is one thing; writing the bit-shifts yourself is another.
- Concepts, not just commands. Each script targets a specific Network+ objective (DNS, TTLs, fragmentation/MTU, subnetting) and reproduces it from first principles.
- Comfortable across the stack. Even at a junior level, I'm reaching for libraries (
dnspython), CLI argument handling, caching with expiry, and bitwise operations — not just runningnslookupand calling it studied.
pip install dnspythonPython 3.x. Tested on Windows during the coursework.
Archived study material from my Network+ prep. Kept public because the implementations are a fair sample of how I think through networking fundamentals.