What is a domain?
Domain Name System (DNS) is a simple way to communicate with devices on the internet without remembering the specific IP address. A simple way of explaining it, is that a domain is the address for your house. But a more complicated way of explaining it is: all websites have an IP, google has an IP of (22.214.171.124). It would be hard to remember all those random numbers. This is when a DNS comes in and simplifies the process. Now all you have to remember is google.com. Quick note, all domain name registrations are overseen by the ICANN (Internet Corporation for Assigned Names and Numbers](icann.org/)).
The root domain, also known as the zero-level domain, is the highest level of any DNS system. It is signified by a "." at the end of a domain. Even if you don't type the dot in, most browsers will just internally add it in. The world has 13 sets, not a singular server but many server clusters, of main DNS servers managed by ICANN around the world. Root domains do not have IP's for websites like google.com. But what they do contain is the server address's to Top-Level-Domains like .com.
Top-Level Domains (TLD)
TLDs will always be at the end of your domain. Some examples of TLD's are .com, .net, .xyz. TLDs are allocated by ICANN. There are two main types of TLD.
Country-code top-level domain (ccTLD)
ccTLD is a country-specific domain extension given out by ICANN during the conception of domains. Some examples are:
- .AU for Australia
- .SG for Singapore
- .UK for the United Kingdom
- .NZ for New Zealand
Generic top-level domain (gTLD)
- .org (organisation)
- .net (network)
- .edu (education)
- .gov (government)
- .info (information)
- .biz (business)
- .shop (ecommerce)
Using hashnode.com as an example, the TLD is .com but the Second-Level Domain is hashnode. When registering domains, Second-Level Domains are limited to 63 characters + the Top-Level Domains and can only use a-z, 0-9, and hyphens (cannot start or end with hyphens or have consecutive hyphens).
Subdomains are on the left-hand side of the Second-Level-Domain using a period to separate them. An example would be admin.hashnode.com. In hashnode.com, www is considered a subdomain. it's a subdomain traditionally used to indicate that a site is part of the web. A Subdomain split does have the same character restrictions as Second-Level-Domains but you can have multiple subdomains like jupiter.servers.hashnode.com. But the total amount of characters has to be 253 characters or less.
How do they work?
- When you type in a DNS name, like hashnode.com, you first send a query to a server called a recursive resolver, these are normally managed by your ISP. The query would be something like, "What is the IP address of hashnode.com". If the server has that information cached from a past request, it will simply return the IP of hashnode.com. If it does not hashnode.com cached then it will forward the request to a root server.
- The root server, also known as authoritative DNS servers, will not know where hashnode.com is. But what it will do is forward the server address for the ".com" TLD server.
- After that, your resolver will submit a query to .com. Once again, .com will not know the IP address for hashnode.com. They will know where the Second-Level Domain is.
- Finally, the Second-Level Domain will then reply with the IP for hashnode.com.
- The IP will travel back through the recursive resolver, it might cache it as well, and then it will send it back to your machine.
- You then will use a browser to contact the website using the IP you just received.
DNS Record Types
DNS is just only for websites, they have many more uses. These are some of the most common records.
This record holds the IPv4 address.
This record holds the IPv6 address.
Forwards to another domain, does not provide an IP address.
Directs to an email server.
Lets admins store text. Can be used for blocking certain email addresses.
I am just touching the surfaces of DNS, I encourage you to do a bit of your own research. I will probably write about the HTTP protocol next. Thanks for reading, have a good one.
https://tryhackme.com/room/dnsindetail https://www.cloudflare.com/en-au/learning/dns/dns-records/ https://www.wpbeginner.com/beginners-guide/beginners-guide-what-is-a-domain-name-and-how-do-domains-work/ How a DNS Server (Domain Name System) works.