Do I need to understand DNS as Web Developer?
Ionut Cornea
Posted on December 14, 2020
So, do I have to understand what DNS is, as a Web Developer? Let’s find out!
Let’s be honest as a Web Developer, we only hear about HTML, CSS, JavaScript, MYSQL, MongoDB, Git, etc. How about DNS configuration and deployment on a real web server? Before you say that DNS is not important, read the next wonderful paragraph.
Think of a burger 🍔 that does not have its own burger meat between the buns. It’s impossible to imagine it, correct? Well, it’s the same thing for DNS. Without DNS you cannot host your xyz.com website on a web server.
The deployment process is really easy and it comes in two steps. In the first step, via FTP, you can upload the files of your website. You can also choose to do it via SSH. However, if you have a shared hosting, due to security reasons, you most probably won’t have access to your server via SSH. Only if you have a VPS/ Dedicated Server. I won’t explain the first concept any further in this article. The second step consists of setting up the DNS configuration of your domain name.
To connect to the FTP Server you must connect to your FTP account via Filezilla, or another tool.
To connect via SSH, you must have a linux terminal, or Putty.
What is DNS?
Do you remember the yellow pages that were used in the past to find the phone number/ address of a person? Well DNS (Domain Name Service) is pretty much this. A user types in the browser the URL (web address) of the website he/ she would like to visit. After that, the DNS servers return the IP address of the Web server associated with the domain that you typed. For example, the domain xyz.com might be translated to 213.246.62.200.
DNS has multiple records that are used for different purposes.
The “A” record
This might be the most important DNS record. Basically, it says to the browser, point the website xyz.com to the address 213.246.62.200. To update, add, remove the A records of your domain name, you must have a DNS configuration panel. All Web Hosting companies are offering one, for example, Plesk / Cpanel, Directadmin etc.
To determine the IP of your website, you can use the Linux command > dig A xyz.com, inside a Linux terminal.
The “Cname” record
This DNS record maps an alias name to a canonical domain name. To have a better understanding, imagine the web address www.xyz.com, the CNAME record can map this web address to the actual website for the domain with the same name xyz.com.
“TXT” record
Usually, this record is used to verify the ownership of a domain. In some cases, you will be asked by the registrar of your domain to put a unique ID inside the TXT record.
The TXT record it’s also used for setting up the DKIM ( a technique that protects the email senders from spam, phishing etc).
Another use for TXT would be to set up the SPF, which is used to authorize which IP addresses can send email from one particular domain.
"MX" record
This record specifies the mail server responsible for accepting the incoming and outgoing emails on the behalf of the domain.
If you fell in love with DNS and you want to dig a little deeper, check out these commands.
ping xyz.com (to determine the IP of a web page, but is mainly used to determine the connectivity). Linux + Windows + Mac
dig xyz.com (this is the most popular command used to query the DNS zone of a domain). Linux + Mac
nslookup xyz.com (pretty much, same use as dig). Linux + Windows
Or to make it easier for you, use the online tool https://dnschecker.org/.
How DNS query works?
Now that we know a little about DNS, how does it really work?
Imagine, A user will type reddit.com on an internet browser, then your device will look into the local DNS cache of your machine. In the case where the device does not find an answer, it will go for a DNS query.
Your computer will contact your ISP’s recursive DNS servers, to request the IP of xyz.com. Recursive DNS servers have their local cache, much like your local computer. Some of the ISP’s are using the same recursive DNS servers. If the domain name is present in its cache, the query will end here, if not, will continue.
The DNS servers of the ISP, will then request the IP of reddit.com to the DNS Root Server. Then the Root Server sends back the IP of the .com top-level domain. Below you can see the steps of a DNS Query.
After, the ISP does request the IP of the authoritative server for reddit.com to the DNS Server for .COM domains. The server sends back the IP to the servers of the ISP’s Servers.
Another IP request of reddit.com from ISP is sent to the Authoritative DNS Server for reddit.com. The IP is sent back to the ISP and the ISP sends the IP back to the user and the website is displayed.
All this process takes only a few milliseconds.
DNS propagation time
Well, all sounds good, right? Not so fast! 💔
The DNS query is a really fast process, unlike the DNS propagation. 😭
The DNS propagation can take up to 72 hours, when you update the DNS zone. DNS when updated, it has to be replicated on the internet worldwide.
We are at the end of this article, therefore what’s the conclusion? Is DNS knowledge important for Web Developers? It’s not like a MUST HAVE, but it’s a nice extra knowledge to have. Especially if you are a Freelancer, working as WordPress / (other CMS) Developer. You might cash in some extra 💸 from your client, just because you have an extra skill that is really handy.
And OF COURSE, the most important thing of all. DNS JOKES.
“I’ll tell you a DNS joke but be advised, it could take up to 24 hours or more, for everyone to get it.” 😅🤓
My next article
Do not hesitate to come and say hi! 👋
My Twitter
Dribbble
Posted on December 14, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.