VPN Guide

    Setting Up OpenVPN Server

    OpenVPN is a mature, robust VPN solution that provides enterprise-grade security and flexibility. Combined with RamNode's reliable VPS hosting, you can create a powerful private VPN server with advanced features and client management capabilities. This guide will walk you through setting up OpenVPN using an automated installer script.

    Ubuntu 22.04/24.04
    OpenVPN Server
    ⏱️ 5-10 minutes

    Prerequisites

    Before starting, ensure you have:

    Server Requirements

    • • RamNode VPS (1-2GB RAM recommended)
    • • Ubuntu 22.04/24.04 or newer
    • • Root SSH access
    • • Public IPv4 address

    Optional Setup

    • • Domain name (e.g., vpn.yourdomain.com)
    • • Firewall knowledge
    • • Basic Linux command line skills
    2

    Launch Instance

    Create a RamNode VPS instance with the following specifications:

    Recommended Instance Configuration:

    • Memory: 1-2GB RAM (sufficient for most users)
    • OS: Ubuntu 24.04 or newer
    • Storage: 25GB SSD (default is fine)
    • Network: Note your public IPv4 address

    After launching, optionally create a hostname for easier connection:

    Example Hostname Setup
    vpn.yourdomain.com → YOUR_SERVER_IP

    💡 Pro Tip: Using a hostname makes it easier to remember and manage your VPN connection.

    3

    Download Installation Script

    SSH into your server and download the OpenVPN installation script:

    Connect to Server
    ssh root@your-server-ip
    Download and Setup Script
    git clone https://github.com/angristan/openvpn-install.git
    cd openvpn-install
    cp openvpn-install.sh /usr/local/bin/openvpn-admin
    chmod 700 /usr/local/bin/openvpn-admin

    ℹ️ This script simplifies OpenVPN installation and provides ongoing management capabilities.

    4

    Run the Installer

    Execute the installation script and configure your OpenVPN server:

    Start Installation
    openvpn-admin

    The installer will prompt you for configuration options:

    ⚠️ Important: When prompted to create the first user, press Ctrl+C to exit - we'll configure private network routing first.

    5

    Configure Private Network Access

    If you want VPN clients to access your cloud's private network, configure routing:

    Edit Server Configuration
    nano /etc/openvpn/server.conf

    Add this line to enable access to your private network:

    Add Private Network Route
    push "route 10.24.0.0/16 255.255.0.0"
    Restart OpenVPN
    systemctl restart openvpn

    Configure the client template to route private network traffic:

    Edit Client Template
    nano /etc/openvpn/client-template.txt
    Add Client Route
    route 10.24.0.0 255.255.0.0

    Enable NAT and IP forwarding:

    Configure NAT and IP Forwarding
    # Enable NAT (replace ens3 with your network interface)
    iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o ens3 -j MASQUERADE
    iptables-save
    
    # Enable IP forwarding
    echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
    sysctl -p

    📝 Note: Replace 10.24.0.0/16 with your actual private network range, and ens3 with your network interface (check with ip a).

    6

    Create Client Configurations

    Create configuration files for each VPN user:

    Run Client Creation Tool
    openvpn-admin

    Select option (1) to "Add a new User" and provide:

    Client Configuration Options:
    • Client name: Enter a unique username (e.g., "john-laptop")
    • Password protection: Choose [y] for additional security (recommended)
    • Password: Set a strong password for the client certificate

    Success: Client configuration file will be saved to /root/ folder. Each user needs their own unique configuration file.

    7

    Client Setup Instructions

    Install OpenVPN clients on various devices:

    8

    Testing Your Connection

    Verify your VPN connection is working correctly:

    Connection Tests:
    • • Check your public IP address
    • • Test DNS resolution
    • • Verify private network access
    • • Test internet connectivity
    Useful Commands:
    • curl ifconfig.me - Check IP
    • nslookup google.com - Test DNS
    • ping 10.24.0.1 - Private network
    Check Your Public IP
    # Before connecting to VPN curl ifconfig.me # After connecting to VPN (should show server IP) curl ifconfig.me

    🎉 Success: If your IP address changed to your server's IP, your VPN is working correctly!

    9

    Server Management

    Manage your OpenVPN server and users:

    OpenVPN Management Commands
    # Add new users
    openvpn-admin
    
    # Check server status
    systemctl status openvpn
    
    # View connected clients
    cat /etc/openvpn/openvpn-status.log
    
    # Restart OpenVPN service
    systemctl restart openvpn
    Management Options via openvpn-admin:
    • • Add new users
    • • Revoke user certificates
    • • Remove OpenVPN installation
    • • View server configuration
    10

    Troubleshooting