Introduction

BIND (Berkeley Internet Name Domain) is one of the most widely used DNS server software applications. It allows you to set up and manage your own DNS server. In this guide, you will learn how to install and configure a DNS server with BIND on Rocky Linux 9, which can be effectively hosted on a Windows VPS UK for optimal performance and reliability.

Prerequisites

  • A Rocky Linux 9 server with root access
  • Basic knowledge of Linux commands
  • A registered domain name for your DNS setup

Step 1: Update Your System

Start by updating your package index and upgrading any existing packages:

sudo dnf update -y

Step 2: Install BIND

Install BIND and its utilities using the following command:

sudo dnf install bind bind-utils -y

Step 3: Configure BIND

Edit the main configuration file located at /etc/named.conf:

sudo nano /etc/named.conf

Make sure to allow queries from your network. You can add or edit the following lines in the options section:

options {
    listen-on port 53 { any; };
    listen-on-v6 { any; };
    directory     "/var/named";
    dump-file     "/var/named/data/cache_dump.db";
    statistics-file "/var/named/data/named_stats.txt";
    memstatistics-file "/var/named/data/named_mem_stats.txt";
    allow-query     { any; };
};

Step 4: Define Your Zone

To define a zone for your domain, add the following zone configuration to the same file:

zone "yourdomain.com" IN {
    type master;
    file "yourdomain.com.db";
};

Replace yourdomain.com with your actual domain name.

Step 5: Create Zone File

Create the zone file for your domain:

sudo nano /var/named/yourdomain.com.db

Add the following template content to the file:

$TTL 86400
@   IN  SOA     ns1.yourdomain.com. admin.yourdomain.com. (
            2024010101 ; Serial
            3600       ; Refresh
            1800       ; Retry
            604800     ; Expire
            86400 )    ; Negative Cache TTL
;

@       IN  NS      ns1.yourdomain.com.
ns1     IN  A       your.server.ip.address
@       IN  A       your.server.ip.address
www     IN  A       your.server.ip.address

Replace your.server.ip.address with your server's actual IP address.

Step 6: Set Permissions

Ensure the correct permissions are set for the zone files:

sudo chown root:named /var/named/yourdomain.com.db
sudo chmod 640 /var/named/yourdomain.com.db

Step 7: Start BIND Service

Start the BIND service and enable it to run on boot:

sudo systemctl start named
sudo systemctl enable named

Step 8: Configure Firewall

If you have a firewall enabled, allow DNS traffic:

sudo firewall-cmd --permanent --add-service=dns
sudo firewall-cmd --reload

Step 9: Test Your DNS Server

Use the dig command to test your DNS server:

dig @localhost yourdomain.com

You should see a response with your server's IP address.

Step 10: Conclusion

You have successfully installed and configured a DNS server with BIND on Rocky Linux 9. This setup provides a reliable DNS service that can greatly benefit from being hosted on a Windows VPS. For additional options, explore various VPS UK Windows solutions, including Windows Virtual Private Server Hosting and Windows VPS Hosting UK for optimal performance and reliability.

© 2024 BIND DNS Server Installation Tutorial. All rights reserved.

Hai trovato utile questa risposta? 0 Utenti hanno trovato utile questa risposta (0 Voti)