Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

What is DNS? Basics for Beginners

When you access a website like www.google.com, would it surprise you to learn that the URL isn't really the website address? There is some work "under the hood" to ensure that, when you type in a human friendly name like Google, it takes you to the website you're expecting it to.So, what's happening under the hood?You may be familiar with what a URL is. It's a simple link to a bit of content on the web. People use URL's daily to share videos, pictures, sites, articles – almost anything on the internet.URL is an acronym for Uniform Resource Locator, and we can break them down into multiple smaller "pieces". Here's what makes up a standard URL:A URL is just an Address for a resource. The resources differ like we discussed, but they're just pointers all over the internet to take you to content you want to view.As you can see in the graphic above, the breakdown of a URL is often:Humans and computers navigate the web very differently. Whilst most humans use URL's like we just discussed, to communicate between computers, computers use the Internet Protocol (IP). The IP is a set of rules that route and address data packets (all the data you want to view) to make sure it arrives to your computer.The Internet Protocol relies on devices and domains, all having their own IP address to connect and identify all the different segments (packets!) of the internet. An IP address is a series of standardised numbers that range from 0 to 255 – separated by dots. If you want to see IP addresses in action, and are familiar with terminals, you can type ping google.com in whichever terminal you like and you can see the IP address of Google.com.You can test this further by typing 216.58.212.206 directly into your browser and seeing if it takes you to Google. Hopefully this small example highlights why we use URL's. If both addresses (IP address and domain name) took you to the same place, would you rather be asked to remember Google.com or 216.58.212.206?Note that some IP addresses change day to day (called dynamic IP addresses) – so the above IP address may not work, depending on if the IP address is dynamic or static.Static IP addresses are ones that don't change – but to assign a single IP address to every machine would be impractical. It would be a logistical nightmare, too, as some people only log onto computers once a month to send an email, for example. We could very realistically run out of IP addresses on today's current technology if we gave every device a unique IP address (if you want to read how IP addresses are allocated in greater detail, read here).If we know computers communicate via the Internet Protocol and communicate using IP Addresses, how do we turn google.com into the website we use so regularly?The answer is using a Domain Name System (DNS). The job of the Domain Name System is to transform human readable domain names into IP addresses.There are four servers specifically that we'll discuss.A DNS Recursor is like a waiter in a restaurant. It acts like a "front facing" part of the system to receive orders (normally from browsers) where the waiter then heads into the back to get what is needed.In reality, it's just a server that receives DNS queries from browsers and returns information.There are 3 different places the DNS recursor can generally get the information from depending on if any data has been cached:So let's discuss them one by one.The root nameserver's main job is to return the Top-Level Domain (TLD) server.  This is an important step to map hostnames into IP addresses.The root nameserver essentially acts like a catalogue that points to more specific locations.If the root nameserver acts like a catalogue, the TLD server acts like a page in a catalogue.The TLD server generally returns the final part of the host-name, like com for example, in "google.com".This server is like a row entry on the specific page of the catalogue.The authoritative nameserver now can return the IP address for the requested hostname from the browser, back to the DNS recursor – which can hand it back to the browser.DNS can be super confusing, and to understand the whole process may take a little while, so let's tie it together with a final example.Let's break down an example request from a user, and hopefully tie together this pretty complex process.Each step in the flow starts to point closer and closer to the final address the user will eventually end up hitting.Let's break down what's going on in this graphic:A user types 'kealanparr.com' into their browser, and the query hits the DNS recursor.The DNS recursor then queries a Root nameserverThe Root nameserver then responds to the DNS recursor with the address of a Top Level Domain server (TLD) such as .com. The DNS recursor then makes a request to the .com TLD.The .com TLD server then responds with the IP address of the Domain’s nameserver, kealanparr.com.The DNS recursor sends a query to the domain’s nameserver.The IP address for kealanparr.com is then returned to the resolver from the Domain nameserver.The DNS recursor responds to the web browser request with the IP address of the domain requested.At this point, the DNS lookup has returned enough data for the browser to make the request for the web page.I hope this article has helped you to understand a few networking principles that affect the websites you use everyday. IP addresses, DNS, and more are all technologies most people use daily but may not be very familiar with.Cloudflare has an article that was helpful as I researched for this article, which you can read here.I tweet my articles here if you would like to read more.Senior Software Engineer working on mobile, web and iOS. If you read this far, tweet to the author to show them you care. Tweet a thanks Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started freeCodeCamp is a donor-supported tax-exempt 501(c)(3) charity organization (United States Federal Tax Identification Number: 82-0779546)Our mission: to help people learn to code for free. We accomplish this by creating thousands of videos, articles, and interactive coding lessons - all freely available to the public. We also have thousands of freeCodeCamp study groups around the world.Donations to freeCodeCamp go toward our education initiatives, and help pay for servers, services, and staff. You can make a tax-deductible donation here.



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

What is DNS? Basics for Beginners

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×