DNS

DNS or the Domain Name Service is a distributed database of sorts.  It typically allows different servers to retain information about their own domain including the servers in the domain (like web servers, email servers, etc), where to send email for the domain (or it's subdomains), and other globally accessible data.  It's also been used as a mechanism to authorize IPs for sending email (in SPF) or as a means to look up IPs/domains for RBL type listings.  Since these are "fringe" type usages, we'll stick to the former usage.

Before DNS, each computer had a local "hosts" file that it used to turn host names that could be easily remembered by humans into IP addresses, which were used by the computer to route and connect to the server.  As more and more networks became interconnected and therefore more and more servers had to be listed in the hosts file, it became unfeasible to download these files on a reasonable schedule, and the issue of centralization became an issue as well.

Out of this need, DNS was born.  Instead of querying your local hosts file when you wanted to find the IP of the website you wanted to view, you would query the "root name servers" to find out which server actually handled DNS for that domain.  Once you knew which server to ask for specific data, you could query that server and it would tell you what IP the hostname resolved to.

The above instance describes record type "A" lookups, but there are so many more.  MX records, SPF records, PTR records and SOA records are all common requirements of DNS, and these only outline email related lookups.  Here are a quick breakdown of the different record types above and what they do for you.

SOA records
These are the "Start of Authority" records.  These records are where you'll find the domain's zone file, they are the master DNS servers for the domain you're asking about.

A records
Address records simply translate the hostname you're querying for (i.e. www.theemailauthority.com for example) into the IP address so your computer can understand them and route the packets to the correct host.

MX records
Mail eXchanger records define where to send email to for your domain.  Originally, email addresses were literally "user@server", but as the internet expanded it became harder and harder to know what exact server your user was on.  MX records allow you to send to user@domain.com instead, which changes much less frequently.

PTR records
PoinTeR records are the inverse of Address records.  Instead of turning a hostname into an IP, they give a name to the IP.  This is often helpful to determine ownership of the IP, and is commonly used in email to give a name to the connecting IP address.  PTR record lookups are commonly referred to as "reverse DNS", but this name is foolish as the DNS query behaves exactly the same.  If you commonly send a MySQL database a query to find the ID associated to an email address, you wouldn't call a query to find the email address associated to an ID a "reverse MySQL query".  Neither should you describe a PTR looup as "reverse DNS".  It's a "PTR Lookup" plain and simple.

SPF (TXT) records
In their infinite wisdom, the creators of DNS realized that they wouldn't be able to think of all the uses DNS might have later on, so they created TXT record types.  TXT records are commonly used for SPF records as SPF (Sender Policy Framework) is a relatively new standard.  SPF allows you to specify servers that are authorized to send email for your domain.  This help prevent "spoofing" where an attacker pretends to be from an email address they are not the owners of.  It also helps prevent "backscatter" which are bounces generated byt the unauthorized use of your email address.

And there you have it.  Using these basic queries you can completely understand the route of an email through the internet.  While there will be some routing that happens on the local networks before and after most DNS is finished, many issues can be resolved by thinking through DNS and all of the consequences.


-TEA