Tutorials Logic, IN +91 8092939553 info@tutorialslogic.com
FAQs Support
Navigation
Home About Us Contact Us Blogs FAQs
Tutorials
All Tutorials
Services
Academic Projects Resume Writing Interview Questions Website Development
Compiler Tutorials

DNS and DHCP

DNS - Domain Name System

DNS is the "phone book" of the Internet. It translates human-readable domain names (like www.google.com) into IP addresses (like 142.250.80.46) that computers use to communicate.

DNS Hierarchy

  • Root DNS Servers: The top of the DNS hierarchy. There are 13 root server clusters (labeled A through M) worldwide. They know the addresses of all TLD servers.
  • TLD (Top-Level Domain) Servers: Manage domains like .com, .org, .net, .edu, .uk, .in. They know the addresses of authoritative name servers.
  • Authoritative Name Servers: Hold the actual DNS records for specific domains. Managed by domain owners or their DNS providers.
  • Recursive Resolver: The DNS server your ISP or organization provides. It queries other DNS servers on your behalf and caches results.

DNS Resolution Process

  1. User types www.example.com in browser
  2. Browser checks its local DNS cache
  3. If not cached, OS checks its hosts file (/etc/hosts)
  4. If not found, query goes to the Recursive Resolver (ISP's DNS)
  5. Resolver checks its cache; if not found, queries a Root Server
  6. Root server responds with the address of the .com TLD server
  7. Resolver queries the .com TLD server, which responds with the authoritative name server for example.com
  8. Resolver queries the authoritative server, which returns the IP address
  9. Resolver caches the result and returns it to the client
  10. Browser connects to the IP address

DNS Record Types

Record TypePurposeExample
AMaps domain to IPv4 addressexample.com → 93.184.216.34
AAAAMaps domain to IPv6 addressexample.com → 2606:2800:220:1:248:1893:25c8:1946
CNAMEAlias — maps one domain to anotherwww.example.com → example.com
MXMail exchange — specifies mail serversexample.com → mail.example.com (priority 10)
NSName server — specifies authoritative DNS serversexample.com → ns1.example.com
PTRReverse DNS — maps IP to domain name93.184.216.34 → example.com
TXTText records — SPF, DKIM, domain verificationv=spf1 include:_spf.google.com ~all
SOAStart of Authority — zone informationPrimary NS, admin email, serial number, TTL
SRVService location records_http._tcp.example.com → server:port

DHCP - Dynamic Host Configuration Protocol

DHCP automatically assigns IP addresses and other network configuration (subnet mask, default gateway, DNS servers) to devices on a network. Without DHCP, every device would need to be manually configured.

DHCP DORA Process

DHCP uses a 4-step process called DORA to assign IP addresses:

  1. Discover: Client broadcasts a DHCPDISCOVER message to find available DHCP servers. Source: 0.0.0.0, Destination: 255.255.255.255
  2. Offer: DHCP server responds with a DHCPOFFER containing an available IP address, subnet mask, lease duration, and other options.
  3. Request: Client broadcasts a DHCPREQUEST to accept the offered IP address (and inform other DHCP servers it's declining their offers).
  4. Acknowledge: DHCP server sends a DHCPACK confirming the IP address assignment. The client can now use the IP address.

DHCP Lease and Static vs Dynamic IP

FeatureStatic IPDynamic IP (DHCP)
AssignmentManually configuredAutomatically assigned by DHCP
ChangesNever changesMay change on lease renewal
ManagementComplex (manual tracking)Easy (centralized)
Use CaseServers, printers, routersWorkstations, laptops, phones
CostHigher (ISP charges)Lower

Ready to Level Up Your Skills?

Explore 500+ free tutorials across 20+ languages and frameworks.