1. Install BIND9
Update your packages and install the BIND9 service:
sudo apt update
sudo apt install bind9 bind9utils bind9-doc
2. Configure the Zone
Open the local configuration file to define your domain:
sudo nano /etc/bind/named.conf.local
Paste this block inside, replacing “example.com” with your domain:
zone "example.com" {
type master;
file "/etc/bind/://example.com";
};
3. Create the Record File
Create the zone file from a template and open it:
sudo cp /etc/bind/db.local /etc/bind/://example.com
sudo nano /etc/bind/://example.com
Update the records with your server IP:
$TTL 604800
@ IN SOA ://example.com. ://example.com. (
2023101001 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Cache TTL
;
@ IN NS ://example.com.
ns1 IN A 192.168.1.10
www IN A 192.168.1.10
4. Set Up Forwarders
To let the server resolve external sites, edit the options file:
sudo nano /etc/bind/named.conf.options
Add these IPs to the forwarders block:
forwarders {
1.1.1.1;
8.8.8.8;
};
5. Restart and Apply
Verify your syntax and restart the service:
sudo named-checkconf
sudo systemctl restart bind9
Do you want me to add the UFW firewall commands to this list so the DNS port is actually open?
Leave a Reply