Tutorial!!! Instalasi & Konfigurasi DNS Server di Debian 10 Virtualbox

3 min read 11 months ago
Published on Sep 11, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial will guide you through the installation and configuration of a DNS server on Debian 10 using VirtualBox. Setting up a DNS server is crucial for managing domain names and ensuring that users can access resources on your network effectively.

Step 1: Set Up VirtualBox and Debian 10

  • Download and install VirtualBox from the official site.
  • Obtain the Debian 10 ISO file from the Debian website.
  • Create a new virtual machine in VirtualBox:
    • Click on "New" and name your VM (e.g., "Debian DNS Server").
    • Select "Linux" as the type and "Debian (64-bit)" as the version.
    • Allocate memory (at least 1 GB recommended).
    • Create a virtual hard disk (VDI) with at least 10 GB of space.
  • Start the VM and select the Debian 10 ISO to begin installation.
  • Follow the installation prompts:
    • Choose language and location settings.
    • Configure network settings (use DHCP or set a static IP).

Step 2: Install Required Packages

  • After logging into your Debian system, open the terminal.
  • Update the package list with the following command:
    sudo apt update
    
  • Install the DNS server package (BIND9) by running:
    sudo apt install bind9 bind9utils bind9-doc
    

Step 3: Configure the DNS Server

  • Open the BIND configuration file:
    sudo nano /etc/bind/named.conf.local
    
  • Define your DNS zone:
    • Add the following lines to configure a forward zone:
      zone "example.com" {
          type master;
          file "/etc/bind/db.example.com";
      };
      
  • Create the zone file:
    • Copy the existing db.local file:
      sudo cp /etc/bind/db.local /etc/bind/db.example.com
      
    • Edit the new zone file:
      sudo nano /etc/bind/db.example.com
      
    • Update the file with your domain information:
      $TTL    604800
      @       IN      SOA     ns.example.com. admin.example.com. (
                                2         ; Serial
                           604800         ; Refresh
                            86400         ; Retry
                          2419200         ; Expire
                           604800 )       ; Negative Cache TTL
      ;
      @       IN      NS      ns.example.com.
      ns      IN      A       192.168.1.10
      @       IN      A       192.168.1.10
      www     IN      A       192.168.1.10
      

Step 4: Check Configuration and Restart BIND9

  • Verify the BIND configuration for errors:
    sudo named-checkconf
    
  • Check the zone file for errors:
    sudo named-checkzone example.com /etc/bind/db.example.com
    
  • If no errors are found, restart the BIND service:
    sudo systemctl restart bind9
    

Step 5: Configure Firewall

  • Ensure that your firewall allows DNS traffic (UDP and TCP on port 53):
    sudo ufw allow 53
    sudo ufw enable
    

Conclusion

You have successfully installed and configured a DNS server on Debian 10 using VirtualBox. Make sure to test your DNS configuration by querying the server with tools like dig or nslookup. As next steps, consider setting up additional records or configuring secondary DNS servers for redundancy.