What Is DNS?
DNS stands for:
Domain Name System
DNS is like a phone book for the internet.
google.com142.250.190.78DNS translates human-friendly domain names into IP addresses so your computer can reach websites.
How DNS Works
www.example.com
“Hey, what is the IP address for www.example.com?”
93.184.216.34
DNS allows you to use names instead of numbers.
Testing DNS
On Linux/macOS:
nslookup www.google.com
On Windows:
nslookup www.google.com
You’ll see the IP address of the website.
What Is DHCP?
DHCP stands for:
Dynamic Host Configuration Protocol
DHCP automatically gives devices on a network:
Without DHCP, you would have to manually assign an IP to every device. That would be slow and error-prone.
How DHCP Works
Example:
192.168.1.20Checking Your IP Assigned by DHCP
On Linux/macOS:
ip addr
or
ifconfig
On Windows:
ipconfig
You’ll see your IPv4 address, subnet mask, and default gateway — all assigned by DHCP.
Difference Between DNS and DHCP
| Feature | DNS | DHCP | |-----------------|----------------------------------------------------------|-------------------------------------------| | Purpose | Translates domain names to IP addresses | Assigns IP addresses and network settings | | Works With | Domain names, IP addresses | Devices connecting to a network | | Human-Friendly? | Yes, you type names | Mostly invisible to users | | Example | [www.google.com](http://www.google.com) → 142.250.190.78 | Device gets 192.168.1.20 automatically |
Why Both Are Important
Together, they allow devices to connect seamlessly and access websites.
Simple Testing Commands
Check your IP (assigned by DHCP)
Linux/macOS:
ip addr
Windows:
ipconfig
Check DNS resolution
Linux/macOS:
nslookup www.google.com dig www.google.com
Windows:
nslookup www.google.com
Ping a website to verify connectivity
Linux/macOS:
ping www.google.com
Windows:
ping www.google.com
Example Scenario
192.168.1.15, subnet mask 255.255.255.0, and DNS 8.8.8.8.www.example.com in your browser.93.184.216.34.93.184.216.34 and loads the website.All of this happens automatically in a few milliseconds.
# Linux/macOS - Check IP assigned by DHCP
ip addr
ifconfig
# Check DNS resolution
nslookup www.google.com
dig www.google.com
# Test connectivity
ping www.google.com
:: Windows - Check IP assigned by DHCP
ipconfig
:: Check DNS resolution
nslookup www.google.com
:: Test connectivity
ping www.google.com