ZeroNet - free opensource uncensored distributed web site hosting network
+ Post New Thread
Results 1 to 2 of 2

Thread: How to setup private OpenVPN on a Linux server and Windows/Android client?

  1. #1
    Fli
    Fli is online now
    Administrator Fli's Avatar
    Join Date
    Mar 2013
    Posts
    2,610

    How to setup private OpenVPN on a Linux server and Windows/Android client?

    This tutorial should help You to
    a) protect your internet communication by encryption
    b) use different IP so you hide your real IP

    You will need
    a) Linux server (starts at less than $2/month) and you can use it for many other tasks like website hosting server
    b) to install OpenVPN software on that server and on your own home computer and/or on the Android device

    ALTERNATIVES to OpenVPN: You may also skip this whole tutorial and try
    A) WireGuard which is faster than OpenVPN - Download and run WG installer on a Linux server (Dedicated server or vitual server virtualized using KVM/XEN since OpenVZ & LXC needs different approach: #1 or #2)
    Here i found another tutorials for Wireguard server + Windows client:
    https://web.archive.org/web/20210816050733/https://golb.hplar.ch/2019/07/wireguard-windows.html
    https://web.archive.org/web/20210915091556/https://www.stavros.io/posts/how-to-configure-wireguard/
    B) https://github.com/StreisandEffect/streisand but it is much more complicated, complex system.
    C) free VPN like from https://tunsafe.com/vpn (TunSafe is alternative client to OpenVPN and is claimed to be much faster, though do not have GUI Linux client)

    Server side OpenVPN setup

    Login to Your Linux server that you want to act as a VPN server / proxy server. If you do not have one, try Linux VPS 256MB RAM from there: https://instantcpanelhosting.com/cart.php?gid=4 (when selecting a VPS, consider its data transfer/bandwidth limits usually mentioned by the VPS seller and your current computer internet data transfer so the VPS fits) After order you will receive login details which will allow you to access your linux server command line. Following are Linux commands to run.

    cat /dev/net/tun
    (checking that tun/tap is available)

    A) It is OK if it says "cat: /dev/net/tun: File descriptor in bad state"

    B) It is bad, tun device is not available currently, it says "cat: /dev/net/tun: Operation not permitted". In case of a dedicated server, do command "modprobe tun" and then add tun into /etc/modules.conf or on RHEL into /etc/sysconfig/modules/my.modules add line "/sbin/modprobe tun". If you are on a VPS (not dedicated server), then ask your VPS provider to enable tun/tap (sometimes there is option in control panel). On OpenVZ, provider will issue command: "vzctl set CTID --devnodes net/tun:rw --capability net_admin:on --save"

    Update your system and reboot, some people including me had problems due to outdated kernel:
    Debian based Linux: sudo apt update;sudo apt upgrade;reboot
    Redhat based Linux: yum update;yum upgrade;reboot


    Then download & run Nyr's installation bash script for the Linux Debian, Ubuntu, CentOS (no centos 5.x):
    wget https://git.io/vpn -O openvpn-install.sh && bash openvpn-install.sh


    NOTE: if you are on older OS (CentOS6, Debian 8), original installer above may fail. Use following command instead:
    wget https://raw.githubusercontent.com/Nyr/openvpn-install/c90989a0e2dbb6316e5d048f105c8615f70c6ba9/openvpn-install.sh && bash openvpn-install.sh


    Maybe worth using 443 port as it will be rarely restricted.

    If the installation ends in ERROR: "Job for [email protected]e failed because the control process exited with error code."
    Try command: sed -i 's/LimitNPROC/#LimitNPROC/g' /lib/systemd/system/[email protected];systemctl daemon-reload;systemctl restart [email protected]e;systemctl status [email protected]e
    The VPN server then should appear as active (running) which is correct.

    Disable OpenVPN server logging (after openvpn server is installed):
    sed -i '/openvpn-status.log/d' /etc/openvpn/server.conf;sed -i '/verb /d' /etc/openvpn/server.conf;echo -e "log /dev/null\nstatus /dev/null\nverb 0" >> /etc/openvpn/server.conf
    service openvpn restart 2>/dev/null || systemctl restart [email protected] 2>/dev/null;systemctl restart [email protected]e 2>/dev/null || systemctl restart [email protected]e 2>/dev/null
    chkconfig openvpn on || sudo update-rc.d openvpn enable

    See the error "Options error: In [CMD-LINE]:1: Error opening configuration file: /etc/openvpn/server.service.conf"?
    Maybe you wrongly defined service. Not ""[email protected]", but "[email protected]" or "[email protected]".

    Initial installation wizard should have printed out the path to the openvpn configuration file ~/client.ovpn (/root/client.ovpn)
    Download this file (or copy its contents) to your device from which you want to be connecting to the OpenVPN server

    Client side setup

    Windows client

    Place your .ovpn configuration file into the proper directory, C:\Program Files\OpenVPN\config, and click Connect in the GUI.

    Linux client

    openvpn --config ~/path/to/client.ovpn

    Android client

    I installed this software. And then downloaded my .ovpn file to the phone. Then open that file in phone and select VPN client you just installed to open it. It will import the file.

    ---
    After connection is established, the OS connections should be routed through the OpenVPN. If not, or internet fails, verify your proxy settings in InternetExplorer or in the app that fails to connect internet.

    If apps still can't connect internet, try to switch to the server and discover your network interface name (usually eth0 or venet0):
    route|grep default|awk '{print $8}'

    Then execute command on the server:
    iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o venet0 -j MASQUERADE
    (i used venet0 as im on the OpenVZ VPS, to discover yours interface name, run command mentioned few lines above)

    How to prevent your OS leaking real IP when OpenVPN is down?

    When OpenVPN app crash or not started, computer can connect internet directly revealing your true identity and transfer data unencrypted. To prevent this, you need to configure your computer Firewall. Click here for windows and or here for Linux.

    ----------------------------------------
    How to setup torrent client to work with OpenVPN? https://internetlifeforum.com/security/6552-how-make-qbittorent-working-openvpn/izer

  2. #2
    Junior Member JohnnyD's Avatar
    Join Date
    Feb 2020
    Posts
    2
    It can be difficult to make it work on some devices, but here is a step-by-step tutorial for OpenVPN on Android illustrated with screenshots. Should probably be the same method to setup VPN on all new versions of Android.

+ Post New Thread

Similar Threads

  1. Replies: 0
    Last Post: 04-20-2018, 10:20 PM
  2. Replies: 0
    Last Post: 03-31-2017, 12:38 AM
  3. Replies: 1
    Last Post: 01-24-2017, 06:23 AM
  4. Windows VPS (Virtual private server) with Free Setup?
    By sujalpatel in forum VPS Hosting
    Replies: 1
    Last Post: 07-22-2016, 10:17 AM
  5. Replies: 0
    Last Post: 02-15-2016, 04:06 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
 Protected by : ZB BLOCK  &  StopForumSpam