What is DNS? The internet's phonebook

☰ All 15 lessons

Imagine having to type a number like 198.51.100.24 every time you wanted to open Facebook. How hard would that be?

The problem DNS solves

A website lives on a server on the internet, and that server has an IP address. To connect, your computer needs that IP. But nobody can remember numbers like that for every site they visit.

Phone numbers are hard to remember too, which is why you save contacts by name. The system that does the same for the internet is DNS, the Domain Name System. It puts a simple name people can understand, a domain name like facebook.com or edwhere.com, on top of an IP address.

How a DNS lookup works

When you type edwhere.com in the browser, it doesn't connect straight to Edwhere's server:

  1. Your computer asks a DNS server (a server that stores names and their IPs): "What's the IP of edwhere.com?"
  2. The DNS server replies with the IP.
  3. Your browser connects to that IP.
  4. The website comes back.
How a DNS lookup worksBrowserDNS serveredwhere.comedwhere.com = ?IP: 203.0.113.10connect to 203.0.113.10the website
  1. The browser asks a DNS server for edwhere.com's IP.
  2. The DNS server answers with the IP.
  3. The browser connects to that IP.
  4. The website comes back.
Name in, IP out. (The IP shown is an example address.)

Try it yourself: open a terminal (Command Prompt on Windows) and type nslookup edwhere.com. The answer is the IP your computer will use.

DNS spoofing

Now, what if a hacker changed the answer, replacing edwhere.com's real IP with their own? Everyone who typed edwhere.com would land on the hacker's site, even though they typed the right name. That's DNS spoofing, and it's one of several attacks aimed at DNS. It's also why HTTPS (lesson 12) matters: a fake site can't show a valid certificate for the real domain.

Key takeaways

  • DNS turns domain names into IP addresses.
  • Your browser asks a DNS server first, then connects to the IP.
  • Try nslookup edwhere.com to see a real lookup.
  • DNS spoofing swaps the answer so you land on a fake site.

Quick quiz

Pick an answer to check yourself. Answer both to mark this lesson done.

1. What is DNS's job?

  1. A) Turn domain names into IP addresses
  2. B) Turn IPs into MAC addresses
  3. C) Encrypt data
  4. D) Save the Wi-Fi password
Show answer

Answer: A. Like the contact list on your phone, DNS takes a name (domain) and gives back its IP address.

2. What happens if DNS spoofing takes place?

  1. A) The website gets slow
  2. B) You reach the hacker's site even after typing the right domain
  3. C) The internet is cut
  4. D) Your phone's IP changes
Show answer

Answer: B. If the hacker changes the IP in the DNS answer, the right name still takes you to the hacker's IP.

Frequently asked questions

What is DNS in simple words?

DNS is the internet's phonebook. It turns names like edwhere.com into the IP addresses computers use to connect.

What is a DNS server?

A server that stores domain names and their IP addresses and answers your computer's "what is the IP of this name?" questions.

What is DNS spoofing?

An attack that changes a DNS answer so a real domain name points to the attacker's IP, sending visitors to a fake site.

Do it hands-on.

This tutorial gives you the concepts. The 50 Days Ethical Hacking Challenge puts them to work in real labs, explained in Malayalam.