DNS for IT Girls - How the Internet Works Like Magic
By Tatiana Mikhaleva · Developer Advocate · Docker Captain · IBM Champion
Hey, tech queens! 👩💻💖
So let’s talk DNS. It’s the secret behind why you get to type google.com instead of some long, impossible-to-remember number. DNS is what makes the internet easy and user-friendly. And once it clicks for you? You’ll feel like a total networking goddess. 👑💡
What is DNS?
DNS (Domain Name System) is basically the translator of the internet. It takes human-friendly domain names (web.yourcompany.net) and turns them into machine-readable IP addresses.
Think of your phone contacts. You don’t memorize numbers, you just tap a name. DNS pulls the same trick, except for websites.
Without it? You’d be typing 10.0.0.25 every time you wanted facebook.com. Not cute. 😅
The Hosts File: The Old-School Hack
Way back before DNS, people mapped names to IPs by hand, in the /etc/hosts file. Yeah, ancient times. 😂 But here’s the fun part. That trick still works today, and you can use it to override your machine’s DNS settings whenever you feel like it.
Pro Tip: Manually Map Names to IPs
Say you’ve got a database server sitting at 10.0.0.5, and you’d rather reach it by typing database. Drop this single line into your /etc/hosts file:
10.0.0.5 databaseDone. Now every ping database you run connects straight to 10.0.0.5, and DNS doesn’t even get a vote. #HackTheNetwork 😏💻
Enter the DNS Server!
Managing hostnames by hand gets messy, fast. That’s the whole reason DNS servers exist. They keep everything in one place, so instead of babysitting a giant hosts file, your system just asks a DNS server for the right IP.
Picture your company’s internal DNS server living at 10.10.10.1. Your laptop pings it any time it needs to resolve a hostname. And if that server has no clue? It forwards the request up the chain until somebody knows the right IP.
Pro Tip: Set a Custom DNS Server
Want to tell your system exactly where to look? Update the /etc/resolv.conf file like so:
nameserver 10.10.10.1And just like that, all DNS requests head to 10.10.10.1 first. 🎯
Subdomains: The DNS Name Tree
Ever notice we have maps.yourcompany.net, mail.yourcompany.net, and drive.yourcompany.net? Those are subdomains, darling. They keep all the different services inside a company or website neat and organized. 🌍✨
Here’s what a company setup might look like:
- web.yourcompany.net → Main website
- db.yourcompany.net → Database server
- mail.yourcompany.net → Email services
When someone types one of those names, DNS makes sure they land on the correct servers. It’s the road sign system of the internet! 🚦
DNS Caching: How the Internet Gets Faster
Every time you load a website, your system tucks away the DNS result, so it never has to ask twice. That’s caching. It makes everything snappier 🚄. The catch? It can trip you up when an IP changes underneath you.
How to Clear Your DNS Cache
Website acting weird and refusing to load? Flushing the DNS cache often fixes it.
🖥️ On Windows:
ipconfig /flushdns💻 On Mac/Linux:
sudo systemd-resolve --flush-cachesNow your system goes and grabs fresh DNS info instead of clinging to stale data. 🔥
Public vs Private DNS: Who Controls the Internet?
When your DNS server doesn’t know the answer, it passes the question along to public DNS servers. The big ones:
✅ Google DNS → 8.8.8.8
✅ Cloudflare DNS → 1.1.1.1
✅ OpenDNS → 208.67.222.222
But inside company networks? Private DNS servers run the show, and they keep things locked down. Because if you work at yourcompany.net, the last thing you want is random strangers resolving your internal servers. 🚨
Recap: DNS is the GPS of the Internet!
So now you’ve got it. DNS is the backbone of the web. It translates names into IPs, sorts out your subdomains, caches results so everything flies, and lets you override settings when needed.
Quick Cheat Sheet:
✅ /etc/hosts → Manually map names to IPs
✅ /etc/resolv.conf → Set your preferred DNS server
✅ ping, nslookup, dig → DNS troubleshooting tools
✅ ipconfig /flushdns → Clear DNS cache (Windows)
✅ systemd-resolve —flush-caches → Clear DNS cache (Linux/Mac)
And that makes you an official DNS queen. 👑💻 So tell me, sis, have you ever messed around with your own DNS settings? Let’s chat in the comments! 💬✨