Skip to content

Instantly share code, notes, and snippets.

@ebta
Last active December 21, 2025 11:46
Show Gist options
  • Select an option

  • Save ebta/301f286fa9056d67e61bfc7cedd4ad56 to your computer and use it in GitHub Desktop.

Select an option

Save ebta/301f286fa9056d67e61bfc7cedd4ad56 to your computer and use it in GitHub Desktop.

Revisions

  1. ebta renamed this gist Apr 9, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. ebta revised this gist Apr 9, 2021. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion open-vpn-ubuntu-20.md
    Original file line number Diff line number Diff line change
    @@ -35,4 +35,7 @@ dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
    You need to run the same script again for adding or removing a new VPN user to TLS certificate. For instance:
    ```sh
    $ sudo ./openvpn-ubuntu-install.sh
    ```
    ```

    This is summary from
    [Ubuntu 20.04 LTS Set Up OpenVPN Server In 5 Minutes](https://www.cyberciti.biz/faq/ubuntu-20-04-lts-set-up-openvpn-server-in-5-minutes/)
  3. ebta created this gist Apr 9, 2021.
    38 changes: 38 additions & 0 deletions open-vpn-ubuntu-20.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    ## 1. Update your system
    First, run the apt command to apply security updates:
    ```sh
    sudo apt update
    sudo apt upgrade
    ```
    ## 2. Download and run openvpn-install.sh script
    DOwnload installation script using short url as follow and update chmod :
    ```sh
    wget https://git.io/vpn -O openvpn-ubuntu-install.sh
    chmod -v +x openvpn-ubuntu-install.sh
    sudo ./openvpn-ubuntu-install.sh
    ```
    Select UDP (recomendded), Port default, DNS use 1.1.1.1 or Google, client name, just give some name for example client-vpn, then openvpn will generate file *client-vpn.ovpn* in the /root directory
    ## 3. Check status, start, stop or restart service
    ```sh
    sudo systemctl status openvpn-server@server.service
    sudo systemctl start openvpn-server@server.service
    sudo systemctl stop openvpn-server@server.service
    sudo systemctl restart openvpn-server@server.service
    ```

    ## 4. Using opvn file
    On Windows, install OpenVPN GUI and load *client-vpn.ovpn* file. From taskbar, right click OpenVPN icon and select appropriate vpn and click connect. OpenVPN will generate private/local IP addresses such as 10.8.0.1/32

    ## 5. Test/Verify connection
    ```sh
    ping 10.8.0.1 #Ping to the OpenVPN server gateway
    ip route #Make sure routing setup working
    ## the following must return public IP address of OpenVPN server ##
    dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
    ```

    ## 6. Add or remove a new VPN user with a certificate
    You need to run the same script again for adding or removing a new VPN user to TLS certificate. For instance:
    ```sh
    $ sudo ./openvpn-ubuntu-install.sh
    ```