OpenVPN is one of the most preferred open-source VPN solutions for establishing secure and private network connections. It is a highly secure, flexible, and customizable solution for those who want to access in-house systems, home networks, or work remotely.
This guide provides step-by-step instructions on how to install and configure OpenVPN on Windows, Linux, macOS, Android, and iOS devices.
1. OpenVPN Server Setup (Linux Ubuntu Example)
a) Install Required Packages:
sudo apt update
sudo apt install openvpn easy-rsa -y
b) Create Certificate with EasyRSA:
make-cadir ~/openvpn-ca
cd ~/openvpn-ca
source vars
./clean-all
./build-ca
./build-key-server server
./build-dh
./build-key client1
./build-key client2
c) Server Configuration:
sudo cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/
sudo gzip -d /etc/openvpn/server.conf.gz
sudo nano /etc/openvpn/server.conf
Make settings here such as IP forwarding and push "redirect-gateway def1"
.
d) Enable IP Forwarding:
echo 1 > /proc/sys/net/ipv4/ip_forward
and add the following line to the /etc/sysctl.conf
file:
net.ipv4.ip_forward = 1
e) Start the Server:
sudo systemctl start openvpn@server
sudo systemctl enable openvpn@server
2. OpenVPN Installation (Windows Client)
-
Download OpenVPN GUI from openvpn.net.
-
After installation, run the OpenVPN GUI application as administrator.
-
Place the
client.ovpn
configuration file in theC:\Program Files\OpenVPN\config
directory. -
You can connect to the server by clicking the OpenVPN icon next to the clock.
3. OpenVPN Installation (macOS)
-
Download the Tunnelblick application from the App Store (free OpenVPN client).
-
Download the
.ovpn
file and add it to Tunnelblick by double-clicking it. -
Confirm the connection, authorize with the root password.
4. OpenVPN Mobile Installation (Android and iOS)
a) Download Application:
-
Android: Google Play > "OpenVPN for Android" (Arne Schwabe)
-
iOS: App Store > "OpenVPN Connect"
b) Installation and Connection:
-
Transfer the
client.ovpn
file to the device via e-mail, Google Drive, or direct link. -
Import the file with the OpenVPN application.
-
Click on the connection and start the connection.
Security Tips
-
Use PAM or TLS-Auth to add username and password authentication.
-
Providing a connection over TCP port 443 is less blocked (especially in hotel/wifi networks).
-
Don't forget to turn off or limit logs: edit the
log
directives in/etc/openvpn/server.conf
.
Conclusion
Although OpenVPN installation may seem complex, you can create an extremely powerful and secure VPN infrastructure if you proceed step by step. OpenVPN is still the most preferred solution, especially for those who want to work remotely, access servers, or establish a secure connection to the home network.