Configuring DNS Servers in Kalilinux: db.system.com and db.testing.com

Abstract: Configure BIND9 to serve db.system.com and db.testing.com by defining zones in named.conf.local, creating zone files in /etc/bind, and setting correct permissions.

Created: 2026-09-30 by

To configure DNS servers for db.system.com and db.testing.com in Kali Linux, you must install BIND9, define the zones in named.conf.local, and place the zone data files in /etc/bind. This ensures proper permissions and allows the service to reload correctly without runtime errors associated with incorrect directory placement.

Installing and Verifying BIND9

Kali Linux uses Debian-based package management, so the first step is installing the Berkeley Internet Name Domain (BIND) software. Open a terminal and update your package list to ensure you have the latest definitions, then install the server package.

sudo apt update
sudo apt install bind9 bind9-utils dnsutils

After installation, verify that the BIND9 service is installed correctly by checking its version. The command named -v should return the installed version string. It is also prudent to check if the service is currently running or enabled on boot using systemctl status bind9. By default, Kali may not start the DNS service immediately after installation, so you will need to enable it later in the configuration process.

Configuring Zone Definitions

The core of the configuration lies in telling BIND where to find the data for your specific domains. You must edit the local configuration file, which acts as the entry point for zone declarations. Use a text editor such as nano or vim to open /etc/bind/named.conf.local.

sudo nano /etc/bind/named.conf.local

Add the following lines to this file. Each block defines a forward lookup zone. Replace db.system.com and db.testing.com with the actual filenames you intend to create. The type master indicates that this server is the authoritative source for these zones.

zone "system.com" {
    type master;
    file "/etc/bind/db.system.com";
};

zone "testing.com" {
    type master;
    type master;
    file "/etc/bind/db.testing.com";
};

Note that the domain names in the zone directive must match the actual domain suffixes (e.g., system.com, not db.system.com). The file parameter points to the physical location of the zone database. As previously noted in editorial feedback, these files must reside in /etc/bind, which is the standard directory for BIND configuration and data on Debian-based systems. Placing them in /var/lib/bind is incorrect because that directory is intended for runtime state files like named.run and journal files, not static configuration data.

Creating Zone Data Files

Now that the paths are defined in the configuration, you must create the actual zone files. These files contain the records that map hostnames to IP addresses. Start by creating a template file that you can copy for each domain. Create /etc/bind/db.system.com with the following content:

$TTL 86400
@   IN  SOA ns1.system.com. admin.system.com. (
          2023101001 ; Serial
          3600       ; Refresh
          1800       ; Retry
          604800     ; Expire
          86400 )    ; Minimum TTL

; Name Servers
@       IN  NS      ns1.system.com.

; A Records
ns1     IN  A       192.168.1.10
server1 IN  A       192.168.1.11

Ensure you replace the IP addresses and hostnames with values relevant to your network topology. The SOA record is mandatory and contains administrative information about the zone. The serial number should be incremented every time you make changes to the file to ensure secondary servers (if any) can detect updates. Copy this structure to create /etc/bind/db.testing.com, adjusting the domain-specific details accordingly.

Setting Permissions and Starting the Service

Permissions are critical for BIND security. The named user needs read access to the zone files. Run the following commands to set the correct ownership and permissions:

sudo chown root:bind /etc/bind/db.system.com
sudo chown root:bind /etc/bind/db.testing.com
sudo chmod 640 /etc/bind/db.system.com
sudo chmod 640 /etc/bind/db.testing.com

Before starting the service, it is highly recommended to test the configuration syntax. Use the named-checkconf utility to validate named.conf.local and the main config. Then use named-checkzone to validate the individual zone files:

sudo named-checkconf
sudo named-checkzone system.com /etc/bind/db.system.com
sudo named-checkzone testing.com /etc/bind/db.testing.com

If all checks pass, start the BIND9 service and enable it to start at boot:

sudo systemctl start bind9
sudo systemctl enable bind9

Verify the service is active with systemctl status bind9. If the service fails to start, check the logs in /var/log/syslog for detailed error messages. Common issues include typos in the zone files or permission denials.

Testing the Configuration

Once the service is running, test resolution from the local machine. Use dig or nslookup to query the local DNS server. For example:

dig @127.0.0.1 system.com
dig @127.0.0.1 testing.com

If you encounter connectivity issues while testing, refer to our guide on Troubleshooting: Cannot Connect to the Internet to rule out broader network stack problems. Additionally, if you are running this setup inside a virtual machine, ensure your NAT settings are not interfering with local DNS resolution, as discussed in VMWare 17 Player Linux NAT guest can ping but cannot resolve DNS names.

Frequently Asked Questions

Why did my DNS service fail to start after copying files?

This is most often caused by incorrect file permissions or ownership. Ensure that the zone files in /etc/bind are owned by root:bind and have permissions set to 640. BIND runs as the named user, which belongs to the bind group, and it requires read access to these files.

What is the difference between /etc/bind and /var/lib/bind?

/etc/bind is the configuration directory where zone files and named.conf reside. /var/lib/bind is a runtime directory used for dynamic updates, journal files, and cache data. Static zone data must always be placed in /etc/bind to adhere to Debian standards and ensure proper loading on startup.

How do I increment the serial number in a zone file?

The serial number is typically formatted as YYYYMMDDNN, where NN is a sequence number. When you modify the zone file, increase the last two digits. For example, change 2023101001 to 2023101002. After changing it, reload the service with systemctl reload bind9.

Can I use dnsmasq instead of BIND for simple setups?

Yes, dnsmasq is lighter and easier to configure for small networks. However, if you need complex zone transfers or advanced BIND features, stick with BIND9. If you encounter socket binding errors with dnsmasq, check our article on Why dnsmasq failed to create listening socket for 172.17.0.1.

How do I verify that my zone files are syntactically correct?

Use the named-checkzone command followed by the zone name and the file path. For example: sudo named-checkzone system.com /etc/bind/db.system.com. This tool will report specific line numbers and errors if the syntax is invalid, allowing you to fix issues before reloading the service.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More