Linux DNS Servers - ryzendew/Linux-Tips-and-Tricks GitHub Wiki

Linux DNS Servers Guide

Complete beginner-friendly guide to DNS servers on Linux, covering Arch Linux, CachyOS, and other distributions including Bind, dnsmasq, and DNS server configuration.


Table of Contents

  1. Bind Setup
  2. dnsmasq Setup
  3. DNS Configuration
  4. Troubleshooting

Bind Setup

Install Bind

Install Bind:

# Arch/CachyOS
sudo pacman -S bind

# Enable service
sudo systemctl enable --now named.service

Debian/Ubuntu:

sudo apt install bind9

Fedora:

sudo dnf install bind

Configure Bind

Edit config:

# Edit named config
sudo vim /etc/named.conf

dnsmasq Setup

Install dnsmasq

Install dnsmasq:

# Arch/CachyOS
sudo pacman -S dnsmasq

# Enable service
sudo systemctl enable --now dnsmasq.service

Debian/Ubuntu:

sudo apt install dnsmasq

Fedora:

sudo dnf install dnsmasq

Configure dnsmasq

Edit config:

# Edit config
sudo vim /etc/dnsmasq.conf

Settings:

domain-needed
bogus-priv
listen-address=127.0.0.1

DNS Configuration

Test DNS

Test server:

# Test DNS
dig @localhost example.com

# Or
nslookup example.com localhost

Troubleshooting

DNS Not Working

Check service:

# Check status
systemctl status dnsmasq

# Check logs
journalctl -u dnsmasq

Summary

This guide covered DNS servers for Arch Linux, CachyOS, and other distributions, including Bind and dnsmasq.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.