Setup VPN on Alpine Linux With OpenVPN

This tutorial explains how to set up a VPN on Alpine Linux with the OpenVPN protocol.
This tutorial was created on Alpine-standard-3.18.2-x86_64 with XFCE Desktop.


Step #1: Switch to the root user by entering su and install OpenVPN.

apk add openvpn

Step #2: Now run these commands:

rc-update add openvpn default
modprobe tun
echo "tun" >> /etc/modules-load.d/tun.conf

Step #3: Enter into the OpenVPN directory and download FastestVPN’s OpenVPN server config files by running these commands.

cd /etc/openvpn
wget http://support.fastestvpn.com/download/fastestvpn_ovpn/ -O fastestvpn_ovpn.zip

Step #4: Unzip the downloaded files.

sudo unzip fastestvpn_ovpn.zip

Please run apk add sudo if it says “sudo: not found”

Step #5: Now copy the unzipped server files into the OpenVPN directory.

cp /etc/openvpn/tcp_files/* /etc/openvpn/ && cp /etc/openvpn/udp_files/* /etc/openvpn/

Step #6: Enter ls so all the FastestVPN server files in the directory will be listed.

Step #7: Connect to your desired TCP or UDP VPN server by entering sudo openvpn [your desired server name]

For example:

sudo openvpn uk2-udp.ovpn

Step #8: It will require you to enter your credentials. Enter your FastestVPN Username and then Password.

Step #9: Once the logs show “Initialization sequence completed” that means the VPN connection has been established.

To disconnect from the VPN, press Ctrl+C in the same command line session, or in another session, enter sudo killall openvpn