Here's a preview from my zine, How DNS Works! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
panel 1:
In an internal network (like in a company or school), sometimes you can connect to a machine by just typing its name, like this:
$ ping labcomputer-23
Let’s talk about how that works!
many DNS lookup functions support “local” domain names
browser, represented by a box with a smiley face: where’s lab23?
function, represented by a rectangle with squiggly lines: where’s lab23.degrassi.ca?
arrow pointing to resolver (server) represented by a box with a smiley face holding a magnifying glass
(the function appends a base domain degrassi.ca
to the end)
the base domain is called a “search domain”
On Linux, search domains are configured in /etc/resolv.conf
Example:
search degrassi.ca
this tells getaddrinfo
to turn lab23
into lab23.degrassi.ca
getaddrinfo doesn’t always use search domains
It uses an option called ndots to decide.
search degrassi.ca
options ndots:5
this means “only use search domains if the domain name contains less than 5 dots”
search domains can make DNS queries slower
browser: where’s jvns.ca
?
getaddrinfo, represented by a rectangle with squiggly lines: okay, first I’ll try jvns.ca.degrassi.ca
this is silly but it can happen!
avoid search domains by putting a “.” at the end
Use http://jvns.ca.
instead of http://jvns.ca
Illustration of a smiling stick figure with curly hair.
person: “local” domain names like this mostly exist inside of big institutions like universities
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!