Ubuntu - Ultimate Guide to OpenVPN: Server and Client Configuration

Fiko BorizqyFiko Borizqy
2 min read

Setting up an OpenVPN server and client on Ubuntu can be a straightforward process when following the right steps. This guide will walk you through the process of setting up an OpenVPN server using a script from angristan and then configuring a client to connect to the server.

Step 1: Setting Up the OpenVPN Server

  1. Install Required Packages: Ensure that your server has all the necessary packages installed.

     sudo apt update
     sudo apt install wget curl
    
  2. Download and Run the OpenVPN Installation Script: The script from angristan simplifies the setup process.

     wget https://github.com/angristan/openvpn-install/archive/master.zip
     unzip master.zip
     cd openvpn-install-master
     chmod +x openvpn-install.sh
     sudo ./openvpn-install.sh
    
  3. Follow the Prompts: The script will prompt you for various configuration options. Follow the instructions to set up the server according to your preferences.

  4. Download the Generated OVPN Profile: Once the setup is complete, download the generated .ovpn profile to your local machine.

Step 2: Installing OpenVPN Client on Ubuntu

  1. Install OpenVPN 3 Client: OpenVPN 3 is the latest version and is recommended for new setups.

     sudo apt update
     sudo apt install openvpn3
    
  2. Import the OVPN Profile: Import the generated profile into OpenVPN 3 client.

     openvpn3 config-import --config opi5pro.ovpn
    
  3. List Imported Profiles: You can see the imported profiles using the following command.

     openvpn3 configs-list
    

Step 3: Connecting to the OpenVPN Server

  1. Start the VPN Session: Use the imported profile to start a VPN session.

     openvpn3 session-start --config opi5pro.ovpn
    
  2. List Current VPN Sessions: You can see the list of current VPN sessions with the following command.

     openvpn3 sessions-list
    
  3. Disconnect from the VPN Session: If you need to disconnect from the VPN session, use the following command, replacing the session path with your specific session path.

     openvpn3 session-manage --disconnect --session-path /net/openvpn/v3/sessions/4d9521a3s0156s4abfsac14s0864e1bcf14c
    

Conclusion

By following these steps, you can successfully set up an OpenVPN server and client on Ubuntu. This setup ensures that your connection is secure and encrypted, allowing you to safely access your network from anywhere. Whether you're setting this up for personal use or for a larger network, OpenVPN provides a robust solution for your VPN needs.

Feel free to reach out if you encounter any issues or need further assistance. Happy networking! ๐Ÿ˜Š

0
Subscribe to my newsletter

Read articles from Fiko Borizqy directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Fiko Borizqy
Fiko Borizqy

I wrote these tutorials for myself in future when I forget for the next steps.