BIND (Berkeley Internet Name Domain) is one of the most widely-used DNS server software. It allows you to resolve domain names to IP addresses, making it a critical part of network infrastructure. In this guide, we will walk you through the steps to install and configure BIND on Rocky Linux 9. Whether you’re setting up a DNS server locally or deploying it on a Windows VPS UK, this guide will help you get your DNS server up and running.
Step 1: Update Your System
Before installing BIND, it’s important to update your system to ensure all software packages are up to date. Run the following commands to update your Rocky Linux 9 system:
sudo dnf update -y
Keeping your system updated ensures that you have the latest security patches and software updates. Whether you’re working on a local server or hosting on a UK Windows VPS, this is an essential step.
Step 2: Install BIND
BIND is available in the default Rocky Linux repositories, so you can install it using the dnf
package manager. Run the following command to install BIND and related utilities:
sudo dnf install bind bind-utils -y
Once the installation is complete, you can proceed with configuring the DNS server. This installation is suitable whether you’re deploying BIND locally or on a VPS Windows Servers platform.
Step 3: Configure BIND
BIND’s main configuration file is located at /etc/named.conf
. Open this file to configure your DNS server:
sudo nano /etc/named.conf
In the configuration file, make sure to allow queries from your local network. Update the listen-on
and allow-query
directives to permit connections:
options {
listen-on port 53 { 127.0.0.1; any; };
allow-query { localhost; any; };
recursion yes;
};
This configuration allows DNS queries from any IP address. If you only want to allow specific IP addresses to query your DNS server, you can specify them in the allow-query
directive. Whether you're configuring BIND for local use or on a Windows VPS hosting UK environment, this setup ensures your DNS server responds to queries correctly.
Step 4: Configure Zone Files
To manage domain names with your DNS server, you need to create zone files. A zone file defines mappings between domain names and IP addresses. First, create a zone configuration in the named.conf
file. Add the following lines at the end of the file:
zone "example.com" {
type master;
file "/var/named/example.com.zone";
allow-update { none; };
};
Now, create the actual zone file for the domain:
sudo nano /var/named/example.com.zone
Add the following content to the zone file:
$TTL 86400
@ IN SOA ns1.example.com. admin.example.com. (
2024010101 ; Serial
3600 ; Refresh
1800 ; Retry
1209600 ; Expire
86400 ) ; Minimum TTL
@ IN NS ns1.example.com.
@ IN A 192.168.1.100
ns1 IN A 192.168.1.100
www IN A 192.168.1.101
This example maps the domain example.com
to IP addresses 192.168.1.100
and 192.168.1.101
. Adjust these values to suit your environment, whether it’s a local network or a Windows VPS Italy server.
Step 5: Start and Enable BIND
After configuring BIND, start the service and enable it to run at boot:
sudo systemctl start named
sudo systemctl enable named
Check the status of the BIND service to ensure it’s running properly:
sudo systemctl status named
If everything is set up correctly, BIND will now be running and responding to DNS queries. This configuration works whether you’re deploying a local DNS server or hosting it on a Windows Virtual Private Server hosting solution.
Step 6: Configure Firewall
To ensure your DNS server can receive and respond to queries, you need to allow DNS traffic through the firewall. Run the following commands to open port 53 for both TCP and UDP:
sudo firewall-cmd --permanent --add-port=53/tcp
sudo firewall-cmd --permanent --add-port=53/udp
sudo firewall-cmd --reload
This allows DNS traffic to pass through the firewall, ensuring your BIND server can respond to requests. This step is crucial whether you're running the DNS server on a local machine or a Windows VPS hosting UK platform.
Step 7: Test Your DNS Server
After configuring and starting BIND, it’s important to test your DNS server to ensure it’s functioning correctly. Use the dig
command to query your DNS server:
dig @localhost example.com
This command will query your DNS server for the example.com
domain. You should receive a response with the correct IP address based on your zone file. This test applies whether you’re running BIND on a local server or a VPS Windows Servers setup.