# Basics of DNS

## Introduction

* All computers on the Internet, from your smart phone or laptop to the servers that serve content for massive retail websites, find and communicate with one another by using numbers. These numbers are known as **IP addresses**.
* When you open a web browser and go to a website, you don't have to remember and enter a long number. Instead, you can enter a domain name like `example.com`, `google.com` and still end up in the right place.
* DNS is the backbone service that translates human readable names like `www.example.com` into the numeric IP addresses like `10.1.2.1` that computers use to connect to each other.
* The Internet’s DNS system works much like a phone book by managing the mapping between names and numbers. It is made of a hierarchical naming structure.
* DNS servers translate requests for names into IP addresses, controlling which server an end user will reach when they type a domain name into their web browser. These requests are called **queries**.
* This is a good [reference](https://aws.amazon.com/route53/what-is-dns/) to understanding the basics of DNS.
* Refer [this](https://www.menandmice.com/glossary/dns-server-types) for types of dns server.

## DNS Records

* DNS record types are records that provide important information about a hostname or domain. These records include the current IP address for a domain.
* There are several [types](https://en.wikipedia.org/wiki/List_of_DNS_record_types) of DNS records.
* Zone file contains DNS records.

## Name Server

* A DNS name server is a server that stores the DNS records, such as address _(A, AAAA)_ records, name server _(NS)_ records, and mail exchanger _(MX)_ records for a domain name and responds with answers to queries against its database.
* Controls how traffic is routed for a domain.
* Some of Top Level Domain _(TLD)_ are `.com`, `.in` ...
* Second Level Domains _(SLD)_ are `amazon.com`, `google.com` ...

## Anatomy of domain name in URL

* A typical URL in terms of DNS entry breakdown will look as below,

![DNS Break Down Of URL](https://574639531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJDnjsv52I3fJ56WbLgHu%2Fuploads%2Fgit-blob-4216cef9a6fc02fc05613755e689b542752270d6%2FDNS_AnatomyOfUrl.png?alt=media)

## Working of DNS

![Working of DNS](https://574639531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJDnjsv52I3fJ56WbLgHu%2Fuploads%2Fgit-blob-d69517a900d7f3223503ba1165a72a59319eeac0%2FDNS_Working.png?alt=media)
