<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://serverrental.store/index.php?action=history&amp;feed=atom&amp;title=Setting_Up_OpenVPN_Server</id>
	<title>Setting Up OpenVPN Server - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://serverrental.store/index.php?action=history&amp;feed=atom&amp;title=Setting_Up_OpenVPN_Server"/>
	<link rel="alternate" type="text/html" href="https://serverrental.store/index.php?title=Setting_Up_OpenVPN_Server&amp;action=history"/>
	<updated>2026-04-15T15:06:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://serverrental.store/index.php?title=Setting_Up_OpenVPN_Server&amp;diff=5774&amp;oldid=prev</id>
		<title>Admin: New server guide</title>
		<link rel="alternate" type="text/html" href="https://serverrental.store/index.php?title=Setting_Up_OpenVPN_Server&amp;diff=5774&amp;oldid=prev"/>
		<updated>2026-04-12T20:00:39Z</updated>

		<summary type="html">&lt;p&gt;New server guide&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Setting Up OpenVPN Server =&lt;br /&gt;
&lt;br /&gt;
This guide provides a comprehensive walkthrough for installing and configuring an OpenVPN server on a Linux system, along with instructions for setting up OpenVPN clients. OpenVPN is a powerful and flexible open-source VPN solution that allows you to create secure, encrypted tunnels over the internet. This is invaluable for securing your network traffic, accessing internal resources remotely, or bypassing geo-restrictions.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before you begin, ensure you have the following:&lt;br /&gt;
&lt;br /&gt;
*   A Linux server with root or sudo privileges. A dedicated server from [https://powervps.net/?from=32 PowerVPS] with full root access is ideal for this setup, providing the necessary control and performance.&lt;br /&gt;
*   A static public IP address for your OpenVPN server.&lt;br /&gt;
*   Basic familiarity with the Linux command line.&lt;br /&gt;
*   Internet connectivity on both the server and client machines.&lt;br /&gt;
*   A firewall configured on your server (e.g., UFW, firewalld, iptables).&lt;br /&gt;
&lt;br /&gt;
== Step 1: Install OpenVPN and Easy-RSA ==&lt;br /&gt;
&lt;br /&gt;
OpenVPN and the necessary tools for certificate management (Easy-RSA) can typically be installed from your distribution's package repositories.&lt;br /&gt;
&lt;br /&gt;
=== On Debian/Ubuntu ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt update&lt;br /&gt;
sudo apt install openvpn easy-rsa -y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On CentOS/RHEL/Fedora ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dnf update -y  # Or 'sudo yum update -y' on older systems&lt;br /&gt;
sudo dnf install openvpn easy-rsa -y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 2: Set Up the Certificate Authority (CA) ==&lt;br /&gt;
&lt;br /&gt;
Easy-RSA is used to create and manage the Public Key Infrastructure (PKI) for your OpenVPN server. This involves generating a Certificate Authority (CA) and then using that CA to sign server and client certificates.&lt;br /&gt;
&lt;br /&gt;
1.  **Copy Easy-RSA to a dedicated directory:**&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo mkdir /etc/openvpn/easy-rsa&lt;br /&gt;
    sudo cp -r /usr/share/easy-rsa/* /etc/openvpn/easy-rsa/&lt;br /&gt;
    sudo chown -R root:root /etc/openvpn/easy-rsa&lt;br /&gt;
    sudo chmod -R 700 /etc/openvpn/easy-rsa&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.  **Navigate to the Easy-RSA directory:**&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    cd /etc/openvpn/easy-rsa&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.  **Initialize the PKI:**&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    ./easyrsa init-pki&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.  **Build the Certificate Authority (CA):** You will be prompted to enter a Common Name for your CA. Choose something descriptive, like &amp;quot;MyOpenVPNCA&amp;quot;.&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    ./easyrsa build-ca&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
    You will be asked for a passphrase for your CA. Remember this passphrase, as you'll need it for signing certificates.&lt;br /&gt;
&lt;br /&gt;
5.  **Generate the Server Certificate and Key:**&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    ./easyrsa gen-req server nopass&lt;br /&gt;
    ./easyrsa sign-req server server&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
    You will be prompted to enter the CA passphrase. The `nopass` option for `gen-req` means the server's private key will not be password-protected, which is necessary for automatic server startup.&lt;br /&gt;
&lt;br /&gt;
6.  **Generate Diffie-Hellman Parameters:** This is crucial for Perfect Forward Secrecy.&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    ./easyrsa gen-dh&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
    This process can take a significant amount of time, especially on less powerful hardware.&lt;br /&gt;
&lt;br /&gt;
7.  **Generate TLS Authentication Key:** This adds an extra layer of security.&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    openvpn --genkey --secret ta.key&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.  **Copy Necessary Files to OpenVPN Directory:**&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo cp pki/ca.crt /etc/openvpn/&lt;br /&gt;
    sudo cp pki/issued/server.crt /etc/openvpn/&lt;br /&gt;
    sudo cp pki/private/server.key /etc/openvpn/&lt;br /&gt;
    sudo cp pki/dh.pem /etc/openvpn/&lt;br /&gt;
    sudo cp ta.key /etc/openvpn/&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 3: Configure the OpenVPN Server ==&lt;br /&gt;
&lt;br /&gt;
Now, we'll create the server configuration file.&lt;br /&gt;
&lt;br /&gt;
1.  **Create a server configuration file:**&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo nano /etc/openvpn/server.conf&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.  **Add the following configuration:** Replace `your_server_public_ip` with your server's actual public IP address.&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    port 1194&lt;br /&gt;
    proto udp&lt;br /&gt;
    dev tun&lt;br /&gt;
    ca ca.crt&lt;br /&gt;
    cert server.crt&lt;br /&gt;
    key server.key&lt;br /&gt;
    dh dh.pem&lt;br /&gt;
    tls-auth ta.key 0 # This file is secret, don't copy to clients.&lt;br /&gt;
    server 10.8.0.0 255.255.255.0 # VPN subnet&lt;br /&gt;
    ifconfig-pool-persist ipp.txt&lt;br /&gt;
    push &amp;quot;redirect-gateway def1 bypass-dhcp&amp;quot; # Route all client traffic through VPN&lt;br /&gt;
    push &amp;quot;dhcp-option DNS 8.8.8.8&amp;quot; # Example DNS server&lt;br /&gt;
    push &amp;quot;dhcp-option DNS 8.8.4.4&amp;quot; # Example DNS server&lt;br /&gt;
    keepalive 10 120&lt;br /&gt;
    cipher AES-256-CBC&lt;br /&gt;
    user nobody&lt;br /&gt;
    group nogroup&lt;br /&gt;
    persist-key&lt;br /&gt;
    persist-tun&lt;br /&gt;
    status openvpn-status.log&lt;br /&gt;
    verb 3&lt;br /&gt;
    explicit-exit-notify 1&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    *   `port 1194`: The default OpenVPN port.&lt;br /&gt;
    *   `proto udp`: Using UDP for better performance.&lt;br /&gt;
    *   `dev tun`: Creates a routed IP tunnel.&lt;br /&gt;
    *   `server 10.8.0.0 255.255.255.0`: Defines the VPN subnet from which clients will receive IP addresses.&lt;br /&gt;
    *   `push &amp;quot;redirect-gateway def1 bypass-dhcp&amp;quot;`: This directive tells clients to send all their internet traffic through the VPN.&lt;br /&gt;
    *   `push &amp;quot;dhcp-option DNS ...&amp;quot;`: Pushes specific DNS servers to clients.&lt;br /&gt;
    *   `user nobody` and `group nogroup`: Drops privileges after initialization for security.&lt;br /&gt;
&lt;br /&gt;
3.  **Enable IP Forwarding:** This allows the server to route traffic between the VPN clients and the internet.&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo nano /etc/sysctl.conf&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
    Uncomment or add the following line:&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    net.ipv4.ip_forward=1&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
    Apply the changes:&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo sysctl -p&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.  **Configure Firewall Rules:** You need to allow UDP traffic on port 1194 and configure NAT for VPN clients.&lt;br /&gt;
&lt;br /&gt;
    === Using UFW (Uncomplicated Firewall) ===&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo ufw allow 1194/udp&lt;br /&gt;
    sudo ufw allow OpenSSH # Ensure SSH access is not blocked&lt;br /&gt;
    sudo nano /etc/ufw/before.rules&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
    Add the following lines at the top of the file, before the `*filter` section:&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    # START OPENVPN RULES&lt;br /&gt;
    # NAT table rules&lt;br /&gt;
    *nat&lt;br /&gt;
    :POSTROUTING ACCEPT [0:0]&lt;br /&gt;
    # Allow traffic from OpenVPN client to eth0 (change eth0 to your primary network interface)&lt;br /&gt;
    -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
    COMMIT&lt;br /&gt;
    # END OPENVPN RULES&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
    Save the file and reload UFW:&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo ufw disable&lt;br /&gt;
    sudo ufw enable&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    === Using firewalld ===&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo firewall-cmd --permanent --add-port=1194/udp&lt;br /&gt;
    sudo firewall-cmd --zone=public --add-masquerade&lt;br /&gt;
    sudo firewall-cmd --reload&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    === Using iptables ===&lt;br /&gt;
    (This is more complex and depends on your existing iptables setup. A basic example for NAT might look like this, but it's highly recommended to use UFW or firewalld if possible or integrate carefully into your existing rules.)&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE # Replace eth0 with your network interface&lt;br /&gt;
    sudo iptables -A FORWARD -i tun0 -o eth0 -j ACCEPT&lt;br /&gt;
    sudo iptables -A FORWARD -i eth0 -o tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT&lt;br /&gt;
    # Save iptables rules (method depends on distribution)&lt;br /&gt;
    # For Debian/Ubuntu:&lt;br /&gt;
    sudo apt install iptables-persistent -y&lt;br /&gt;
    sudo netfilter-persistent save&lt;br /&gt;
    # For CentOS/RHEL:&lt;br /&gt;
    sudo service iptables save&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 4: Start and Enable OpenVPN Service ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo systemctl start openvpn@server&lt;br /&gt;
sudo systemctl enable openvpn@server&lt;br /&gt;
sudo systemctl status openvpn@server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check the status to ensure it's running without errors.&lt;br /&gt;
&lt;br /&gt;
== Step 5: Generate Client Configurations ==&lt;br /&gt;
&lt;br /&gt;
For each client that needs to connect, you need to generate a unique certificate and key pair.&lt;br /&gt;
&lt;br /&gt;
1.  **Navigate back to the Easy-RSA directory:**&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    cd /etc/openvpn/easy-rsa&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.  **Generate client certificate and key:** Replace `client1` with a unique name for each client.&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    ./easyrsa gen-req client1 nopass&lt;br /&gt;
    ./easyrsa sign-req client client1&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
    You will be prompted for the CA passphrase.&lt;br /&gt;
&lt;br /&gt;
3.  **Create a client configuration file template:**&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo nano /etc/openvpn/client-common.txt&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
    Add the following content. Replace `your_server_public_ip` with your server's public IP.&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    client&lt;br /&gt;
    dev tun&lt;br /&gt;
    proto udp&lt;br /&gt;
    remote your_server_public_ip 1194&lt;br /&gt;
    resolv-retry infinite&lt;br /&gt;
    nobind&lt;br /&gt;
    persist-key&lt;br /&gt;
    persist-tun&lt;br /&gt;
    remote-cert-tls server&lt;br /&gt;
    tls-auth ta.key 1 # This file is secret, don't copy to clients.&lt;br /&gt;
    cipher AES-256-CBC&lt;br /&gt;
    verb 3&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.  **Create a client-specific configuration script (optional but recommended):** This script will bundle all necessary client files into a single `.ovpn` file.&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo nano /etc/openvpn/make_client_config.sh&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
    Add the following script. Make sure to adjust `YOUR_SERVER_IP` and `YOUR_SERVER_NAME` placeholders.&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    #!/bin/bash&lt;br /&gt;
&lt;br /&gt;
    # Script to generate OpenVPN client configuration files&lt;br /&gt;
&lt;br /&gt;
    # --- Configuration ---&lt;br /&gt;
    OVPN_DIR=&amp;quot;/etc/openvpn&amp;quot;&lt;br /&gt;
    EASYRSA_DIR=&amp;quot;$OVPN_DIR/easy-rsa&amp;quot;&lt;br /&gt;
    CLIENT_NAME=&amp;quot;$1&amp;quot;&lt;br /&gt;
    SERVER_IP=&amp;quot;your_server_public_ip&amp;quot; # Replace with your server's public IP&lt;br /&gt;
    SERVER_NAME=&amp;quot;MyOpenVPNServer&amp;quot;    # Replace with a descriptive name for your server&lt;br /&gt;
&lt;br /&gt;
    if [ -z &amp;quot;$CLIENT_NAME&amp;quot; ]; then&lt;br /&gt;
      echo &amp;quot;Usage: $0 &amp;lt;client_name&amp;gt;&amp;quot;&lt;br /&gt;
      exit 1&lt;br /&gt;
    fi&lt;br /&gt;
&lt;br /&gt;
    # --- Check for required files ---&lt;br /&gt;
    if [ ! -f &amp;quot;$EASYRSA_DIR/pki/ca.crt&amp;quot; ] || \&lt;br /&gt;
       [ ! -f &amp;quot;$EASYRSA_DIR/pki/issued/$CLIENT_NAME.crt&amp;quot; ] || \&lt;br /&gt;
       [ ! -f &amp;quot;$EASYRSA_DIR/pki/private/$CLIENT_NAME.key&amp;quot; ] || \&lt;br /&gt;
       [ ! -f &amp;quot;$OVPN_DIR/ta.key&amp;quot; ]; then&lt;br /&gt;
      echo &amp;quot;Error: Missing required certificate or key files for client '$CLIENT_NAME'.&amp;quot;&lt;br /&gt;
      echo &amp;quot;Please ensure you have generated them using easyrsa.&amp;quot;&lt;br /&gt;
      exit 1&lt;br /&gt;
    fi&lt;br /&gt;
&lt;br /&gt;
    # --- Create client .ovpn file ---&lt;br /&gt;
    echo &amp;quot;Generating client configuration for $CLIENT_NAME...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # Extract CA, Client Cert, Client Key, and TA Key&lt;br /&gt;
    CA_CERT=$(cat &amp;quot;$EASYRSA_DIR/pki/ca.crt&amp;quot;)&lt;br /&gt;
    CLIENT_CERT=$(cat &amp;quot;$EASYRSA_DIR/pki/issued/$CLIENT_NAME.crt&amp;quot;)&lt;br /&gt;
    CLIENT_KEY=$(cat &amp;quot;$EASYRSA_DIR/pki/private/$CLIENT_NAME.key&amp;quot;)&lt;br /&gt;
    TA_KEY=$(cat &amp;quot;$OVPN_DIR/ta.key&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    # Create the .ovpn file content&lt;br /&gt;
    cat &amp;lt;&amp;lt;EOF&lt;br /&gt;
client&lt;br /&gt;
dev tun&lt;br /&gt;
proto udp&lt;br /&gt;
remote $SERVER_IP 1194&lt;br /&gt;
resolv-retry infinite&lt;br /&gt;
nobind&lt;br /&gt;
persist-key&lt;br /&gt;
persist-tun&lt;br /&gt;
remote-cert-tls server&lt;br /&gt;
tls-auth ta.key 1&lt;br /&gt;
cipher AES-256-CBC&lt;br /&gt;
verb 3&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ca&amp;gt;&lt;br /&gt;
$CA_CERT&lt;br /&gt;
&amp;lt;/ca&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cert&amp;gt;&lt;br /&gt;
$CLIENT_CERT&lt;br /&gt;
&amp;lt;/cert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;key&amp;gt;&lt;br /&gt;
$CLIENT_KEY&lt;br /&gt;
&amp;lt;/key&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tls-auth&amp;gt;&lt;br /&gt;
$TA_KEY&lt;br /&gt;
&amp;lt;/tls-auth&amp;gt;&lt;br /&gt;
EOF&lt;br /&gt;
    # Save the .ovpn file&lt;br /&gt;
    OUTPUT_FILE=&amp;quot;${CLIENT_NAME}.ovpn&amp;quot;&lt;br /&gt;
    echo &amp;quot;$(&amp;amp;&amp;amp; cat &amp;lt;&amp;lt;EOF&lt;br /&gt;
client&lt;br /&gt;
dev tun&lt;br /&gt;
proto udp&lt;br /&gt;
remote $SERVER_IP 1194&lt;br /&gt;
resolv-retry infinite&lt;br /&gt;
nobind&lt;br /&gt;
persist-key&lt;br /&gt;
persist-tun&lt;br /&gt;
remote-cert-tls server&lt;br /&gt;
tls-auth ta.key 1&lt;br /&gt;
cipher AES-256-CBC&lt;br /&gt;
verb 3&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;ca&amp;amp;gt;&lt;br /&gt;
$CA_CERT&lt;br /&gt;
&amp;amp;lt;/ca&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;cert&amp;amp;gt;&lt;br /&gt;
$CLIENT_CERT&lt;br /&gt;
&amp;amp;lt;/cert&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;key&amp;amp;gt;&lt;br /&gt;
$CLIENT_KEY&lt;br /&gt;
&amp;amp;lt;/key&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;lt;tls-auth&amp;amp;gt;&lt;br /&gt;
$TA_KEY&lt;br /&gt;
&amp;amp;lt;/tls-auth&amp;amp;gt;&lt;br /&gt;
EOF&lt;br /&gt;
)&amp;quot; &amp;gt; &amp;quot;$OUTPUT_FILE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    echo &amp;quot;Client configuration saved to $OUTPUT_FILE&amp;quot;&lt;br /&gt;
    echo &amp;quot;You can now transfer this file to your client device.&amp;quot;&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
    Make the script executable:&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo chmod +x /etc/openvpn/make_client_config.sh&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.  **Generate a client configuration file:**&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo /etc/openvpn/make_client_config.sh client1&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
    This will create a `client1.ovpn` file in the `/etc/openvpn/` directory. You will need to securely transfer this file to your client device.&lt;br /&gt;
&lt;br /&gt;
== Step 6: Connect Clients ==&lt;br /&gt;
&lt;br /&gt;
The `client1.ovpn` file contains all the necessary information for a client to connect to your OpenVPN server.&lt;br /&gt;
&lt;br /&gt;
1.  **Install OpenVPN on your client device:**&lt;br /&gt;
    *   **Windows:** Download the installer from the official OpenVPN website ([https://openvpn.net/community-downloads/](https://openvpn.net/community-downloads/)).&lt;br /&gt;
    *   **macOS:** Use Tunnelblick ([https://tunnelblick.net/](https://tunnelblick.net/)) or the official OpenVPN client.&lt;br /&gt;
    *   **Linux:** Install `openvpn` package (e.g., `sudo apt install openvpn` or `sudo dnf install openvpn`).&lt;br /&gt;
&lt;br /&gt;
2.  **Import the `.ovpn` file:**&lt;br /&gt;
    *   **Windows/macOS:** Open the OpenVPN client application and import the `.ovpn` file.&lt;br /&gt;
    *   **Linux:** Copy the `.ovpn` file to `/etc/openvpn/client/` (create the directory if it doesn't exist) and run:&lt;br /&gt;
        &amp;lt;pre&amp;gt;&lt;br /&gt;
        sudo openvpn --config /etc/openvpn/client/client1.ovpn&lt;br /&gt;
        &amp;lt;/pre&amp;gt;&lt;br /&gt;
        Or, for a systemd service:&lt;br /&gt;
        &amp;lt;pre&amp;gt;&lt;br /&gt;
        sudo cp client1.ovpn /etc/openvpn/client/client1.conf&lt;br /&gt;
        sudo systemctl start openvpn-client@client1&lt;br /&gt;
        sudo systemctl enable openvpn-client@client1&lt;br /&gt;
        &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.  **Connect:** Start the VPN connection from your client application. You should now be connected to your OpenVPN server.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
*   **Cannot connect:**&lt;br /&gt;
    *   Check if the OpenVPN service is running on the server: `sudo systemctl status openvpn@server`.&lt;br /&gt;
    *   Verify that UDP port 1194 is open in your server's firewall.&lt;br /&gt;
    *   Ensure your client's firewall is not blocking outgoing UDP traffic on port 1194.&lt;br /&gt;
    *   Check server logs for errors: `sudo journalctl -u openvpn@server`.&lt;br /&gt;
    *   Double-check the `remote` directive in your client `.ovpn` file points to the correct public IP address of your server.&lt;br /&gt;
&lt;br /&gt;
*   **Clients get no internet access:**&lt;br /&gt;
    *   Ensure IP forwarding is enabled on the server (`net.ipv4.ip_forward=1` in `/etc/sysctl.conf`).&lt;br /&gt;
    *   Verify your firewall's NAT rules are correctly configured to masquerade traffic from the VPN subnet (`10.8.0.0/24`) to your server's public interface.&lt;br /&gt;
    *   Check if the `push &amp;quot;redirect-gateway def&lt;br /&gt;
&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
{{Exchange Box}}&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>