#Update Your System:
sudo apt-get update
-Install BIND9:
sudo apt-get install bind9 bind9utils bind9-doc
--Configure BIND9 Options:
Edit the /etc/bind/named.conf.options file to set up forwarders
sudo nano /etc/bind/named.conf.options
--Add the following lines within the options block:
forwarders {
8.8.8.8; // Google's DNS
8.8.4.4; // Google's DNS
};
--Set Up Forward and Reverse Zones:
Edit the /etc/bind/named.conf.local file to define your zones:
sudo nano /etc/bind/named.conf.local
Add the following lines:
zone "rkilab.local" {
type master;
file "/etc/bind/db.rkilab.local";
};
zone "32.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.192.168.32";
};
-- Create Zone Files:
Copy the default zone files to create your own:
sudo cp /etc/bind/db.local /etc/bind/db.rkilab.local
sudo cp /etc/bind/db.127 /etc/bind/db.192.168.32
Edit the /etc/bind/db.rkilab.local file:
sudo nano /etc/bind/db.rkilab.local
Update it with your domain details:
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.rkilab.local. admin.rkilab.local. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.rkilab.local.
ns IN A 192.168.32.131
www IN A 192.168.32.131
-Edit the /etc/bind/db.192.168.32 file:
sudo nano /etc/bind/db.192.168.32
Update it with your reverse zone details:
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.rkilab.local. admin.rkilab.local. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.rkilab.local.
131 IN PTR rkilab.local.
--Check Configuration and Restart BIND9:
Check the configuration files:
sudo named-checkconf
sudo named-checkzone rkilab.local /etc/bind/db.rkilab.local
sudo named-checkzone 32.168.192.in-addr.arpa /etc/bind/db.192.168.32
--Restart BIND9:
sudo systemctl restart bind9
sudo systemctl status bind9
-- Update Resolv.conf:
Edit the /etc/resolv.conf file to use your DNS server:
sudo nano /etc/resolv.conf
#Add the following line:
nameserver 192.168.32.131
-- Test Your DNS Server:
Use nslookup or dig to test your DNS server:
nslookup rkilab.local
dig rkilab.local