Domain Name System (DNS)

 

Domain Name System (DNS)

The Domain Name System (DNS) is one of the most important client-server applications in the Internet. It acts as the telephone directory of the Internet by translating human-readable domain names into IP addresses that computers use for communication.


Definition

DNS (Domain Name System) is a distributed hierarchical naming system that maps domain names (such as www.google.com) to IP addresses (such as 142.250.190.78).

Without DNS, users would have to remember numerical IP addresses instead of easy-to-remember names.


Need for DNS

TCP/IP protocols communicate using IP addresses, but users prefer domain names.

For example,

  • User remembers: www.google.com
  • Computer needs: 142.250.x.x

DNS performs this conversion automatically.

Analogy

Just like a telephone directory maps a person's name to a telephone number, DNS maps a domain name to an IP address.


Purpose of DNS

DNS provides:

  • Name-to-IP address mapping
  • IP-to-name mapping (reverse lookup)
  • Distributed database management
  • Faster communication through caching
  • Scalable naming system for the Internet

Working of DNS

Suppose a user wants to access

www.example.com

The following steps occur:

  1. User enters the domain name.
  2. The application sends the domain name to the DNS client (resolver).
  3. The DNS client contacts the nearest DNS server.
  4. The DNS server searches for the corresponding IP address.
  5. The DNS server returns the IP address.
  6. The application uses the IP address to communicate with the destination server.
User
   │
Enter Domain Name
   │
Application
   │
DNS Resolver (Client)
   │
DNS Server
   │
Returns IP Address
   │
Application connects to destination

Thus, before connecting to a web server, DNS first translates the host name into an IP address.




Name Space in DNS

A name space is a collection of all valid names.

DNS supports two types of name spaces.

1. Flat Name Space

  • Every host has a unique name.
  • No hierarchical structure.
  • Requires central management.
  • Suitable only for small networks.
  • Not suitable for the Internet.

Example:

computer1
computer2
computer3

Limitations

  • Difficult to manage
  • Name duplication possible
  • Not scalable

2. Hierarchical Name Space

DNS uses a hierarchical name space.

Each name consists of several parts separated by dots.

Example

www.mec.ac.in

where

  • in → Country
  • ac → Academic institution
  • mec → Organization
  • www → Host

Advantages

  • Easy management
  • No duplicate names
  • Distributed administration
  • Highly scalable

Domain Name Space

The DNS name space is organized as an inverted tree.

                    Root (.)
                     |
        ----------------------------
       |            |              |
      com          edu            org
       |
   google
       |
      www

Characteristics

  • Root is at the top.
  • Maximum depth is 128 levels.
  • Every node has a label.
  • Labels are separated by dots.



Label

A label is one component of a domain name.

Example

www.google.com

Labels are

  • www
  • google
  • com

Characteristics

  • Maximum length = 63 characters
  • Children of the same node must have different labels.

Domain Name

A domain name is a sequence of labels separated by dots.

Example

www.google.com.

A fully qualified domain name always ends with a dot representing the root.


Fully Qualified Domain Name (FQDN)

An FQDN contains the complete path from the host to the root.

Example

www.google.com.

Features

  • Complete domain name
  • Ends with "."
  • Globally unique

Partially Qualified Domain Name (PQDN)

A PQDN does not include the complete path.

Example

www.google

The missing suffix is supplied automatically by the resolver.


Domain

A domain is a subtree of the DNS hierarchy.

Example

com

contains

google.com
amazon.com
microsoft.com

A domain can contain many subdomains.





Distribution of Name Space

The Internet is too large for one DNS server.

Therefore, the DNS database is distributed among many DNS servers.

Advantages

  • Faster response
  • Reliability
  • Scalability
  • Load sharing


Hierarchy of DNS Servers

                  Root Server
                      |
          -------------------------
          |                       |
      .com Server             .edu Server
          |
    google.com Server
          |
     Local DNS Server

Each server is responsible for a specific portion of the DNS tree.





Zone

A zone is the portion of the DNS database managed by one DNS server.

If a server manages an entire domain,

Zone = Domain

If authority is delegated,

Domain ≠ Zone

The server stores all zone information in a Zone File.


Types of DNS Servers

1. Root Server

  • Highest-level DNS server.
  • Knows addresses of top-level domain servers.
  • Does not usually store host IP addresses.
  • Distributed worldwide.

2. Primary DNS Server

  • Stores the original zone database.
  • Creates and updates zone files.
  • Authoritative server.

3. Secondary DNS Server

  • Keeps a copy of the primary server database.
  • Obtains updates from the primary server.
  • Provides redundancy.
  • Also authoritative.

Generic Domains (Top-Level Domains)

These classify organizations.

DomainPurpose
.comCommercial organizations
.eduEducational institutions
.govGovernment
.orgNon-profit organizations
.netNetwork organizations
.milMilitary
.bizBusiness
.infoInformation services
.namePersonal names
.museumMuseums
.coopCooperatives
.proProfessionals
.aeroAerospace
.intInternational organizations

Country Domains (ccTLD)

Represent countries.

Examples

DomainCountry
.inIndia
.usUnited States
.ukUnited Kingdom
.jpJapan
.auAustralia
.frFrance

Example

mec.ac.in
  • in → India
  • ac → Academic
  • mec → Institution

Name Resolution

Name Resolution is the process of converting a domain name into an IP address.

DNS supports two methods.


1. Recursive Resolution

The local DNS server performs all the work.

Client
   │
Local DNS
   │
Root DNS
   │
TLD DNS
   │
Authoritative DNS
   │
Returns IP

Characteristics

  • Client sends only one request.
  • DNS servers communicate with each other.
  • Easier for clients.



2. Iterative Resolution

Each DNS server returns the address of the next DNS server.

Client
   │
Root Server
   │
Returns TLD Server
   │
TLD Server
   │
Returns Authoritative Server
   │
Authoritative Server
   │
Returns IP Address

Characteristics

  • Client or local DNS repeatedly queries servers.
  • Less workload on DNS servers.



DNS Caching

To improve performance, DNS stores recently resolved addresses.

Advantages

  • Faster response
  • Less network traffic
  • Reduced server load

Cached entries are temporary.


Time To Live (TTL)

Each DNS record contains a TTL (Time To Live).

TTL specifies how long a cached entry remains valid.

After TTL expires,

  • Cache entry is removed.
  • Fresh lookup is performed.

Resource Records (RR)

DNS stores information as Resource Records.

General format

(Domain Name, Type, Class, TTL, Value)

Common Resource Record Types

TypePurpose
A    Maps hostname to IPv4 address
AAAA    Maps hostname to IPv6 address
NS    Authoritative name server
MX    Mail server
CNAME    Alias (Canonical Name)
SOA    Start of Authority

Example

google.com    A      142.250.190.78

DNS Message Format

DNS uses two messages:

  • Query
  • Response

DNS Query Message

Contains

  • Header
  • Question Section

DNS Response Message

Contains

  • Header
  • Question Section
  • Answer Section
  • Authoritative Section
  • Additional Information Section
+------------------+
| Header           |
+------------------+
| Question         |
+------------------+
| Answer           |
+------------------+
| Authority        |
+------------------+
| Additional Info  |
+------------------+


DNS Transport Protocol

DNS uses Port 53.

It can use both UDP and TCP.

UDP

Used when

  • Response size ≤ 512 bytes
  • Faster
  • Default method

TCP

Used when

  • Response size > 512 bytes
  • Zone transfers
  • Large DNS responses

Domain Registration

New domains are registered through Registrars accredited by ICANN.

During registration, the organization provides:

  • Domain name
  • IP address
  • DNS server details

Example

Domain : wonderful.com
Host    : ws.wonderful.com
IP      : 200.200.200.5

Dynamic DNS (DDNS)

Traditional DNS required manual updates.

DDNS automatically updates DNS records whenever:

  • IP address changes
  • New host is added
  • Host is removed

Usually works with DHCP.

Benefits

  • Automatic updates
  • Less manual administration
  • Suitable for dynamic IP addresses

DNS Security (DNSSEC)

DNS is vulnerable to attacks such as:

  • Fake DNS responses
  • DNS spoofing
  • Cache poisoning
  • DNS hijacking
  • Denial-of-Service (DoS)

To overcome these, DNSSEC provides:

  • Message authentication
  • Data integrity
  • Digital signatures

However, DNSSEC does not provide confidentiality (encryption) of DNS messages.


Advantages of DNS

  • Easy-to-remember names
  • Distributed architecture
  • Highly scalable
  • Fault tolerant
  • Faster through caching
  • Supports load distribution
  • Easy administration

Limitations of DNS

  • Initial lookup adds slight delay.
  • Cached records may become outdated until TTL expires.
  • Vulnerable to spoofing and cache-poisoning attacks without DNSSEC.
  • Large DNS responses may require TCP instead of UDP.

Summary

  • DNS (Domain Name System) is a distributed, hierarchical naming system that maps domain names to IP addresses.
  • It uses a client-server architecture, where a DNS resolver queries DNS servers to obtain the IP address of a requested host.
  • DNS organizes names in a hierarchical domain name space, supports generic and country domains, and distributes information among root, primary, and secondary DNS servers.
  • Name resolution can be recursive or iterative, and caching with TTL improves lookup performance.
  • DNS stores information using resource records (A, AAAA, MX, NS, CNAME, SOA, etc.), typically uses UDP port 53 for normal queries and TCP port 53 for large responses and zone transfers.
  • Dynamic DNS (DDNS) automates updates to DNS records, while DNSSEC enhances security by providing authentication and integrity for DNS data

Comments

Popular posts from this blog

Computer Networks PCCST501 Semester 5 KTU CS 2024 Scheme - Dr Binu V P

Introduction to Computer Networks

Introduction to Local Area Network (LAN)