How to Install BIND9 for DNS Forwarding on Linux
1. Update your system
sudo apt update && sudo apt upgrade -y
2. Install BIND9
sudo apt install bind9 -y
3. Configure BIND9 as a DNS Forwarder
Edit the main configuration file:
sudo nano /etc/bind/named.conf.options
Add or modify the following lines inside the options { } block:
options {
directory "/var/cache/bind";
recursion yes;
allow-query { any; };
forwarders {
8.8.8.8;
8.8.4.4;
};
dnssec-validation auto;
};
4. Restart BIND9
sudo systemctl restart bind9
5. Enable BIND9 to start on boot
sudo systemctl enable bind9
6. Check BIND9 status
sudo systemctl status bind9
7. Test the DNS Forwarder
dig google.com @127.0.0.1
8. (Optional) Uninstall BIND9
sudo apt remove --purge bind9 -y
sudo rm -rf /etc/bind
These are the steps to install and configure BIND9 as a DNS forwarder on Linux. Hope this helps!