Since we specify the VPN server as the DNS server for clients, we need to run a DNS resolver on the VPN server.
We can install the bind9
DNS server:
sudo apt install bind9
systemctl status named
sudo systemctl start named
sudo nano /etc/bind/named.conf.options
Add the following line to allow VPN clients to send recursive
DNS queries:
allow-recursion { 127.0.0.1; 192.168.30.0/24; };
sudo nano /etc/default/named
Add -4 to the OPTIONS to ensure BIND can query root
DNS servers:
OPTIONS="-u bind -4"
By default, BIND enables DNSSEC, which ensures that
DNS responses are correct and not tampered with. However, it might not work out of the box due to trust anchor rollover and other reasons. To make it work properly, we can rebuild the managed key database with the following commands:
sudo rndc managed-keys destroy
sudo rndc reconfig
sudo systemctl restart named
sudo ufw insert 1 allow in from 192.168.30.0/24