DNS (Domain Name System) is like the phonebook of the internet.It translates human-friendly website names (like google.com) into machine-readable IP addresses (like 8.8.8.8). Without DNS, you’d have to remember a bunch of numbers instead of simple domain names!
If you're a Red Hat Linux user, correctly configuring DNS ensures smooth internet browsing, reliable server connections, and secure network operations. Let’s dive into how DNS works, why it’s important, and how to set it up step by step.
Why Is DNS Configuration Important?
✔ Faster Internet Access – Resolves website names quickly.
✔ Reliable Server Communication – Ensures Red Hat Linux systems connect correctly.
✔ Security & Stability – Prevents unauthorized changes to DNS settings.
✔ Custom Domains – Allows internal network naming for businesses.
1. Checking Current DNS Settings
Before making changes, check existing DNS settings on your Red Hat Linux system.
Command to Check DNS Configuration
nmcli dev show | grep DNS
OR
cat /etc/resolv.conf
This will show which DNS servers your system is using.
2. Configuring DNS Using /etc/resolv.conf
This file stores DNS server settings and can be edited manually.
Steps to Set Up Custom DNS Servers
- Open the DNS configuration file:
sudo nano /etc/resolv.conf
- Add your preferred DNS servers:
nameserver 8.8.8.8 # Google Public DNS
nameserver 1.1.1.1 # Cloudflare DNS
- Save and exit (
CTRL + X
, thenY
andEnter
). - Verify DNS settings:
nslookup google.com
✅ Now, your Red Hat Linux system will use Google and Cloudflare DNS for faster internet access!
3. Configuring DNS Using NetworkManager (Recommended)
Editing /etc/resolv.conf
works, but NetworkManager is the preferred way to manage DNS settings.
Steps to Set DNS via NetworkManager
- List network connections:
nmcli con show
- Set custom DNS servers for a connection:
nmcli con mod "YourConnectionName" ipv4.dns "8.8.8.8,1.1.1.1"
- Apply changes:
nmcli con up "YourConnectionName"
- Verify settings:
nmcli dev show | grep DNS
✅ Now your DNS settings are permanently stored and won’t reset on reboot!
4. Testing DNS Resolution
After configuring DNS, check whether your system is resolving domain names correctly.
Test DNS Lookup
nslookup example.com
OR
dig example.com
✔ If you see an IP address in the results, your DNS is working fine!
5. Common DNS Issues & Fixes
Issue: DNS Not Resolving
✅ Check /etc/resolv.conf
or nmcli dev show | grep DNS
to ensure correct entries.
Issue: Slow DNS Response
✅ Use a faster DNS provider like Google (8.8.8.8) or Cloudflare (1.1.1.1).
Issue: DNS Configuration Resets After Reboot
✅ Use*NetworkManager* instead of manually editing /etc/resolv.conf
.
Use Case: Setting Up Internal DNS in a Business Network
A company wants its employees to access internal servers using friendly domain names (like "files.company.local") instead of IP addresses.
Solution: Configure a Local DNS Server
- Install DNS service:
sudo yum install bind bind-utils -y
- Configure the local DNS zone:
sudo nano /etc/named.conf
- Set up internal domains and restart the service:
sudo systemctl restart named
✅ Now employees can access company services easily, instead of typing long IP addresses!
Final Thoughts
Correct DNS configuration in Red Hat Linux enhances speed, security, and connectivity. Whether you're setting up internet access, securing a business network, or troubleshooting issues, understanding DNS ensures smooth system operations.