There you go! PureVPN is now automatically connected on startup.
Congratulations; you have setup PureVPN on your Raspberry Pi!
Raspberry Pi (OpenVPN)
Install the DNS forwarder
A DNS forwarder accepts DNS requests from clients and forwards them to real name servers, for example; 126.96.36.199 for Google. This, in turn, prevents DNS leaks when clients are utilizing the Pi as a router or gateway. We will use dnsmasq as our DNS forwarder for this project:
sudo apt-get install -y dnsmasq
Uncomment the ‘domain-needed’ and ‘bogus-priv’ settings:
# Never forward plain names (without a dot or domain part)domain-needed# Never forward addresses in the non-routed address spaces.bogus-priv
Uncomment the ‘interface’ setting, set it to eth0:
# If you want dnsmasq to listen for DHCP and DNS requests only on# specified interfaces (and the loopback) give the name of the# interface (eg eth0) here.# Repeat the line for more than one interface.interface=eth0
Save the file. To continue with the changes, restart the dnsmasq service:
sudo service dnsmasq restart
sudo apt-get install -y openvpn
Download the OpenVPN configuration files and extract them to pi user’s home folder/home/pi/openvpn
If you want to follow the connection process in the logs, open another ssh session and execute the following command:
sudo tail -f /var/log/syslog
Any openvpn connection errors will be shown.
Usually log files eat up significant space on a disk, to prevent it, we’ll use logrotate. This service comes pre-installed in the Raspbian build. Edit the logrotate configuration file:
sudo nano /etc/logrotate.conf
change the rotate frequency to daily, and the backlogs to 4. Here is what the top section of the file should look like:
# see “man logrotate” for details# rotate log files dailydaily# keep 4 days worth of backlogsrotate 4
The firewall used by Raspbian is configured using iptables. It allows or blocks connections based on a number of rules. To allow the forwarding of http and dns connections, we will start with a working set of iptables rules. A script to load these rules is included. If you have not downloaded the VPN Client Gateway project files to your Pi, you should do so now:
Run the firewall script to load the iptables rules. You’ll find the script in the folder vpn_client_gateway-master/fw:
To save these rules so that they reload at boot time, we’ll use the iptables-persistent utility.
sudo apt-get install -y iptables-persistent
While the installation is being done, the program will ask you to save the current iptables rules (ipV4 and ipV6). You should acknowledge both prompts and the iptables rules will be saved and re-loaded at boot time.
Enable IP forwarding and disable IPV6
sudo nano /etc/sysctl.conf
Uncomment the following setting:
net.ipv4.ip_forward = 1
Add the following line:
To enable the changes, run the following command:
sudo sysctl -p /etc/sysctl.conf
How helpful did you find this answer?
You Love PureVPN - Share the Love by referring PureVPN to
your Friends and get surprise gifts