> ## Content Index
> Fetch the complete content index at: https://blog.alphavps.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Configure BIND DNS Server on Ubuntu 24.04 VPS
- URL: https://blog.alphavps.com/how-to-configure-bind-dns-server-on-ubuntu-24-04-vps/
- Published: 2026-03-16T13:23:50.000Z
- Updated: 2026-09-08T15:18:05.000Z
- Author: Karim Buzdar
- Tags: Tutorials, Ubuntu, Networking

DNS (Domain Name System), the backbone of the internet, translates human-friendly domain names into computer-understandable IP addresses. BIND is the most popular DNS server software on Linux servers. It's known for its flexibility, reliability, and performance. Installing BIND on Ubuntu VPS 24.04 allows you to host domains and internal networks.

This guide will show you how to install, verify, and configure a BIND server on Ubuntu 24.04.

## How to Configure BIND DNS Server on Ubuntu 24.04 VPS

Installing BIND DNS on Ubuntu 24.04 gives you complete control over domain resolution and email routing. Your server can be used as a reliable DNS system by configuring forward and reverse zones. Follow these steps, from installation to testing, to build a robust DNS system that will ensure faster name resolution, higher uptime, and professional domain management for applications or websites.

### Step 1: Update Your System

Make sure that your system has been updated before installing any packages.

```bash
sudo apt update
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-f61c8887-0d46-4c8c-9593-b1c49b465f07.png)

Updates ensure that your Ubuntu VPS is running the latest stable packages and security patches for BIND.

### Step 2: Install BIND9 and DNS Utilities

Install BIND and its utilities by using:

```bash
sudo apt install bind9 bind9utils bind9-dnsutils
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-51687192-8f5e-4899-b59d-58f95b3f8537.png)

Here,

- **bind9**: the main DNS server package.
- **bind9utils**: provides configuration and debugging tools.
- **bind9-dnsutils**: includes DNS query tools like dig and lookup.

Install the software and then start it.

```bash
sudo systemctl enable named.service
sudo systemctl start bind9
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-bdc3de80-8fcc-4631-9d4b-9926965d1076.png)

Check the status of your order:

```bash
sudo systemctl status bind9
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-9b92c295-5b86-4d17-b603-92cda6c1ef20.png)

### Step 3: Configure the Primary DNS Zone

We will configure a forward-lookup zone to resolve domain names into IP addresses.

Edit the main configuration:

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

Replace example.com (your domain name) with the following zone definition:

```bash
zone "example.com" {
    type master;
    file "/etc/bind/db.example.com";
};
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-d6ee6f20-c809-4a27-91eb-1bab1685ae07.png)

This tells BIND to act as the master DNS server for example.com and store zone data in the file /etc/bind/db.example.com.

### Step 4: Create the Forward Zone File

Modify the template for your domain by copying and pasting it into the zone file:

```bash
sudo cp /etc/bind/db.local /etc/bind/db.example.com
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-730794cb-30f8-46ce-9f64-50f11a79ff18.png)

Let’s edit the file:

```bash
sudo nano /etc/bind/db.example.com
```

You can edit it like this:

```bash
$TTL    604800
@       IN      SOA     ns1.example.com. admin.example.com. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      ns1.example.com.
@       IN      A       192.168.1.10
ns1     IN      A       192.168.1.10
www     IN      A       192.168.1.11
mail    IN      A       192.168.1.12
@       IN      MX      10 mail.example.com.
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-654522a8-46ea-4e99-8f6e-556d77401337.png)

Here,

- **SOA (Start of Authority)** defines the primary DNS server and admin contact.
- **NS** specifies the name server record.
- **A** records map hostnames to IPs.
- **MX** defines mail exchange servers.

### Step 5: Configure the Reverse DNS Zone

Reverse DNS maps IP addresses to hostnames. Edit the configuration file once more:

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

Add this to your forward zone.

```bash
zone "1.168.192.in-addr.arpa" {
    type master;
    file "/etc/bind/db.192.168.1";
};
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-26184204-02fb-4ab0-bfb7-27d64e0d68d3.png)

Create the reverse zone file.

```bash
sudo cp /etc/bind/db.127 /etc/bind/db.192.168.1
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-480de6e2-0f93-4cc5-b7ee-154cbe9f2191.png)

Let’s edit:

```bash
sudo nano /etc/bind/db.192.168.1
```

Modify the following:

```bash
$TTL    604800
@       IN      SOA     ns1.example.com. admin.example.com. (
                              2
                         604800
                          86400
                        2419200
                         604800 )
;
@       IN      NS      ns1.example.com.
10      IN      PTR     ns1.example.com.
11      IN      PTR     www.example.com.
12      IN      PTR     mail.example.com.
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-5e8c9432-86c7-4be0-bf4e-24e7c61435bf.png)

This file defines Pointer (Pointer Records) that maps IP addresses (like 192.168.1.10) to hostnames.

### Step 6: Check BIND Configuration Syntax

Verify your DNS configuration before restarting the DNS service:

```bash
sudo named-checkconf
sudo named-checkzone example.com /etc/bind/db.example.com
sudo named-checkzone 1.168.192.in-addr.arpa /etc/bind/db.192.168.1
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-3c512fc5-3a2e-409d-b068-b80f2403a925.png)

### Step 7: Restart and Enable the BIND Service

Restart BIND in order to apply the configuration.

```bash
sudo systemctl restart bind9
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-d7eec68c-ea48-4eb5-94a0-c3f62eeb1612.png)

### Step 8: Test the DNS Server

Use the dig command to test your setup:

```bash
dig @localhost example.com
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-5cd70027-52ae-4cc7-aed6-40412afe0dff.png)

The expected output should include your server's address in the REPLY SECTION.

You can also try a reverse lookup.

```bash
dig -x 192.168.1.10 @localhost
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-3aed1ae0-50f1-4e73-b45b-82f50afd2ca2.png)

Your reverse zone configuration is correct if you see the domain name of your website in the response.

### Step 9: Adjust the Firewall

Allow DNS traffic if UFW is active

```bash
sudo ufw allow 53/tcp
sudo ufw allow 53/udp
sudo ufw reload
```

![](https://blog.alphavps.com/content/images/2025/11/data-src-image-e803379b-b4a8-4dfe-a231-171d7c91cf2d.png)

Port 53 is used to query DNS over TCP and UDP.

### Step 10: (Optional) Configure Secondary DNS Server

You can add this entry to the name med.conf.local of another VPS for redundancy.

```bash
zone "example.com" {
    type slave;
    masters { 192.168.1.10; };
    file "/var/cache/bind/db.example.com";
};
```

This setup replicates the zone data from your DNS master server to ensure continuous availability.

## Conclusion

To configure a BIND DNS server on Ubuntu 24.04 VPS, start by updating your system using sudo apt update && sudo apt upgrade -y, then install BIND with sudo apt install bind9 bind9utils bind9-dnsutils -y. Configure your domain by editing /etc/bind/named.conf.local to define a zone, such as example.com, and create its zone file in /etc/bind/db.example.com with the necessary SOA, NS, A, and MX records.

For reverse DNS, add a reverse zone in the same file and create /etc/bind/db.192.168.1 with corresponding PTR records. Verify your configuration with sudo namedcheckconf and sudo namecheckzone. Then restart BIND using sudo systemctl start bind9\. Test DNS resolution by using dig @localhost.com. This will ensure that your BIND DNS server works correctly.

If you’re looking for a [**Cheap VPS**](https://alphavps.com/cheap-vps.html?ref=blog.alphavps.com) solution for your next project, consider trying our hosting services.