How to Install CoreDNS on Arch Linux
CoreDNS is an open-source DNS server that can be used as a drop-in replacement for traditional DNS servers. In this tutorial, we will guide you through the steps to install CoreDNS on Arch Linux.
Step 1: Update the System
Before we start the installation, let's make sure the system is up-to-date. Open the terminal and update the system by running the following command:
sudo pacman -Syu
Enter your password and wait for the system to update.
Step 2: Install CoreDNS
Run the following command to install CoreDNS on Arch Linux:
sudo pacman -S coredns
Enter your password when prompted and wait for the installation to complete.
Step 3: Configure CoreDNS
CoreDNS can be configured using a file called Corefile, which is located in /etc/coredns. First, backup the default Corefile by running the following command:
sudo cp /etc/coredns/Corefile /etc/coredns/Corefile.bak
Next, open the Corefile using your preferred text editor.
sudo nano /etc/coredns/Corefile
You will see the default configuration file. Make any necessary changes to suit your needs. Here's a sample configuration file to get you started:
. {
log
errors
cache 30
forward . 8.8.8.8
}
This configuration file enables logging, caching, and forwards all DNS queries to Google's DNS server.
Step 4: Enable and Start CoreDNS
To enable CoreDNS to start on boot, run the following command:
sudo systemctl enable coredns.service
To start CoreDNS immediately, run the following command:
sudo systemctl start coredns.service
Step 5: Verify CoreDNS
You can verify that CoreDNS is running by using the dig command. Run the following command:
dig google.com
If CoreDNS is working correctly, you should see the query results.
Conclusion
In this tutorial, we have shown you how to install, configure and verify CoreDNS on Arch Linux. With CoreDNS, you can have a reliable, scalable DNS solution that integrates seamlessly into your infrastructure.