How DNS works
By James Charlesworth
Published 14 September 2022
Domain names, name servers, host names and IP addresses. This article will explain what these things really mean and how they come together to create the Domain Name System (DNS).
The Domain Name System (DNS) is a worldwide system for naming websites and servers, and is what makes the web easy to navigate by human beings. By assigning readable names to web addresses, DNS allows us to remember and recall the address of a website by using a simple phrase such as traintocode.com.
The Internet Protocol (IP) Address
Every file server, media server, web server, smartphone, laptop, tablet, drone or toaster that is connected to the internet will have an Internet Protocol (IP) address. An IP address is a bit like a digital serial number that uniquely identifies a device on a network, and the internet is essentially just a very VERY large network of devices.
The IP address 142.250.80.46 is one of addresses owned by Google and is the location of their website google.com. Try typing 142.250.80.46 into your web browser - it will take you to Google's homepage. You can do the same with any website, for example 157.240.241.35 goes to Facebook.com.
Having to type out an IP address into the URL bar every time you want to visit a website is highly inconvenient, and that is where the name server comes in.
Domain Name System (DNS)
When you type a url into your browser or click on a link, your device takes the section of the url between https:// and the first forward slash. This is the domain name.
The next step for your browser is to send that name to a DNS resolving service. This service looks it up in a big database of domain names and, if found, returns the IP address associated with the domain name.
Your device now has an IP address it can use to connect to the website.
There are a lot of domain names
As of 2021 there were 359.8 million registered domain names, however not all domain names have been registered. You may have come across an error like this before
This error is telling you that the domain name thiswebsitedoesnotexist.info does not exist. That is, the domain name server could not find an IP address for this domain name in any database, so there is no website you can visit. If you want to, you could register thiswebsitedoesnotexist.info and point it to the IP address of your website. So that brings us on to the next question…
Who Is In Charge Of Domain Names?
To access websites, your device relies on a domain name system (DNS) to determine the IP address associated with a domain name. The DNS service is managed by a hierarchy of organizations that work together to keep DNS running smoothly for the entire internet. At the very top is The Internet Corporation for Assigned Names and Numbers (ICANN) which is a non-profit organisation based in the United States. Underneath ICANN are domain registrars.
These are the companies that maintain the DNS registry and follow the rules set by ICANN. GoDaddy, Bluehost, Namecheap and hundreds of others are registrars and they manage the DNS for domain names for an annual fee
Hi, I'm James
I've worked in software development for nearly 20 years, from junior engineer to Director of Engineering. I'm here to help you get your foot on the next rung of your career ladder. I post weekly videos on YouTube and publish guides, articles, and guided project tutorials on this site. Sign up to my newsletter too for monthly career tips and insights in the world of software development.
Related Project Tutorials
Read Next...
What is JavaScript Strict Mode and Why You Should Use It?
3 December 2023 • 3 min read
Explore the benefits of JavaScripts strict mode in enhancing code reliability and preventing common mistakes. This article delves into its features, real-world examples, and reasons why both beginners and pros should consider its adoption.
How to Run TypeScript in VS Code
30 November 2023 • 3 min read
Learn how to set up, run, and debug TypeScript in Visual Studio Code. This guide provides step-by-step instructions to enhance your JavaScript development process. Dive into the seamless integration of TypeScript with VSCode for a productive coding session.
First Class Functions in Javascript
17 August 2023 • 3 min read
This article introduces you to first class functions, and how functions can be treated as first class citizens in programming, demonstrating their utility and practical applications in Javascript.