Sub topic 1
Why We Need DNS
Prerequisites
Assume you understand IPv4 and IPv6 addresses, client-server communication, ports, and basic terminal commands.
Why We Need DNS
The Domain Name System (DNS) is a distributed database that maps names such as www.example.com to IP addresses. People remember stable names more easily than numeric addresses. Services can also change addresses without requiring users to learn a new name.
DNS stores more than address mappings. It can identify mail servers, name servers, verification data, and aliases. An application usually asks a local resolver for a name. The resolver finds the requested data and returns it to the application.
The Domain Name Hierarchy
A domain name is made of labels separated by dots. The rightmost label is closest to the root:
The root is written as a final dot, although it is usually omitted. www.example.com. is a fully qualified domain name (FQDN), meaning the name is complete and unambiguous.
Zones and Delegation
A zone is an administratively managed portion of the namespace. A parent zone can delegate a child domain to different authoritative name servers by publishing NS records. The parent may also publish glue address records so resolvers can reach those servers when their names are inside the delegated domain.
Resource Records
A resource record contains a name, type, value, and time-to-live (TTL). Common types include:
| Type | Purpose |
|---|---|
| A | Maps a name to an IPv4 address |
| AAAA | Maps a name to an IPv6 address |
| CNAME | Makes one name an alias of another name |
| MX | Lists mail servers and their priorities |
| NS | Identifies authoritative name servers |
| TXT | Stores arbitrary text, often for verification or email policy |
| SOA | Describes zone authority, serial number, timers, and negative caching |
A CNAME points to another name, not directly to an address. The resolver follows that name to obtain the final records.
Authoritative Name Servers
An authoritative name server holds the records for a zone and answers from that zone's data. It does not need to discover the answer elsewhere. A recursive resolver may cache the response, but the authoritative server is the source of the zone's published information.
Exercise
Which record type should a client query for the IPv6 address of api.example.com?
Show answer
Query its AAAA record. An A record contains an IPv4 address.