So, do I have to understand what DNS is, as a Web Developer? Let’s find out!
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.
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 22.214.171.124.
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 126.96.36.199. 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 points one web address www.xyz.com to xyz.com. Most people are using this record to redirect the traffic from the subdomain www.xyz.com to the main domain xyz.com.
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.
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)Or to make it easier for you, use the online tool https://dnschecker.org/. Linux + Windows
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.” 😅🤓