A Domain by
Any Other Name...
Don’t let DNS get you into a BIND; read on to sort out port 53.
In this article, I cover DNS, arguably
the most “Rube Goldberg” of all
services. (Well, except for Sendmail, but
that’s really just one application, not
an entire service.) DNS (Domain Name
Services) quite simply maps domain
names to IP addresses. For some reason,
it’s easier for humans to remember
words than strings of numbers, so
rather than remembering 12. 34. 56. 78,
we remember www.linuxjournal.com.
Using DNS instead of remembering
IP addresses not only helps prove
Linux users aren’t really cyborgs, it
also allows some pretty cool magic in
the server department. Instead of one
server per Web site, a single server with
a single IP address can host multiple
Web sites. Unfortunately, the way DNS
works on a global scale means it’s not
without its faults and frustrations. G.I.
Joe always said, “knowing is half the
battle”, so in this article, I walk you
through being a knowledgeable DNS
user, without ever delving into the
50 / SEPTEMBER 2012 / WWW.LINUXJOURNAL.COM
complexities of the underlying system.
For most Linux distributions, you configure
“how” the computer looks up URLs by
setting the options in /etc/ nsswitch.conf.
If you look at your nsswitch.conf file,
you’ll probably find the line:
hosts: files dns
This line tells the computer that before
it asks its DNS server for the IP address,
it should look into its /etc/hosts file for a
domain mapping. By default, there probably
is a line defining the localhost address
and possibly an entry defining whatever
hostname and IP you set for the computer.
This file has the following format:
IP Address Domain Name