DNS Configuration in Red Hat Linux: A Beginner’s Guide
Alexand

Alexand @axisinfo_0a61830e06c3c950

About: I'm an IT enthusiast passionate about networking, systems integration, cybersecurity, and data analytics. I aim to build secure, data-driven solutions that protect businesses and drive innovation.

Location:
Germany
Joined:
Jul 13, 2024

DNS Configuration in Red Hat Linux: A Beginner’s Guide

Publish Date: Apr 24
1 0

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
Enter fullscreen mode Exit fullscreen mode

OR

cat /etc/resolv.conf
Enter fullscreen mode Exit fullscreen mode

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

  1. Open the DNS configuration file:
   sudo nano /etc/resolv.conf
Enter fullscreen mode Exit fullscreen mode
  1. Add your preferred DNS servers:
   nameserver 8.8.8.8    # Google Public DNS
   nameserver 1.1.1.1    # Cloudflare DNS
Enter fullscreen mode Exit fullscreen mode
  1. Save and exit (CTRL + X, then Y and Enter).
  2. Verify DNS settings:
   nslookup google.com
Enter fullscreen mode Exit fullscreen mode

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

  1. List network connections:
   nmcli con show
Enter fullscreen mode Exit fullscreen mode
  1. Set custom DNS servers for a connection:
   nmcli con mod "YourConnectionName" ipv4.dns "8.8.8.8,1.1.1.1"
Enter fullscreen mode Exit fullscreen mode
  1. Apply changes:
   nmcli con up "YourConnectionName"
Enter fullscreen mode Exit fullscreen mode
  1. Verify settings:
   nmcli dev show | grep DNS
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

OR

dig example.com
Enter fullscreen mode Exit fullscreen mode

✔ 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

  1. Install DNS service:
   sudo yum install bind bind-utils -y
Enter fullscreen mode Exit fullscreen mode
  1. Configure the local DNS zone:
   sudo nano /etc/named.conf
Enter fullscreen mode Exit fullscreen mode
  1. Set up internal domains and restart the service:
   sudo systemctl restart named
Enter fullscreen mode Exit fullscreen mode

✅ 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.

Comments 0 total

    Add comment