Openvpn Set Up tutorial

redtom001

Member
Messages
10
Reaction score
0
Points
1
Hey, i need help with setting up openvpn and where to buy those ssl certificates. Been on socks 5 for a long time and it seems like socks is no longer working.
 
Hey! No problem — switching from SOCKS5 proxies to OpenVPN is a smart move for better security, privacy, and reliability. OpenVPN uses encrypted tunnels over SSL/TLS (the same tech behind HTTPS), so it's much more robust than basic SOCKS proxies.

Below is a step-by-step tutorial to help you set up your own OpenVPN server. I'll also explain where to get SSL certificates (spoiler: you can generate them yourself for free using tools like easy-rsa or Let’s Encrypt).

✅ Step 1: Choose Your VPS Provider​

You need a Virtual Private Server (VPS) to host your OpenVPN server.

Recommended VPS Providers:​

  • DigitalOcean – Simple UI, good performance, $5/month droplet
  • Linode – Reliable, great network
  • Vultr – Global locations, cheap plans
  • Hetzner Cloud – Affordable in Europe
  • AWS EC2 / Google Cloud – More complex but powerful

👉 Pick one and create a Linux VPS (Ubuntu 20.04/22.04 or Debian 11/12 recommended).

✅ Step 2: Connect to Your VPS via SSH​


Bash:
ssh root@your_vps_ip

Update the system:

Bash:
apt update && apt upgrade -y

✅ Step 3: Install OpenVPN & Easy-RSA​

Install OpenVPN and Easy-RSA (tool to manage certificates):

Bash:
apt install openvpn easy-rsa -y

✅ Step 4: Set Up Certificate Authority (CA)​

We’ll generate our own SSL/TLS certificates — no need to buy them!

Initialize PKI (Public Key Infrastructure):​


Bash:
make-cadir ~/openvpn-ca
cd ~/openvpn-ca

Edit the vars configuration:

Bash:
nano vars

Set these values (customize as needed):

Bash:
set_var EASYRSA_REQ_COUNTRY "US"
set_var EASYRSA_REQ_PROVINCE "California"
set_var EASYRSA_REQ_CITY "San Francisco"
set_var EASYRSA_REQ_ORG "MyOrg"
set_var EASYRSA_REQ_EMAIL "admin@example.com"
set_var EASYRSA_REQ_OU "IT"
set_var EASYRSA_ALGO "ec"
set_var EASYRSA_CURVE "secp384r1"

Save (Ctrl+O, Enter, Ctrl+X).

Now build the CA:

Bash:
./easyrsa init-pki
./easyrsa build-ca

It will ask for a passphrase — choose a strong one. This secures your CA.

✅ Step 5: Generate Server Certificates & Keys​

Generate a certificate for your OpenVPN server:

Bash:
./easyrsa gen-req server nopass

Sign it:

Bash:
./easyrsa sign-req server server

Confirm with "yes" when prompted.

Generate Diffie-Hellman parameters (can take a few minutes):

Bash:
./easyrsa gen-dh

Generate an HMAC key for TLS auth:

Bash:
openvpn --genkey --secret ta.key

✅ Step 6: Copy Certificates to OpenVPN Directory​


Bash:
cp pki/ca.crt pki/issued/server.crt pki/private/server.key ta.key pki/dh.pem /etc/openvpn/

✅ Step 7: Configure OpenVPN Server​

Create a config file:

Bash:
nano /etc/openvpn/server.conf

Paste this basic config:

Code:
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
tls-auth ta.key 0
cipher AES-256-CBC
auth SHA256
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
explicit-exit-notify 1

🔐 Note: You can change port to 443 (UDP or TCP) if you want to blend with HTTPS traffic.

Save and exit.

✅ Step 8: Enable IP Forwarding​

Edit sysctl config:

Bash:
nano /etc/sysctl.conf

Uncomment or add:

Code:
net.ipv4.ip_forward=1

Apply:

Bash:
sysctl -p

✅ Step 9: Configure Firewall (UFW or iptables)​

If using UFW:

Bash:
ufw allow 1194/udp
ufw allow OpenSSH
ufw enable

Add NAT rule:

Bash:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Make iptables rules persistent (optional, depends on distro).

✅ Step 10: Start OpenVPN Service​


Bash:
systemctl start openvpn@server
systemctl enable openvpn@server

Check status:

Bash:
systemctl status openvpn@server

✅ Step 11: Generate Client Configs​

Go back to your CA directory:

Bash:
cd ~/openvpn-ca

Generate a client key/cert:

Bash:
./easyrsa gen-req client1 nopass
./easyrsa sign-req client client1

Create a .ovpn file for your client:

Bash:
mkdir -p ~/client-configs/files
nano ~/client-configs/files/client1.ovpn

Paste this template:

Code:
client
dev tun
proto udp
remote YOUR_VPS_IP 1194
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
cipher AES-256-CBC
auth SHA256
comp-lzo
verb 3

<ca>
(contents of /etc/openvpn/ca.crt)
</ca>

<cert>
(contents of /etc/openvpn/client1.crt)
</cert>

<key>
(contents of /etc/openvpn/client1.key)
</key>

<tls-auth>
(contents of /etc/openvpn/ta.key)
</tls-auth>
key-direction 1

Now copy each section (ca.crt, client1.crt, client1.key, ta.key) into their respective blocks.

You can use:

Bash:
cat /etc/openvpn/ca.crt
cat /etc/openvpn/client1.crt
cat /etc/openvpn/client1.key
cat /etc/openvpn/ta.key

Paste each inside its block in the .ovpn file.

✅ Step 12: Transfer .ovpn File to Your Device​

Use scp or download via secure method:

Bash:
scp ~/client-configs/files/client1.ovpn user@your_local_pc:~/Downloads/

Or use SFTP (FileZilla, WinSCP).

Then import the .ovpn file into:
  • Windows: OpenVPN GUI
  • Mac: Tunnelblick
  • Android/iOS: OpenVPN Connect app

🛡️ Do You Need to Buy SSL Certificates?​

❌ No. For OpenVPN, you don’t need to buy SSL certificates.
  • OpenVPN uses self-signed certificates managed by your own CA.
  • The encryption is just as strong as commercial certs.
  • Buying a public SSL cert (like from DigiCert) won't help here — OpenVPN doesn't use web-browser-trusted certs.

✅ Exception: If you're running OpenVPN over HTTPS (via web socket) or using Captive Portal bypass, then Let’s Encrypt may be useful — but that's advanced.

For standard setup, your self-signed CA is perfect and secure.

🔐 Security Tips​

  • Use strong passwords & firewall
  • Change OpenVPN port to 443 (UDP) to bypass restrictive networks
  • Disable unused clients
  • Regularly update your VPS

💬 Troubleshooting​

  • Can't connect? Check firewall, port, and systemctl status openvpn@server
  • No internet through VPN? Verify IP forwarding and NAT rules
  • Certificate errors? Double-check .ovpn file formatting

📚 Bonus: Automated Script (Recommended!)​

Instead of doing all this manually, use PiVPN — an automated installer:

Bash:
curl -L https://install.pivpn.io | bash

It guides you through setup, generates configs, and handles updates.

🔗 https://pivpn.io

Let me know:
  • Which OS you’re using (client side)?
  • Whether you want TCP/UDP?
  • If you’d like a script to automate client config generation?

Happy to help further!
 
What I wonder is why not just set up an AWS host in like Virginia region and use it? I mean why set up OpenVPN on AWS or google cloud and connect to it from like Ukraine instead of just setting up the server and using it as the actual machine?
 
Great question — you're hitting on a core concept of networking, latency, and use cases. Let’s break it down clearly.

You’re asking:
"Why not just set up an AWS server in Virginia and use it directly (e.g., run apps, browse the web) instead of connecting to it via OpenVPN from Ukraine?"

That’s smart thinking! But there are key differences between:
  1. Using a remote server as your actual machine (direct SSH/VNC)
  2. Using it as a secure tunnel (via OpenVPN or WireGuard)

Let’s explore both approaches and why people choose one over the other.

🔹 Option 1: Use AWS Server Directly (as Your "Computer")​

✅ What this means:
  • You launch an EC2 instance in Virginia (us-east-1)
  • You connect via SSH, RDP, or VNC
  • You run browsers, apps, scripts directly on the server
  • Your IP appears as Virginia (US), so geo-restricted content may be accessible

✅ Pros:
  • Simple setup
  • Full control
  • Good for running servers, bots, scrapers, etc.
  • No extra tunneling overhead

❌ Cons:
  • High latency: If you're in Ukraine, every click/scroll has ~100–150ms delay → makes browsing painful
  • No local app support: Can't run Ukrainian banking apps, local Netflix, etc., while appearing as US
  • Everything runs remotely: Video streaming, downloads happen on AWS, not your machine
  • Not private for local traffic: Your real device still leaks DNS, WebRTC, etc., unless fully routed

👉 This is great for server tasks, but terrible for personal browsing or low-latency use.

🔹 Option 2: Use AWS + OpenVPN (Tunnel All Traffic)​

✅ What this means:
  • You connect from your laptop in Ukraine to the Virginia OpenVPN server
  • All your internet traffic is encrypted and routed through Virginia
  • Your local machine stays responsive; only data is tunneled

✅ Pros:
  • Your entire device appears to be in Virginia
  • You can use local apps, fast UI, GPU acceleration, etc.
  • Browsing feels normal (only websites load from far away)
  • Full privacy: DNS, WebRTC, background apps all go through tunnel
  • Works with any device: phone, laptop, tablet

✅ Example:
  • You watch US Netflix from Ukraine
  • You play a game that checks IP location
  • You access region-blocked services

❌ Cons:
  • Slight encryption overhead (~10–20% speed loss)
  • Latency for US-based sites is still high (but unavoidable)

🧠 Analogy Time​

Think of it like this:

METHODLIKE...BEST FOR
Using AWS directly (SSH/RDP)Driving a car in Virginia using a robot controlled from UkraineHosting servers, automation
Using OpenVPNSitting in your car in Ukraine, but your license plate says "Virginia"Personal privacy, bypassing geo-blocks

You’re not moving your body to Virginia — you’re making it look like you are online.

💡 So Why Choose OpenVPN?​

Because most people want:
  • To browse the web securely from their own device
  • To appear in another country without moving
  • To protect all apps (Discord, games, browsers, updates)
  • To avoid ISP tracking or censorship

They don’t want to run everything inside a laggy remote desktop!

🚀 Real-World Use Cases​

GOALBEST APPROACH
Run a website or API✅ Direct AWS server
Scrape US-only data✅ OpenVPN or proxy on AWS
Watch US Netflix from Ukraine✅ OpenVPN/WireGuard
Play a game requiring US IP✅ Tunnel via OpenVPN
Secure public Wi-Fi connection✅ OpenVPN to your server
Remote work on cloud machine✅ Direct RDP/SSH

⚙️ Bonus: Better Alternative – WireGuard​

Consider WireGuard instead of OpenVPN:
  • Faster (modern cryptography)
  • Lower latency
  • Easier to set up (especially with pivpn or wg-easy)
  • Better for mobile devices

Command to install with PiVPN + WireGuard:

Bash:
curl -L https://install.pivpn.io | bash

Then choose WireGuard when prompted.

✅ Summary​

❌ Don’t use AWS Virginia server as your computer if you're in Ukraine — it will feel slow and clunky.
✅ Do use it as a VPN gateway (OpenVPN/WireGuard) so your local device routes traffic through the US — best of both worlds.

You get:
  • Local performance
  • US IP address
  • Full encryption
  • Privacy from ISP

Let me know what you're trying to accomplish (e.g., streaming, privacy, bypassing blocks), and I can suggest the best setup!
 
Great question — you're hitting on a core concept of networking, latency, and use cases. Let’s break it down clearly.

You’re asking:


That’s smart thinking! But there are key differences between:
  1. Using a remote server as your actual machine (direct SSH/VNC)
  2. Using it as a secure tunnel (via OpenVPN or WireGuard)

Let’s explore both approaches and why people choose one over the other.

🔹 Option 1: Use AWS Server Directly (as Your "Computer")​

✅ What this means:
  • You launch an EC2 instance in Virginia (us-east-1)
  • You connect via SSH, RDP, or VNC
  • You run browsers, apps, scripts directly on the server
  • Your IP appears as Virginia (US), so geo-restricted content may be accessible

✅ Pros:
  • Simple setup
  • Full control
  • Good for running servers, bots, scrapers, etc.
  • No extra tunneling overhead

❌ Cons:
  • High latency: If you're in Ukraine, every click/scroll has ~100–150ms delay → makes browsing painful
  • No local app support: Can't run Ukrainian banking apps, local Netflix, etc., while appearing as US
  • Everything runs remotely: Video streaming, downloads happen on AWS, not your machine
  • Not private for local traffic: Your real device still leaks DNS, WebRTC, etc., unless fully routed

👉 This is great for server tasks, but terrible for personal browsing or low-latency use.

🔹 Option 2: Use AWS + OpenVPN (Tunnel All Traffic)​

✅ What this means:
  • You connect from your laptop in Ukraine to the Virginia OpenVPN server
  • All your internet traffic is encrypted and routed through Virginia
  • Your local machine stays responsive; only data is tunneled

✅ Pros:
  • Your entire device appears to be in Virginia
  • You can use local apps, fast UI, GPU acceleration, etc.
  • Browsing feels normal (only websites load from far away)
  • Full privacy: DNS, WebRTC, background apps all go through tunnel
  • Works with any device: phone, laptop, tablet

✅ Example:
  • You watch US Netflix from Ukraine
  • You play a game that checks IP location
  • You access region-blocked services

❌ Cons:
  • Slight encryption overhead (~10–20% speed loss)
  • Latency for US-based sites is still high (but unavoidable)

🧠 Analogy Time​

Think of it like this:

METHODLIKE...BEST FOR
Using AWS directly (SSH/RDP)Driving a car in Virginia using a robot controlled from UkraineHosting servers, automation
Using OpenVPNSitting in your car in Ukraine, but your license plate says "Virginia"Personal privacy, bypassing geo-blocks

You’re not moving your body to Virginia — you’re making it look like you are online.

💡 So Why Choose OpenVPN?​

Because most people want:
  • To browse the web securely from their own device
  • To appear in another country without moving
  • To protect all apps (Discord, games, browsers, updates)
  • To avoid ISP tracking or censorship

They don’t want to run everything inside a laggy remote desktop!

🚀 Real-World Use Cases​

GOALBEST APPROACH
Run a website or API✅ Direct AWS server
Scrape US-only data✅ OpenVPN or proxy on AWS
Watch US Netflix from Ukraine✅ OpenVPN/WireGuard
Play a game requiring US IP✅ Tunnel via OpenVPN
Secure public Wi-Fi connection✅ OpenVPN to your server
Remote work on cloud machine✅ Direct RDP/SSH

⚙️ Bonus: Better Alternative – WireGuard​

Consider WireGuard instead of OpenVPN:
  • Faster (modern cryptography)
  • Lower latency
  • Easier to set up (especially with pivpn or wg-easy)
  • Better for mobile devices

Command to install with PiVPN + WireGuard:

Bash:
curl -L https://install.pivpn.io | bash

Then choose WireGuard when prompted.

✅ Summary​



You get:
  • Local performance
  • US IP address
  • Full encryption
  • Privacy from ISP

Let me know what you're trying to accomplish (e.g., streaming, privacy, bypassing blocks), and I can suggest the best setup!
Hey bro, am looking for the best carding set up. Socks 5 is dead. Been using it for years.
 
Top