How to Install Bind DNS on CentOS Stream 9 Server (Setup/Configure). In this article, we will introduce what Bind DNS server is with its main features and move on to the installation and configuration phase.
Bind is a free and open source DNS server developed in the 1980s that supports various features, including IPv6, load balancing, split DNS, DNSSEC, Incremental zone transfer (IXFR), Transaction Signatures (TSIG), DNS Notify, Transaction Key (TKEY), etc. Let’s get started!
What Is Bind 9 DNS?
Bind 9 DNS is a highly flexible and fully featured DNS system that is available in every application. This transparent open source solution is licensed under the MPL 2.0 license, which means users are free to add functionality to the Bind 9 and contribute back to the community through open Gitlab.
Today, almost every Internet connection begins with a DNS lookup. Before your mail, the server sends an email, which provides a DNS lookup to resolve a DNS name and IP address. You can use Bind 9 successfully on every application that includes publishing the DNS root zone and many top level domains, hosting providers who publish very large zone files with many small zones, enterprises with internal and external zones, and service providers with large resolver farms.
Bind 9 constitutes the following features and capabilities:
Authoritative DNS – It published DNS under the server’s authoritative control.
Basic DNS Load Balancing – It can be achieved using several A records under one name.
Dynamic Update – It enables you to add, replace, or delete records in a primary server by sending a special type of DNS message.
Split DNS – It provides different views of the DNS space to internal and external resolvers
Transaction Keys – With the help of this key, you can negotiate a shared secret between two hosts efficiently.
Transaction Signatures – It helps you to authenticate DNS messages by cryptographically signing them with a shared secret.
Incremental Zone Transfer – With the help of Incremental Zone Transfer, you can transfer only modified data to the secondary server.
DNS Notify – It enables the primary DNS server to notify a secondary server of changes to zone data.
Cache Only DNS – It provides DNS name resolution for applications by replaying requests to an authoritative server or acting as a secondary DNS that holds a read -only copy of the authoritative zone file.
Benefits Of Bind 9 DNS
The benefits of Bind 9 DNS are as follows:
Bind 9 DNS has broad usage and a strong community. It is considered a de facto standard for DNS in Linux systems and is actively supported by a large open source community.
Bind 9 DNS supports Linux, NetBSD, FreeBSD, OpenBSD, macOS, and Windows.
Bind 9 is the only DNS server that covers all the basic DNS functionality.
Bind 9 is used in several production DNS servers and is also known for stable and predictable operations.
Follow this post to navigate through how to install the Bind DNS server on CentOS Stream 9 Server (Setup/Configure).
By default, Bind DNS listens on the localhost. So you will need to configure it to listen to your IP address. You can do it by editing the Bind DNS default configuration file:
Next, you will need to create a forward and reverse lookup configuration file to resolve the DNS query. You can define both by editing named.rfc1912.zones configuration file:
nano /etc/named.rfc1912.zones
Add the following lines:
zone "testdomain.com" {
type master;
file "https://net.cloudinfrastructureservices.co.uk/var/named/forward.testdomain.com";
};
zone "0.168.192.in-addr.arpa" {
type master;
file "https://net.cloudinfrastructureservices.co.uk/var/named/reverse.testdomain.com";
};
Save and close the file then verify the configuration file with the following command:
named-checkconf
If everything is fine, you should not get any output.
Create forward lookup file
Next, create a forward lookup file using the following command:
nano /var/named/forward.testdomain.com
Add the following configuration:
$TTL 604800
@ IN SOA nameserver.testdomain.com. root.nameserver.testdomain.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
@ IN NS nameserver.testdomain.com.
nameserver IN A 192.168.0.25
ftp IN A 192.168.0.25
@ IN AAAA ::1
Save and close the file then create a reverse lookup configuration file:
nano /var/named/reverse.testdomain.com
Add the following lines:
$TTL 604800
@ IN SOA nameserver.testdomain.com. root.nameserver.testdomain.com. (
1
604800
86400
2419200
604800 )
@ IN NS nameserver.testdomain.com.
nameserver IN A 192.168.0.25
25 IN PTR nameserver.testdomain.com.
Save and close the file when you are done.
To check the forward lookup configuration file, run the following command:
At this point, Bind DNS server is installed and configured. Now, you will need to test whether it functions properly or not. You can use the dig tool to test the DNS server.
Run the dig command against your DNS nameserver as shown below:
dig nameserver.testdomain.com
You should see the name to IP resolution in the following output:
; <<>> DiG 9.11.36-RedHat-9.11.36-3.el8 <<>> nameserver.testdomain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52312
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: f28984410b46e4d0fe2aa38f62b9380dc368187fe9b0d441 (good)
;; QUESTION SECTION:
;nameserver.testdomain.com. IN A
;; ANSWER SECTION:
nameserver.testdomain.com. 604800 IN A 192.168.0.25
;; AUTHORITY SECTION:
testdomain.com. 604800 IN NS nameserver.testdomain.com.
;; Query time: 0 msec
;; SERVER: 192.168.0.25#53(192.168.0.25)
;; WHEN: Mon Jun 27 04:54:37 UTC 2022
;; MSG SIZE rcvd: 112
Next, run the dig command against your DNS server IP:
dig -x 192.168.0.25
You should see the IP to name resolution in the following output:
Great effort! Today we have learned how to Install Bind DNS on CentOS Stream 9 Server (Setup/Configure). Let’s conclude.
How to Install Bind DNS on CentOS Stream 9 Server Conclusion
The Bind DNS is simple, easy to use and customizable which provides administrators with granular control over a DNS server. It is compatible with almost all major Linux distributions and can run on Windows hosts.
In this post we have learned how to install and configure the Bind DNS server on Centos 9 Steam. We also create a forward and reverse lookup zone file and test the DNS functionality using the dig command. I hope this guide will help you to set up the Bind DNS server in your environment to resolve DNS queries.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.