What is DNS?
DNS (Domain Name System) is a distributed system that plays a crucial role in the operation of the Internet. Its perhaps most well-known function is to convert names (such as www.example.com) into IP addresses, so that we can visit websites without having to remember their IP addresses, which is indeed convenient, especially considering that website IP addresses typically change quite frequently.
DNS, however, has other roles as well. It should be seen as a global, distributed, hierarchical key-value (key - value) database that is used for various purposes.
For example, domain email settings can be found in DNS.
Basic Operating Principle
The basic principle of DNS is based on a hierarchical structure, which consists of several name servers at different levels. When a user enters a website name in the browser's address bar, the browser sends a DNS query to the name server specified in the network card settings.
The name server searches for the answer either from its own database or performs a query forward to a higher-level name server until the answer is found.
Hierarchical Structure
The hierarchical structure of DNS consists of several levels that form the system:
- Root servers: This is a group of servers at the top level of the DNS system. Root servers are able to provide information about which servers are responsible for the ".com" or ".fi" domain names. For example, C.ROOT-SERVERS.NET indicates that the ".fi" domain name can be resolved by the A.FI server.
- Top-level domain name servers (TLD): These name servers are responsible for translating the names of certain top-level domains, such as "hakatemia.fi", into IP addresses. Example: A.FI indicates that the domain names "*.hakatemia.fi and hakatemia.fi" can be resolved to NS-CLOUD-E1.GOOGLEDOMAINS.COM
- 2nd level domain name servers: Each top-level domain can contain multiple 2nd level domain name servers. These name servers respond to queries related to a specific domain or its subdomain. For example, NS-CLOUD-E1.GOOGLEDOMAINS.COM indicates that the IP address of "www.example.com" is "76.76.21.21".
General DNS records
A-record (Address):
- Purpose: Translate the domain name into an IPv4 address.
- Example: website.fi IN A 192.0.2.1
AAAA-record (IPv6 Address):
- Purpose: Translate the domain name into an IPv6 address.
- Example: website.fi IN AAAA 2001:0db8:85a3:0000:0000:8a2e:0370:7334
CNAME record (Canonical Name):
- Purpose: Specifies a subdomain of a domain.
- Example: aliasses.website.fi IN CNAME website.fi
MX record (Mail Exchanger):
- Purpose: Specifies the email server of the domain.
- Example: verkkosivusto.fi IN MX 10 mail.verkkosivusto.fi
NS record (Name Server):
- Purpose: Determines the domain name servers.
- Example: verkkosivusto.fi IN NS ns1.verkkosivusto.fi
PTR record (Pointer):
- Purpose: Translates an IP address to a domain name.
- Example: 1.2.3.4 IN PTR website.fi
SOA record (Start of Authority):
- Purpose: Specifies the original name server for the zone and other settings.
- Example: verkkosivusto.fi IN SOA ns1.verkkosivusto.fi admin.verkkosivusto.fi 2023071401 3600 1800 604800 86400
SRV Record (Service):
- Purpose: Determines the location and port of the service for a specific domain.
- Example: _sip._tcp.website.fi IN SRV 10 60 5060 sip.website.fi
TXT record (Text):
- Purpose: Contains free-form text, such as description or verification information.
- Example: website.fi IN TXT "Welcome to our website!"
Test what you have learned
What is the purpose of the A record in DNS?
Ready to become an ethical hacker?
Start today.
As a member of Hakatemia you get unlimited access to Hakatemia modules, exercises and tools, and you get access to the Hakatemia Discord channel where you can ask for help from both instructors and other Hakatemia members.