Private Internet Access with OpenVPN: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
(Created page with "Install OpenVPN <pre> apt -y install openvpn </pre> Download PIA Config Files <pre> wget https://www.privateinternetaccess.com/openvpn/openvpn.zip -O /tmp/openvpn.zip </pre>...")
 
No edit summary
Line 4: Line 4:
apt -y install openvpn
apt -y install openvpn
</pre>
</pre>


Download PIA Config Files
Download PIA Config Files
Line 59: Line 60:
EOF
EOF
</pre>
</pre>
To allow the device to NAT traffic over the VPN.
<pre>
iptables -A POSTROUTING -o tun0 -s 192.168.1.0/24 -t nat -j MASQUERADE
</pre>
Show Tables
<pre>
iptables -t nat -nvL
</pre>
Delete Tables
<pre>
iptables -t nat -F
</pre>


[[Category : Debian]]
[[Category : Debian]]

Revision as of 11:52, 30 April 2019

Install OpenVPN

apt -y install openvpn


Download PIA Config Files

wget https://www.privateinternetaccess.com/openvpn/openvpn.zip -O /tmp/openvpn.zip

Extract Config Files

unzip /tmp/openvpn.zip -d /opt/openvpn
cp /opt/openvpn/AU\ Sydney.ovpn /etc/openvpn/sydney.conf
cp /opt/openvpn/ca.rsa.2048.crt /opt/openvpn/crl.rsa.2048.pem /etc/openvpn/

Create Login File

vi /etc/openvpn/login

Add your username and password to this file. Line one is your username and line two is the password

p123456
asw34fds34

Update the config file to use your username and password rather than prompting.

sed -i 's/auth-user-pass/auth-user-pass \/etc\/openvpn\/login/' /etc/openvpn/sydney.conf

Does the service run

openvpn --config /etc/openvpn/sydney.conf


Open another session and verify IP address

curl ifconfig.co


If all good enable services on startup.

systemctl enable openvpn@sydney


If you have a public IPv6 address disable IPv6

cat >> /etc/sysctl.conf << EOF

#Disable public IPv6 address
net.ipv6.conf.all.disable_ipv6 = 1
EOF


To allow the device to NAT traffic over the VPN.

iptables -A POSTROUTING -o tun0 -s 192.168.1.0/24 -t nat -j MASQUERADE

Show Tables

iptables -t nat -nvL

Delete Tables

iptables -t nat -F