Understanding DNS

Understanding DNS

I'm of the opinion that the more you know about how something works the more opportunity you have to get the most out of it. Thats why I think its important for internet marketers to understand things like DNS, HTTP Requests, Web Hooks, etc.

More...

While I agree that if I'm a truck driver I don't need to understand the physics of combustion, in order to drive my truck. I would argue though that it would probably come in pretty handy to know the theory behind how an engine works and how certain features operates. Before we get into it I want to take a bit of time and define some terms you will see throughout this post... 

Definitions & Acronyms

  • DNS : Domain Name System
  • NS: Name Servers
  • WAN: Wide Area Network
  • LAN: Local Area Network
  • DNS Propagation : The spreading of updates to Global DNS servers
  • IP : Internet Protocol
  • CName : Canonical name
  • Subdomain:  *.mydomain.com


With that being said lets jump into an integral part of this thing we call the interwebs... DNS. 

What Is DNS? 

DNS means Domain Name SystemIt is what allows us to give a "name" or "host name" to the location of a resource somewhere on a network (WAN or LAN).

So Google.com Points to 172.217.6.142 (at least from where I'm making the request). If you want to test this for yourself you can open up a command prompt (pc) or terminal (mac), and type in the following request

ping google.com

This will send a "ping" request to the host name you entered "google.com", and it will show you the IP from where the response. 


Why Do We Need DNS? 

Thats an easy one. The reason is Its so much easier to tell your friend they should check out this cool new site called Facebook.com, then it is to say you gotta check out this website. Just go to  31.13.77.36. 

You'll notice that if you browse to http://31.13.77.36 you will make it to Facebook.com

How Does It Work?

DNS works in a similar fashion to how your physical address works. 

SAY My office is at 200 Spectrum Center dr. Irvine, CA 92618.

Well that address correlates to a Latitude and Longitude coordinate as well, which is the precise location on the earth that address represents. 

While there may be multiple 200 Spectrum Center Dr.'s in the world there is only ever location for a unique lat long. 

Just as Lat and Long combinations are always unique so are IP's there is only ever 1 IP that exists in its unique combination. 

So what happens when your browser, server, whatever makes a request to a domain is it reaches out to its assigned DNS server. This is typically set at the ISP level. So your ISP (cox, time warner, verizon etc) will set your DNS for you if you don't set it. You may have noticed this before if you browse to a site that doesn't exist. You will get a custom error page from your ISP saying they can't find the site, and then they will also have ads on that page. Sneaky bastards ... and an example of why understanding dns can bring up opportunities for you. 

You can however set the dns for your computer manually to a DNS server of your choosing. 

2 of the main ones you can use are 

  • 4.2.2.2
  • 4.3.3.3


The reason why this is useful to understand is that when you are setting up your DNS for one of your sites if you understand how it works, and not just that its magic then it will help with troubleshooting, as well as make it easier for you to use tools that take advantage of how DNS works. 

*Pro Tip / Hacker Tip : If you have control of a network (home or work), or you can update the hosts file on a computer you can actually control where host names route to. I often tell my wife I'm going to do this on our network for webmd.com ... then all searches would just return. We're all going to be fine, stop worrying 😉

Types Of DNS Records

Now that we understand how DNS works a little better, we can go over the different types of records that you will run into when setting up, and managing DNS. For your domain you will typically have multiple DNS records for your domain. Each of these records will tell DNS servers around the globe where to find specific content. 

For your domain you have an unlimited* amount of subdomains that you can create via DNS. This means you could have different sites on: 

  • www.mycoolsite.com
  • mycoolsite.com
  • 123.mycoolsite.com
  • xyz.mycoolsite.com

These are referred to as subdomains.

Your root domain which is mycoolsite.com is referred to as your TLD. Top Level Domain. 

  • A Record
  • CNAME Record
  • TXT Record
  • MX Record


What Is An - A Record?

An A record is a type of DNS record that maps from a host name to an IP. So if you are setting up a new domain, and you have a servers IP you can map your A record to that IP.

*This creates a 1-1 relationship, which from an IT management perspective can cause issues.

Why CNAME Records? 

A Cname record on the other hand allows you to point a host record to another host.

So as you can see below, the www subdomain points to the root domain.

*when setting up your root domain you will put the "@" sign in the name portion of your record, which tells cloudflare that its the root record.

Here is a scenario that will help show why this is important to understand.

Say you have a VPS that is at say godaddy. If you were to point each of your say 50 sites to that VPS's IP, and then you wanted to move to AWS or rackspace, you would have to update dns on all of those domains to point to the new IP, and thus you would have to deal with DNS propagation on each. 

If you on the other hand you had 1 domain that you pointed to the VPS. 

Say mytargetdomain.com, and then you pointed your 50 sites to that using Cnames you would only have to update DNS in one location in order to make the migration from one provider to the next.

What Are TXT Records?

In my experience text records are most frequently used for domain verification purposes, as well as SPF records for mail. There may be other uses for them but from an IM perspective I don't know of any other use cases that you would run into. 

What Is A MX Record

MX records are what allow your email to operate correctly. Typically you will have multiple MX record references, which each will have an "priority" assigned to them. This is for redundancy purposes so if a mailserver tries to deliver mail to your mail provider and the first "host" is down it can know which one to move on to next. 

What Is DNS Propagation

One thing that you need to be aware of that if you have ever set up DNS for a site you have probably seen referrenced is DNS propagation. This refers to the global update of DNS servers with the information you have provided your DNS provider. Its actually a pretty amazing thing to think about that when you make an update to your DNS it "spreads" around the globe. So dns propagation refers to the spreading of your new information to all of the DNS servers around the world. Typically you will see a disclaimer that says 

"Your changes may take up to 24-48 hours to take effect" 

These days especially if you are using cloudflare, I've found that it seems almost instant. This can be a HUGE PITA though, and if you aren't aware of this you can spend hours troubleshooting an "issue" that doesn't really exist. Its just a matter of timing. 

*Pro Tip: If you think you have set up your DNS correctly but your site isn't resolving, you can actually bypass DNS servers. Check out this article on Updating your Hosts.txt File.

Here is an example of why understanding DNS can help you. 

You know as an SEO that having a keyword in the domain is a key ranking factor. 

So say you were doing a local PPL site, and you wanted to have a separate subdomain for each site you were building out. If our TLD was paintingpros.com

We could have : 

  • LosAngeles.PaintingPros.com
  • SantaBarbara.PaintingPros.com
  • SanDiego.PaintingPros.com

On and On and On... 

Or if you do product reviews, and it was a generic TLD, eg AdamsCoolReviews.com

you could have : 

  • Juicers.AdamsCoolReviews.com
  • Blenders.AdamsCoolReviews.com
  • hammocks.adamscoolreviews.com

Now I'm not saying that is what you should do from an SEO perspective but its an example, how understanding how the web works can open up opportunities. 

Wrapping Things Up

All in all DNS is one of those things that once you understand how it works, its really not all that difficult to manage, and use to your advantage. If on the other hand its "magic"to you then it can create alot of headaches. 

If you are looking for a place to host your DNS then I recommend using cloudflare. They have a free plan which gives you 90% of the benefits of using their service, and I personally use it for all of my sites.  Not only does it take care of DNS but it gives you a few other really cool features which I'll cover in a future post. 



Adam Z

I've been in the Software development and Internet marketing space for around 7 years now. I have a passion for learning, problem-solving, and I LOVE NEW TOOLS!