Oops, I accidentally the whole DNS

Here is my confession, internet: I am writing a cat DNS. That is, a DNS server that resolves everything to cats. You want your email? Cat! You want to check the weather? Cat! It’s always cat.

Wait why?

We were talking at work about DNSes, and it turns out I only hand wavingly know how they work. I also like things that troll you. The reason why this post is about what I’m doing and not about what I’ve done, is because my server isn’t done yet. Let me try to explain.

DNS: How do it do it?

You know how DNS works. You give a server a human readable hostname, like www.google.com, and it gives you back the IP address (like 74.125.226.113) where the thing you are looking for actually lives. Here’s pretty much how it goes.

Finally, this is mostly a lie, as in real life all of these recursive servers that you hit first do a lot of caching. Imagine doing this 4+ step dance every time someone typed www.google.com in their browser. IMAGINE.

Cat DNS is technically a recursive caching name server (because it’s the first one you hit), a root one, and an authoritative one, mostly authoritative about cats. Cat DNS knows everything: it’s cats. Cats, cats, cats. This also means it should be super simple to implement.

Some code deets

Things communicate with DNS servers over UDP on port 53. A couple of things:

So

Tune in next week for results on how this actually worked in practice, once I actually get around to writing dem codes.