Remix.run Logo
DNS Explained – How Domain Names Get Resolved(bhusalmanish.com.np)
75 points by okchildhood 3 days ago | 19 comments
jedberg 10 minutes ago | parent | next [-]

The biggest issue with DNS is not the protocol, or even the reference implementation. It's the people who think they are clever and try to make things better by making them worse.

The most egregious of course is ISPs rewriting TTLs (or resolvers that just ignore them). But there are other implementation issues too, like caching things that shouldn't be or doing it wrong. I've seen resolvers that cache a CNAME and the A record it resolves to with the TTL of the CNAME (which is wrong).

I'm also very concerned about the "WHY DNS MATTERS FOR SYSTEM DESIGN" section. While everything there is correct enough, it doesn't dive into the implication of each and how things go wrong.

For example, using DNS for round robin balancing is an awful idea in practice. Because Comcast will cache one IP of three, and all of a sudden 60% of your traffic is going to one IP. Similar issue with regional IPs. There are so many ways for the wrong IP to get into a cache.

There is a reason we say "it's always DNS".

soneil 2 hours ago | parent | prev | next [-]

I have to admit - I still grind my teeth every time I see "dns propagation" used without a direct follow-up that it's a myth, you're looking at cascading cache expiry.

Propagation might be a useful way to visualise it, but doesn't match reality unless every cache is a warm cache.

bityard 2 hours ago | parent [-]

Yes! The idea of DNS records "propagating" gave me entirely the wrong mental model of DNS very early in my career. Granted, the confusion didn't last long because I read the cricket book soon after, but it was still pretty jarring.

mbreese 2 hours ago | parent | prev | next [-]

This is not a bad overview of DNS from a theoretical perspective. It’s also pretty well written and has good examples and figures.

What I think is missing is a bit more of the “in practice” side. If the author was surprised about TTL values, I doubt they have much experience with some of the other pitfalls, so I’m not surprised (not a knock on the author). But there is a reason why the phrase “It’s always DNS” exists.

As an example, it could be helpful to mention that ISP DNS resolvers (or any caching resolver in the path) could decide to ignore the TTL. In this case, your 360 sec TTL might not get updated for an hour or a day or longer. This can be infuriating to troubleshoot.

A section on troubleshooting might also be beneficial. But this mainly consists of checking results from different resolvers in your path - does it work with a local resolver? Your ISPs DNS? The authoritative server?

pastage 4 hours ago | parent | prev | next [-]

> DNS broke my site for three hours. But now I actually understand it

I have been broken for three decades and I still don't understand DNS. It is a simple protocol but people use it in complicated manners.

stevekemp 5 hours ago | parent | prev | next [-]

Only oddity was the reference to the "router cache". I agree if your browser tried to lookup example.com the local cache would be used, but then it would be the system's configured DNS server - and that would most likely be an ISP, rather than your local router.

(Assuming a typical home connection, your router is _probably_ not a DNS server with local cache, it probably is a DHCP server which will hand out the upstream/ISPs' nameservers.)

jdsnape 5 hours ago | parent | next [-]

I think this is probably quite dependent on what’s normal for ISPs in the region. In the UK for example, every ISP router I’ve had runs a DNS server and it’s that which is given out via DHCP. It then forwards onto the ISPs DNS platform.

stevekemp an hour ago | parent [-]

In Scotland I was with Telewest, then Virgin, and my memory is always that the DHCP pushed out the external IP of the ISP's DNS servers.

Nowadays I'm in Finland and definitely the router runs no DNS service, the DHCP service advertises the ISP resolvers.

Probably depends on the region/ISP I guess, but I had no expectation that it would be the more common option.

stackskipton 25 minutes ago | parent [-]

American here, most of ISPs here do it as well. With modern router hardware, there is plenty of hardware available to run tiny DNS server that caches and forwards all requests to ISP upstream. Memory overhead is probably about 50MB and CPU overhead is trivial, probably .1% or less.

RegnisGnaw 3 hours ago | parent | prev | next [-]

My parents are with Bell (the biggest ISP in Canada) and use the Bell Gigahub (Router/AP/Switch in one). It does have a DNS cache and the its set as the DNS resolver in their DHCP configuration.

whalesalad 27 minutes ago | parent | prev | next [-]

I would argue the contrary - most home routers are running a DNS server of some kind. They forward to upstream, but will resolve local names like your printer and whatnot.

dnsmasq is the defacto tool on these embedded devices for dhcp+dns. probably a billion deployments. it's up there with sqlite for most used tech.

direwolf20 4 hours ago | parent | prev [-]

The system's configured DNS resolver is usually your router.

tallanvor 3 hours ago | parent | prev | next [-]

Honestly, I guess it's a fine article for someone who isn't very technical, but it provides very little real detail, and this wasn't an example of DNS breaking anything - it worked as designed.

The biggest pain of DNS for most people is if someone has set the TTL to an absurdly large number, or if a resolver isn't respecting TTL. And once you get into advanced configurations, SOAs and delegation certainly create their own headaches!

biglyburrito 3 days ago | parent | prev | next [-]

This might be the easiest-to-understand breakdown of DNS that I've seen to date. I've owned a domain since the late 90s, but never really understood everything the acronyms or concepts involved in making it work. Well done!

okchildhood 3 days ago | parent [-]

Thanks! That was exactly what I was going for - making DNS approachable for everyone, not just sysadmins. Glad it helped!

synthBirba 3 days ago | parent | prev | next [-]

Well written! Is so easy to understand and read that I can easily share it even with non-tech people c:

okchildhood 3 days ago | parent [-]

Appreciate it! That's the goal - tech concepts shouldn't need a CS degree to understand.

giuliomagnifico 3 days ago | parent | prev [-]

Well written article!

okchildhood 3 days ago | parent [-]

Glad you liked it. Thank you