How to Set Up a DNS Server (Bind9)
Introduction
Running your own DNS server gives you full control over domain name resolution. This guide shows you how to install and configure Bind9 on your Ubuntu VPS.
Step-by-step Guide
- Update your package list
- sudo apt update
- Install Bind9
- sudo apt install -y bind9 bind9utils bind9-doc
- Check Bind9 status
- sudo systemctl status bind9
- Configure your DNS zone
- Edit the configuration file:n
- sudo nano /etc/bind/named.conf.local
- Add your zone configuration, for example:n
- zone "example.com" {
type master;file "/etc/bind/db.example.com";- };
- Edit the configuration file:n
- Create the zone file
- sudo cp /etc/bind/db.local /etc/bind/db.example.com
- sudo nano /etc/bind/db.example.comn
- Edit the file to match your domain and records.
- Check configuration syntax
- sudo named-checkconf
- sudo named-checkzone example.com /etc/bind/db.example.com
- Restart Bind9
- sudo systemctl restart bind9
- (Optional) Allow DNS through the firewall
- sudo ufw allow 53
- sudo ufw reload
Recommendations
- Set correct permissions for your zone files.
- Regularly back up your DNS configuration.
- Use external DNS monitoring for uptime and propagation.
Call To Action
eed a VPS for your DNS server? Check out our hosting plans: https://xernode.com/#pricing
Related Guides
- How to Set Up Firewall (UFW) in Ubuntu
- How to Set Up a Web Proxy with Squid
- How to Install and Use dig