VPS & DedicatedNetwork & security

OpenVPN setup

Install an OpenVPN server on your VPS and connect to it from your devices.

This guide shows how to turn your VPS into a personal VPN server with OpenVPN, then connect to it from your PC or phone.

  1. Connect to your VPS

    bash
    ssh root@YOUR_VPS_IP
  2. Download the installer

    bash
    curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh
    chmod +x openvpn-install.sh
  3. Run it and answer the questions

    bash
    ./openvpn-install.sh

    The defaults are fine for most users: UDP, port 1194, and the DNS provider of your choice. When asked for a client name, enter something like laptop or phone.

  4. Open the port in your firewall

    If you use a firewall on the VPS or in the RHQ client area, allow UDP 1194 (or the port you chose).

    bash
    ufw allow 1194/udp
  5. Download the client profile

    The script creates a file like /root/laptop.ovpn. Copy it to your computer:

    bash
    scp root@YOUR_VPS_IP:/root/laptop.ovpn .
  6. Connect

    Install OpenVPN Connect (Windows, macOS, Android, iOS), import the .ovpn file and press Connect. Your public IP should now be the IP of your VPS.

Add or remove clients

Run the script again and choose the matching option from the menu:

bash
./openvpn-install.sh

Troubleshooting

It connects but there is no internet

Check that IP forwarding is enabled (sysctl net.ipv4.ip_forward should return 1) and that the NAT rule created by the script is still present (iptables -t nat -L -n).

The connection times out

The port is almost certainly blocked. Confirm the OpenVPN service is running with systemctl status openvpn* and that UDP 1194 is open in every firewall between you and the VPS.