DEV Community

Aisalkyn Aidarova
Aisalkyn Aidarova

Posted on

DHCP vs DNS – Full Explanation (Production-Level Understanding)

1. DHCP (Dynamic Host Configuration Protocol)

What it is

DHCP is a network protocol that automatically assigns IP configuration to devices in a local network.

Defined by

  • Internet Engineering Task Force (IETF)
  • Example: RFC 2131

What it provides

When a device connects to the network, DHCP assigns:

  • IP Address
  • Subnet Mask
  • Default Gateway
  • DNS Server

How it works (DORA process)

  1. Discover – client asks for IP
  2. Offer – DHCP server offers IP
  3. Request – client accepts offer
  4. Acknowledge – server confirms

Scope

  • Local network only
  • Not global
  • No central authority controlling it

Important

  • DHCP is a standard (protocol), not a tool
  • Companies implement DHCP using:

    • Cisco
    • Windows Server
    • Linux (ISC DHCP, Kea)
    • AWS managed DHCP

2. DNS (Domain Name System)

What it is

DNS is:

  1. A protocol
  2. A global system for resolving names to IP addresses

Defined by

  • IETF (protocol rules)

Managed globally by

  • ICANN (Internet Corporation for Assigned Names and Numbers)
  • IANA (Internet Assigned Numbers Authority)

Purpose

Convert human-readable names into IP addresses:

Example:

api.company.com → 192.168.50.10
Enter fullscreen mode Exit fullscreen mode

3. DNS Components

(A) DNS Protocol

  • Defines how queries and responses work
  • Similar to DHCP in that it's a standard

(B) Global DNS Hierarchy

Managed by ICANN/IANA:

  • Root servers
  • Top-Level Domains (.com, .org)
  • Domain delegation

4. Domain Registration (Global)

How it works

  1. ICANN accredits registrars
  2. Registrar sells domain (GoDaddy, Namecheap, etc.)
  3. Domain becomes globally unique

Example:

company.com
Enter fullscreen mode Exit fullscreen mode

Important

  • Domain names are globally registered
  • No two entities can own the same domain

5. DNS Records (Local Control)

After registering a domain, you create DNS records.

Example:

api.company.com → 1.2.3.4
db.company.com  → 1.2.3.5
Enter fullscreen mode Exit fullscreen mode

These are managed in:

  • AWS Route53
  • Cloudflare
  • Google DNS
  • Windows DNS Server

6. Difference: Registrar vs DNS Provider

Component Role
Registrar Registers domain (ICANN-approved)
DNS Provider Stores name → IP mappings

Example:

  • Buy domain from GoDaddy (registrar)
  • Use Route53 for DNS records

7. DHCP + DNS Together

Flow

  1. Device connects to network
  2. DHCP assigns:
  • IP
  • Gateway
  • DNS server
    1. Device uses DNS to resolve names

Example:

User types: api.company.com
↓
PC asks DNS server
↓
DNS returns IP (e.g. 1.2.3.4)
↓
PC connects to that IP
Enter fullscreen mode Exit fullscreen mode

8. Real-World Example

Enterprise Network

  • DHCP → Windows Server or network appliance
  • DNS → Active Directory DNS

Cloud (AWS)

  • DHCP → managed automatically in VPC
  • DNS → Route53

Kubernetes

  • Internal DNS:
service.namespace.svc.cluster.local
Enter fullscreen mode Exit fullscreen mode

9. Key Differences

Feature DHCP DNS
Purpose Assign IP Resolve name → IP
Scope Local Global + Local
Defined by IETF IETF
Governed by None ICANN / IANA (global system)
Example 192.168.1.10 assigned google.com → IP

10. Mental Model

  • IETF → defines rules (protocols like DHCP, DNS)
  • ICANN/IANA → manages global domain ownership
  • Registrar → sells domain names
  • DNS Provider → stores DNS records
  • DHCP Server → assigns IPs inside network

Top comments (0)