This guide followed from : https://docs.pi-hole.net/guides/vpn/openvpn/installation/
This script will install openVPN with PiHole with all required iptables rules enabled. This script can install with Digitalocean Anchor IP too (10.15.xx.xx). So you could access the PiHole interface via your desired hostname.
1. UPDATE the server:
sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'
2. Download the OVPN installer from original OVPN source:
wget https://git.io/vpn -O openvpn-install.sh chmod +x openvpn-install.sh
3. For client user/password feature:
*Edit the installer to have password login feature:* EASYRSA_CERT_EXPIRE=3650 ./easyrsa build-client-full "$client" nopass to EASYRSA_CERT_EXPIRE=3650 ./easyrsa build-client-full "$client"
4. RUN the installer:
5. Install PiHole
curl -sSL https://install.pi-hole.net | bash
6. Set OVPN clients DNS to follow PiHole service
nano /etc/openvpn/server/server.conf Delete: if any previous entries of " push "dhcp-option DNS xxxxx" " Add: push "dhcp-option DNS 10.8.0.1"
7. Finally restart both services Or better to reboot now.
pihole disable && pihole enable && systemctl restart openvpn-server@server