What is DNS?
- DNS stands for Domain Name System.
- DNS is used when you use an internet. DNS is used to convert human-friendly domain names (such as https://www.TheDeveloperBlog.com) into an Internet Protocol (IP) address.
- IP addresses are used by computers to identify each other on the network.
- IP addresses are of two types, i.e., Ipv4 and Ipv6.
Top Level Domains
- Domains are seperated by a string of characters seperated by dots. For example, google.com, gmail.com, etc.
- The last word in a domain name is known as a Top Level Domain.
- The second word in a domain name is known as a second level domain name.
.com: .com is a top-level domain.
.edu: .edu is a top-level domain.
.gov: .gov is a top-level domain.
.co.uk: .uk is a top-level domain name while .co is a second level domain name.
.gov.uk: .uk is a top-level domain name while .gov is a second level domain name.
- The Top level domain names are controlled by IANA (Internet Assigned Numbers Authority).
- IANA is a root zone database of all available top-level domains.
- You can view the database by visiting the site: http://www.iana.org/domains/root/db
- Domain Registrar is an authority that assigns the domain names directly under one or more top-level domains.
- Domain Registrar is used because all the names in a domain name must be unique there needs to be a way to organize these domain names so that they do not get duplicated.
- Domain names are registered with interNIC, a service of ICANN, which enforces uniqueness of domain name across the internet.
- Each domain name is registered in a central database known as the WhoIS database.
- The popular domain registrars include GoDaddy.com, 123-reg.co.uk, etc.
State Of Authority Record (SOA)
- SOA stores the information in Domain Name System (zone) about the zone and other DNS records.
Where DNS zone is a space allocated for a particular type of server.
- Each DNS zone consists of a single SOA record.
The State of Authority Record stores the information about:
- The name of the server that supplies the data for the zone.
- The administrator of the zone, i.e., who is administering the zone.
- The current version of the data file that contains the zone.
- The default number of records for the time-to-live file on resource records. For example, when you are dealing with a DNS, then it always has a time-to-live. Time-to-live must be lower as possible because when you make changes, it then propagates quicker. Suppose the name of the website is Hindi100.com and its time-to-live is 60 seconds. By the end, you want to change its IP address then the time taken to achieve this is equal to the time-to-live.
- The number of seconds a secondary name server has to wait before checking for the updates.
- The maximum number of seconds that a secondary name server can use the data before it is either be refreshed or expire.
- NS stands for Name Server records.
- NS Records are used by Top Level Domain Servers to direct traffic to the Content DNS server which contains the authoritative DNS records.
Let's understand through a simple example.
Suppose the user wants an IP address of hindi100.com. If ISP does not know the IP address of hindi100.com, ISP goes to the .com and asks for the NS Record. It finds that time-to-live is 172800 and its ns record is ns.awsdns.com. ISP moves to this ns record and asks that "do you know hindi100.com". Yes, it knows, so it points to Route53. In SOA, we have all the DNS types and 'A' records.
- An 'A' record is a fundamental type of DNS record.
- 'A' stands for Address.
- An 'A' record is used by the computer to convert the domain name into an IP address. For example, https://www.TheDeveloperBlog.com might point to http://22.214.171.124.
- The length that a DNS record is cached on either the Resolving power or the users owns local PC is equal to the value of the TTL in seconds.
- The lower the time-to-live, the faster changes to DNS records take to propagate throughout the internet.
- A CNAME can be used to resolve one domain name to another. For example, you may have a mobile website with a domain name http://m.devices.com which is used when users browse to your domain name on their mobile devices. You may also want the name http://mobile.devices.com to resolve the same address.
- Alias Records are used to map resource record sets in your hosted zone to Elastic load balancers, CloudFront distributions, or S3 buckets that are configured as websites.
- Alias records work like a CNAME record in that you can map one DNS name (http://www.example.com) to another target DNS name (elb1234.elb.amazonaws.com).
- The key difference between a CNAME and Alias Record is that a CNAME cannot be used for naked domain names (zone apex) record, i.e., it cannot be used when something is written infront of the domain name. For example, http://www.example.com contains a www infront of the domain name, therefore, it cannot be used for CNAME.