🐧
Linux

Configuring DNS with Bind9 on Linux: full guide

πŸ“… 19 October 2026 ✏️ 19 October 2026 ⏱ 5 min leestijd

Learn step by step how to configure DNS with Bind9 on Linux, including zone files, records, and fixing common errors.

You configure DNS with Bind9 on Linux by installing the packages, creating a zone file for your domain, and linking it in Bind9’s configuration files. Then you check the syntax and restart the service. In this article, we’ll walk through the entire process, including the most commonly used DNS records and common mistakes.

What is Bind9 and when do you use it

Bind9 (Berkeley Internet Name Domain) is one of the most widely used DNS servers in the world and comes standard with nearly every Linux distribution. With Bind9, you manage the resolution of domain names to IP addresses yourself, instead of leaving this to an external DNS provider.

You’d choose your own Bind9 server if you want full control over your DNS records, want to manage multiple domains centrally, or need your own authoritative nameserver for a hosting environment. However, for most websites, a managed DNS solution suffices without having to maintain a server yourself. If you’re considering that, check out the options for domain names where DNS management is already arranged.

πŸ’‘ Tip: Are you running Bind9 only for internal purposes or test environments? Then disable recursion in named.conf.options to prevent abuse as an open resolver.

Installing Bind9 on Linux

The installation differs slightly per distribution, but the principle is the same everywhere: you install the package, check the status, and then adjust the configuration files.

1

Installing packages

On Debian and Ubuntu, use sudo apt update && sudo apt install bind9 bind9utils bind9-doc. On RHEL-based systems, use sudo dnf install bind bind-utils.

2

Checking the service

Check whether the service is running with sudo systemctl status named or sudo systemctl status bind9, depending on the distribution. Enable the service with systemctl enable.

3

Exploring the configuration directory

The most important files are located in /etc/bind/: named.conf.options for general settings, named.conf.local for your own zones, and the /etc/bind/zones/ directory for the zone files themselves.

4

Opening the firewall

Make sure port 53 (both TCP and UDP) is open, for example with sudo ufw allow 53, so that other servers can make DNS requests.

Setting up a zone file

A zone represents a domain for which your server is authoritative. First, you register the zone in named.conf.local:

zone "voorbeeld.nl" {
type master;
file "/etc/bind/zones/db.voorbeeld.nl";
};

Then you create the corresponding zone file, for example /etc/bind/zones/db.voorbeeld.nl, containing the actual DNS records:

$TTL 3600
@ IN SOA ns1.voorbeeld.nl. admin.voorbeeld.nl. (
2024010101 ; serial
3600 ; refresh
1800 ; retry
604800 ; expire
3600 ) ; minimum
@ IN NS ns1.voorbeeld.nl.
@ IN A 203.0.113.10
www IN A 203.0.113.10
mail IN A 203.0.113.20
@ IN MX 10 mail.voorbeeld.nl.

The most commonly used record types are: A (IPv4 address), AAAA (IPv6 address), CNAME (alias), MX (mail server), and TXT (text records, for example for SPF and DKIM). Don’t forget to increase the serial number in the SOA record after each change, otherwise secondary nameservers won’t pick up the change.

If you’d rather route your mail through a professional solution instead of managing TXT and MX records for spam filtering yourself, check out business email with ready-made security settings.

UserBind9NameserverZone fileA, MX, TXTRequest is looked up and answered

Testing the configuration and common errors

Before restarting Bind9, always check the syntax. This prevents your DNS service from failing completely due to a typo.

Use sudo named-checkconf to check the general configuration and sudo named-checkzone voorbeeld.nl /etc/bind/zones/db.voorbeeld.nl to specifically validate the zone file. If there are no error messages, restart the service with sudo systemctl restart named.

Then test whether resolution works with dig @localhost voorbeeld.nl or from another machine with dig @your-server-ip voorbeeld.nl. If you don’t get a response, check in sequence: the firewall, whether the zone has loaded correctly in the logs (journalctl -u named), and whether the serial number in the SOA record has actually been increased after changes.

Common mistakes include missing trailing dots on FQDNs in the zone file, incorrect file permissions on the zone files, and forgetting to open port 53 in the firewall. If you get stuck or would rather not maintain your own DNS server, you’ll find more background articles in the knowledge base, or you can leave DNS management to a provider that already sets this up for you.

Frequently asked questions

Do I need a secondary nameserver alongside Bind9?

For production environments, this is strongly recommended. A second (slave) nameserver provides redundancy, so your domain remains reachable if the primary server goes down.

Why doesn’t my DNS change take effect immediately?

DNS changes are cached based on the TTL value you set. If you modify a record, it may take a while before all resolvers worldwide retrieve the new value.

Can I use Bind9 for multiple domains?

Yes, you add a separate zone declaration per domain in named.conf.local with its own zone file. This way you manage multiple domains from a single server.

Is managing DNS yourself with Bind9 sensible for a small website?

For a simple website, it’s often easier and more reliable to place DNS management with a hosting provider, so you don’t have to maintain a server for updates and security.

Conclusion

With Bind9, you manage DNS entirely yourself: install the package, register your zone, fill the zone file with the correct records, and thoroughly test the configuration before going live. Pay close attention to the serial number, file permissions, and firewall rules to prevent common issues. If you’d rather not manage this yourself, switching to a provider that already handles DNS and hosting for you is often easier.

View web hosting β†’

Was dit artikel nuttig?