What is BIND?
The Berkeley Internet Name Domain (BIND) is the most widely used Domain Name System (DNS) software on the Internet. It translates human-readable domain names (like www.example.com) into IP addresses that computers use to communicate. Setting up a private BIND server on your internal network allows you to resolve custom local domain names for your company’s internal servers and applications without exposing them to the public internet.
Step 1: Install BIND9
Open your terminal, update your package index, and install the bind9 package, along with the bind9utils package for helpful administration tools:
sudo apt update
sudo apt install bind9 bind9utils bind9-doc -y
The service will start automatically upon installation.
Step 2: Configure the Global Options
The main configuration files for BIND on Ubuntu are located in the /etc/bind/ directory. First, edit the global options file:
sudo nano /etc/bind/named.conf.options
Inside the options { ... } block, add an Access Control List (ACL) to ensure only your internal network (e.g., 192.168.1.0/24) can query this server. Set up forwarders to pass unresolved external queries (like google.com) to a public DNS server (like Google or Cloudflare):
acl "trusted" {
127.0.0.0/8;
192.168.1.0/24;
};
options {
directory "/var/cache/bind";
recursion yes;
allow-query { trusted; };
forwarders {
8.8.8.8;
1.1.1.1;
};
};
Step 3: Define a Local Zone
Next, you must tell BIND which local domain it is authoritative for (e.g., corp.local). Edit the local configuration file:
sudo nano /etc/bind/named.conf.local
Append a new zone definition pointing to the file where the DNS records will actually be stored:
zone "corp.local" {
type master;
file "/etc/bind/zones/db.corp.local";
};
Step 4: Create the Zone File
Create the directory for your zone files and create the new database file you just defined:
sudo mkdir /etc/bind/zones
sudo nano /etc/bind/zones/db.corp.local
Input your DNS records using the standard BIND format. Here is a basic example containing an SOA (Start of Authority), NS (Name Server), and an A record for a web server:
$TTL 604800
@ IN SOA ns1.corp.local. admin.corp.local. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns1.corp.local.
ns1 IN A 192.168.1.10
web IN A 192.168.1.50
Step 5: Check Syntax and Restart
BIND is notoriously strict about syntax errors. Before restarting the service, use the built-in utilities to check your configuration and zone files for typos:
sudo named-checkconf
sudo named-checkzone corp.local /etc/bind/zones/db.corp.local
If both commands return “OK”, restart the BIND service:
sudo systemctl restart bind9
You can now configure client computers on your network to use your Ubuntu server’s IP address as their primary DNS server, and they will successfully resolve web.corp.local!