Introduction
Unbound is a validating, recursive, and caching DNS resolver. This guide will walk you through the process of setting up a local DNS resolver with Unbound on Rocky Linux 9.
Prerequisites
Before you begin, ensure you have:
- A Rocky Linux 9 system
- Root or sudo privileges
Step 1: Install Unbound
Update the package index and install Unbound:
sudo dnf update
sudo dnf install -y unbound
Step 2: Configure Unbound
Edit the Unbound configuration file:
sudo nano /etc/unbound/unbound.conf
Replace the contents with the following configuration:
server:
interface: 127.0.0.1
access-control: 127.0.0.0/8 allow
verbosity: 1
logfile: "/var/log/unbound.log"
Step 3: Start Unbound
Start the Unbound service:
sudo systemctl start unbound
sudo systemctl enable unbound
Step 4: Test Unbound
Use the dig
command to test Unbound:
dig example.com @127.0.0.1
You should see DNS resolution results for example.com.
Conclusion
Congratulations! You have successfully set up a local DNS resolver with Unbound on Rocky Linux 9. You can now use Unbound to resolve DNS queries locally.