How to Install CoreDNS on FreeBSD Latest

CoreDNS is a powerful open source DNS server that can be used as an alternative to traditional DNS servers. In this tutorial, you will learn how to install CoreDNS on FreeBSD.

Prerequisites

Before starting with the installation process, you will need:

  • A FreeBSD system running the latest version
  • Root access to the system
  • Basic knowledge of working with the FreeBSD command line interface

Step 1 - Install Go

CoreDNS is written in Go, so you will need to install Go before you can proceed with the CoreDNS installation. You can install Go by running the following commands:

$ sudo pkg install go

Step 2 - Download CoreDNS

Next, download the latest version of CoreDNS from the official website:

$ wget https://github.com/coredns/coredns/releases/download/v1.6.9/coredns_1.6.9_freebsd_amd64.tgz

Step 3 - Extract CoreDNS

Extract the downloaded CoreDNS file to the /usr/local directory by running the following command:

$ sudo tar -C /usr/local -xzf coredns_1.6.9_freebsd_amd64.tgz

Step 4 - Configure CoreDNS

Create a configuration file for CoreDNS by running the following command:

$ sudo touch /usr/local/etc/coredns/Corefile

Open the newly created file using your favorite text editor and add the following lines:

.:53 {
    forward . 8.8.8.8
    log
}

This sets up CoreDNS to forward DNS requests to Google's public DNS server (8.8.8.8) and logs any requests.

Step 5 - Run CoreDNS

Start CoreDNS by running the following command:

$ sudo /usr/local/bin/coredns -conf /usr/local/etc/coredns/Corefile

Conclusion

You have successfully installed and configured CoreDNS on FreeBSD. With CoreDNS, you now have a powerful DNS server that can be used as an alternative to traditional DNS servers.