OSETC TECH

Linux: Pi-Hole with OpenVPN to Block Ads

This post will guide you how to install and configure an OpenVPN on your Linux server. How do I install OpenVPN on your Ubuntu/CentOs server. How to install and configure Pi-Hole tool to block ads in your OpenVPN server.

What is OpenVPN?


OpenVPN is a free and open-source software application that implements virtual private network techniques to create secure point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities. It uses a custom security protocol that utilizes SSL/TLS for key exchange.

What is Pi-Hole?


Pi-hole is a Linux network-level advertisement and internet tracker blocking application which acts as a DNS sinkhole, intended for use on a private network.

Install OpenVPN


To setup an OpenVPN server, you need to install the openvpn package firstly in your linux server.

For Ubuntu Linux:

you just need to run the following command to install OpenVPN package, type:

$ sudo apt-get update
$ sudo apt-get install openvpn

Or you can use an script called openvpn-install.sh to install and configure your openvpn server, type the following command:

$ wget https://git.io/vpn -O openvpn-install.sh
$ sudo ./openvpn-install.sh

Install Pi-Hole


Before install pi-hole package, you need to set a static IP address for your server, just update the /etc/network/interfaces file under Ubuntu Linux, type:

$ sudo nano /etc/network/interfaces

replace the following line:

auto eth0
iface eth0 inet dhcp

With the following line:

auto eth0
iface eth0 inet static
address 192.168.1.20
netmask 255.255.255.0
gateway 192.168.1.1

save and close the file.

then you can get the pi-hole tool via git clone, type:

$ sudo git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole
$ cd Pi-hole/automated install/
$ sudo bash basic-install.sh