Many VPN providers have support for openvpn. VPN providers 'usually have a separate .ovpn file for each individual server. Some frequently change their keys, passwords and certificates. As a result, it is easier to invoke openvpn from the command line rather than loading and unloading .ovpn configurations into a network manager.
Become root using the following command.
su -
Note the dash at the end of the su command. This is required because we will be running tools from the sbin directories.
Install openvpn and resolvconf packages using the following command.
apt-get install openvpn resolvconf
Since we want to invoke openvpn from the command line, we don't want openvpn running a daemon. To accomplish this, issue the following commands.
/etc/init.d/openvpn stop
update-rc.d openvpn disable
wget https://freevpnme.b-cdn.net/FreeVPN.me-OpenVPN-Bundle-July-2020.zip
unzip FreeVPN.me-OpenVPN-Bundle-July-2020.zip
cd FreeVPN.me-OpenVPN-Bundle-July-2020/FreeVPN.me\ -\ Server1-NL
Add the following lines to each .ovpn file to prevent DNS leakage.
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
Instead of adding manually, you can use the following script below.
#!/bin/bash
for i in *.ovpn
do
sed -i "/auth-user-pass/a script-security 2\\
up /etc/openvpn/update-resolv-conf\\
down /etc/openvpn/update-resolv-conf" $i
done
For example, If you want to connect to the freevpn.me VPN server over TCP at port 443, invoke openvpn as root with the following command.
openvpn Server1-TCP443.ovpn
Enter the username and password when prompted from the freevpn.me web site here
To stop openvpn, press the Ctrl+c keys simultaneously.
Go to https://www.dnsleaktest.com/
Make sure that this web page is reporting your VPN provider's IP address and not your Internet Service Provider's IP address.
Click on Standard Test
.
Make sure that the IP addresses reported are from your VPN provider and not from your Internet Service Provider'.
Corrections and Comments are welcome.
]]>