Step-by-Step Guide to Setting Up a Virtual Private Network (VPN) Service with OpenVPN

Setting up a Virtual Private Network (VPN) service can provide a secure and private connection for your internet data. OpenVPN is a popular VPN solution that offers both client and server components, making it possible to configure a VPN for both internal and external connections. In this article, we will guide you through the steps to install, configure, and maintain a VPN service using OpenVPN.
The first step is to install and configure the OpenVPN server on a machine. This involves installing the OpenVPN software, creating a directory for the server configuration files, and generating the necessary certificates and keys. Once the server is set up, you can configure the client machines to connect to the VPN. This can be done by installing the OpenVPN client software and registering the necessary certificates.
Next, you will need to configure the OpenVPN server to accept connections from the client machines. This involves setting up the appropriate firewall rules and opening the necessary ports. You can also configure the server to enforce authentication and authorization policies, which can include password requirements, certificate checks, and user permissions. By enabling these security measures, you can ensure that only authorized users can connect to the VPN.
In addition to the basic configuration steps, there are also advanced options available with OpenVPN. For example, you can configure the server to automatically renew the certificates for the client machines through a process called autoenrollment. You can also set up multiple VPN services with different names, each with its own configuration and security settings. By understanding these advanced options, you can tailor the VPN service to meet your specific needs.
Step 1: Configure VPN server as a RADIUS client
In order to set up a virtual private network (VPN) service with OpenVPN, the first step is to configure the VPN server as a RADIUS client. This will allow the server to authenticate and authorize VPN connections using RADIUS credentials.
To configure the VPN server as a RADIUS client, you’ll need to install and configure the RADIUS plugin on the server. The detailed steps for installing and configuring the plugin can be found in the Zentyal documentation.
Once the RADIUS plugin is installed and configured, you can proceed with the configuration of the VPN server. In the Zentyal administrative interface, navigate to the “Network” section and click on “VPN” in the left-hand menu.
In the VPN configuration pane, click on the “RADIUS” tab. Here, you’ll need to enter the IP address of the RADIUS server, along with the shared secret used for communication between the VPN server and the RADIUS server.
In addition to the RADIUS server configuration, you’ll also need to configure the VPN server to use autoenrollment for VPN certificates. This will ensure that certificates are automatically issued to VPN clients when they connect to the server.
To enable autoenrollment, navigate to the “Certificates” section in the Zentyal administrative interface and click on the “Autoenrollment” tab. Enable the “Enable certificate autoenrollment” option and specify the Certificate Authority (CA) to be used for issuing VPN certificates.
With the RADIUS client and autoenrollment configurations in place, you can now proceed with the installation of OpenVPN on the server. Detailed instructions for installing OpenVPN on Zentyal can be found in the Zentyal documentation.
Once OpenVPN is installed, navigate to the “OpenVPN” section in the Zentyal administrative interface and click on the “Servers” tab. Here, you’ll be able to create and configure OpenVPN server instances for different types of VPN services.
When creating an OpenVPN server, you’ll need to specify the server type (e.g., RoadWarrior or Site-to-Site), the networks to be connected (e.g., LAN-to-LAN or Host-to-Host), and the authentication and encryption settings to be used. You can also customize the VPN server configuration by editing the server configuration files directly.
After confirming the changes, the OpenVPN server will be enabled and ready for use. You can check the server status in the OpenVPN section of the Zentyal administrative interface.
In case you need to make any changes to the VPN server configuration, you can always go back to the OpenVPN section and make the necessary adjustments. The changes will be automatically applied and the VPN server will continue to function as expected.
With the VPN server properly configured and the OpenVPN instances created, you can now proceed with the configuration of VPN clients to connect to the server. This can be done using the OpenVPN client software, which is available for different operating systems.
Step 2: Create VPN Windows client
In order to connect to the VPN server from your Windows computer, you’ll need to create a VPN Windows client. This step involves creating a virtual network adapter and configuring the necessary settings.
Prerequisites
Before creating the VPN Windows client, there are a few prerequisites that need to be met. First, you’ll need to have OpenVPN installed on your computer. You can download the installation package from the OpenVPN website. Additionally, make sure you have administrative privileges on your computer and that you have a user account on the VPN server.
Creating the VPN Windows client

To create the VPN Windows client, follow these steps:
- Open the OpenVPN GUI application on your computer.
- Click on the “File” menu, then select the “Connect” option.
- In the window that appears, you’ll need to specify the server name or IP address. Enter the name or IP address of the VPN server you want to connect to.
- Next, choose the VPN configuration file (.ovpn) that you want to use. This file contains the necessary settings for connecting to the VPN server.
- After selecting the configuration file, click on the “Connect” button to initiate the connection.
- If prompted, enter your username and password for the VPN server.
Once the connection is established, you’ll be connected to the VPN server and all your internet traffic will be routed through the VPN. You can verify that you’re connected by checking the OpenVPN GUI icon in the system tray. If the icon is green, it means you’re connected to the VPN.
Note: This guide assumes you’re using the OpenVPN GUI application, which is the recommended client for Windows. However, there are other VPN clients available for Windows that you can use as well.
Step 3: Create an Active Directory Group Policy

In order to configure and manage the connection settings for the OpenVPN clients, you will need to create an Active Directory Group Policy. This will allow you to centrally maintain and control the VPN connections on your network.
To create the Group Policy, you will first need to open the Group Policy Management Console on your Windows Server. Once opened, navigate to the Group Policy Objects folder and right-click to create a new policy.
Next, you will need to configure the policy settings for the VPN connections. This includes specifying the OpenVPN server addresses, authentication protocol, and any additional options such as DNS nameservers.
The Group Policy can also be used to define specific OpenVPN client settings, such as the VPN connection type, logon credentials, and any advanced options. This allows you to customize the VPN experience for each user or group on your network.
In addition to configuring the OpenVPN client settings, you can also use the Group Policy to set up other network-related configurations. For example, you can define the network interfaces that the VPN should use, specify the DNS suffixes, and configure the network profile.
Once the Group Policy is created and configured, you can simply apply it to the desired Active Directory users or groups. The settings will be automatically applied when the user logs on to their domain-joined machine.
By using an Active Directory Group Policy, you can centralize and streamline the management of your OpenVPN infrastructure. This allows you to easily maintain and update the VPN settings for all users on your network, ensuring secure and efficient connectivity.
Step 4: Configuration of an OpenVPN server with Zentyal
In this step, we will configure an OpenVPN server with Zentyal on your corp.contoso.com network.
Prerequisites:
- You should have Zentyal installed and set up on your network.
- An adapter should be selected for OpenVPN.
- Windows Server should be installed with NPS (Network Policy Server).
- Certification templates should be available for use.
Configuration Steps:
- Begin by creating an OpenVPN server in Zentyal.
- Define the name of the server and the IP address of your network.
- Set up the necessary rules and authorization types.
- Complete the server configuration by selecting the necessary files and certificates.
- Configure the infrastructure for the OpenVPN server, including IP addresses and ports.
- Always keep the security of your server in mind and regularly change the secret keys.
Detailed Steps:
To configure an OpenVPN server with Zentyal, follow these steps:
- Log in to your Zentyal management environment.
- Create a new OpenVPN server by navigating to the “VPN” widget.
- Select “Create new OpenVPN server” and define the server name and network IP address.
- Configure the necessary rules and authorization types for your server.
- Complete the server configuration by selecting the appropriate files and certificates.
- Configure the IP addresses and ports for your OpenVPN server.
- Keep your server secure by regularly changing secret keys and certificates.
- Save and close the configuration editor.
To remove a server, navigate to the “Certificates” widget and select the server you want to remove. Then, click on the “Remove” button to delete the server.
By following these steps, you can successfully configure an OpenVPN server with Zentyal on your corp.contoso.com network.
Step 5: Configuration of a VPN server for interconnecting networks
Prerequisites:
- A machine with Zentyal installed
- A machine connected to the Zentyal server and the internet
In this step, we will configure the VPN server on the Zentyal machine to connect multiple networks together. This will allow computers from different domains to communicate with each other securely over the internet.
To begin, open the Zentyal web interface and go to the “Network” section. In the “Interfaces” tab, select the interface that is connected to the internet and enable network address translation (NAT) if it is not already enabled. This will ensure that the computers in the internal networks can access the internet.
Next, go to the “VPN” section and click on the “OpenVPN” link. Configure the server by specifying the desired settings such as the protocol, encryption type, and authentication method. You can also set up a certificate authority to issue certificates for the clients.
Once the server configuration is complete, click on the “Clients” tab and click on the “Create new” button to add new clients. Enter the required information such as the client’s name and IP address. You can also specify additional settings such as the client’s domain and the remote networks they are allowed to access.
In the “Radius” tab, you can configure the server to use a RADIUS server for client authentication. This requires an additional machine running a RADIUS controller. Enter the required information such as the RADIUS server’s IP address and shared secret.
After configuring the server and clients, click on the “Policy” tab to set up rules for routing and firewalling. You can define rules to allow or deny traffic between the connected networks and specify the order in which the rules are applied. You can also set up NAT rules to translate the IP addresses of the internal networks.
Finally, click on the “Save” button to apply the changes and start the VPN server. The server will automatically generate the necessary configuration files and certificates for the clients. You can then distribute the client configuration files to the intended users and they can use them to connect to the VPN server.
Step 6: Create the VPN server
To establish a secure connection, you need to create the VPN server. This involves configuring the necessary infrastructure and authentication settings to ensure secure access for users.
First, update the network interfaces on the server to include the VPN adapter. This adapter will be used to handle VPN connections. You can do this by going to the network interface settings and adding the VPN adapter as a new interface.
Next, configure the VPN server details. This includes setting up the necessary templates for network configuration, IP addresses, and other related settings. Specify the internal networks you want to connect to the VPN and any additional security measures you require.
After the VPN server is created, install the necessary software and services. For Windows servers, you’ll need Microsoft Network Policy Server (NPS) to handle authentication and security. This will ensure that only authorized users can connect to the VPN.
In addition, for Linux servers, you’ll need to configure the appropriate RADIUS server to handle authentication and security. This can be done using FreeRADIUS or any other compatible server.
After the server is installed and configured, you need to add the necessary user accounts and specify the authentication mode. This step ensures that users have the required credentials to connect to the VPN and that their traffic is encrypted and secure.
Finally, test the VPN server to ensure that it is working properly. Connect a client machine to the VPN and verify that the connection is active. You can do this by checking the network status and ensuring that the VPN adapter is connected and data is flowing through it.
In summary, creating the VPN server involves setting up the necessary infrastructure, configuring the appropriate authentication and security settings, and testing the connection to ensure its functionality. By following these steps, you can establish a secure VPN service for your network, allowing users to access internal resources remotely over public networks.
Step 7: Configure NPS server as a RADIUS server
In order to enable RADIUS authentication on the NPS server, you need to configure it to act as a RADIUS server. This will allow the server to process the authentication requests from OpenVPN clients and grant or deny access accordingly.
To configure the NPS server as a RADIUS server, follow these steps:
- Open the NPS management console and navigate to the “RADIUS Clients and Servers” folder.
- Right-click on the “RADIUS Clients” node and select “New”.
- In the “Client” tab, enter the details of your OpenVPN server as a RADIUS client, including the IP address and shared secret.
- Click “OK” to save the changes.
- Next, right-click on the “RADIUS Clients” node again and select “Show RADIUS Clients”.
- In the resulting window, you’ll see the OpenVPN server listed as a RADIUS client.
- Close the “Show RADIUS Clients” window.
- Now, go back to the “RADIUS Clients and Servers” folder and right-click on the “Remote RADIUS Server Groups” node.
- Select “New” to create a new remote RADIUS server group.
- In the “Group Name” field, enter a name for the group, such as “OpenVPN RADIUS Group”.
- Click “Add” to add the OpenVPN server as a member of the group.
- Next, go to the “Policies” folder and right-click on the “Network Policies” node.
- Select “New” to create a new network policy.
- In the “Specify Conditions” window, select the appropriate conditions for your scenario, such as the user name or group.
- Click “Next” to proceed.
- In the “Specify Access Permission” window, select “Grant access” or “Deny access” as needed.
- Click “Next” to continue.
- In the “Configure Authentication Methods” window, select “RADIUS Authentication” and “Unencrypted authentication (PAP, SPAP)”.
- Click “Next” to proceed.
- In the “Configure RADIUS Client Servers” window, select the “OpenVPN RADIUS Group” that you created earlier.
- Click “Next” and then “Finish” to complete the configuration.
By completing these steps, you have configured the NPS server as a RADIUS server and set up the necessary policies for RADIUS authentication. This will allow the server to authenticate OpenVPN clients and grant or deny access based on the defined conditions.
Step 8: Prerequisites
In order to successfully set up a Virtual Private Network (VPN) service with OpenVPN, there are some prerequisites that need to be met.
- Have a computer or server with OpenVPN installed: To create your own VPN service, you will need a computer or server with OpenVPN installed. OpenVPN is a powerful open-source VPN solution that allows secure connections between computers over a public network.
- Create user accounts: Most VPN services require user authentication. You will need to create user accounts with usernames and passwords in order to provide access to your VPN network. This can typically be done through the user management options in OpenVPN or through a central directory service like Active Directory.
- Configure network settings: Choose the IP addresses and subnets you want to use for your VPN network. These addresses should be different from those used in your local network to avoid conflicts. Be aware that if you are deploying your VPN in a remote environment, you will need to ensure that the necessary IP addresses are available and can be routed to the VPN server.
- Obtain necessary certificates: OpenVPN uses certificates for encryption and authentication. You will need to obtain or generate the necessary certificates and private keys to enable secure communication between clients and servers. This process usually involves creating a Certificate Authority (CA) and signing certificates for individual users and servers.
- Configure directory services: If you are using a central directory service to manage user accounts, such as Active Directory or OpenLDAP, you will need to configure the OpenVPN server to authenticate against this directory. This involves setting up the necessary LDAP or RADIUS connection details and configuring the server to use these services for user authentication.
By completing these prerequisites, you will be ready to proceed to the next step in setting up your VPN service with OpenVPN.
Step 9: Create VPN User and Group
In this step, we will create a VPN user and group to manage the VPN connections. This will allow us to control who has access to the VPN and define the rules for their connections.
Create VPN User
To create a VPN user, we need to go to the Zentyal web interface and navigate to Users and Computers. From here, we can add a new user by clicking on the “Add User” button. Fill in the necessary information such as username, password, and email address. Make sure to select the VPN group as the primary group for this user.
Create VPN Group
Next, we will create a VPN group to assign to the VPN user. Go to Groups and click on the “Add Group” button. Name the group and select the “VPN Users” template. This template allows the group members to access the VPN service.
Configure VPN Service for User and Group
Once the VPN user and group are created, we need to configure the VPN service to allow connections from these users. Go to VPN and click on the “Configure” button next to the OpenVPN server configuration. In the “Access” tab, select the “VPN Users” group and check the box for “Allow members of this group to access the VPN service”. Click on “Apply” to save the changes.
Confirm VPN User and Group for OpenVPN Server
Lastly, we need to confirm that the VPN user and group are registered with the OpenVPN server. Download the OpenVPN configuration files from the Zentyal web interface and open the openvpn.conf file. In this file, look for the lines that define the user and group for the OpenVPN process. Make sure that they match the VPN user and group created earlier.
In case you are using a Windows machine as the OpenVPN server, the user and group are defined in the NPS (Network Policy Server) configuration directory. Check the register.txt file in this directory to confirm the user and group settings.
With the VPN user and group configured, you are now ready to connect to the VPN service using the credentials of the VPN user. All the VPN traffic will be encrypted and the VPN service will be available for those interconnecting networks.
Step 10: Create the domain controller
Once you have successfully set up the OpenVPN servers and established a connection between them, the next step is to create the domain controller. This will serve as the central authority for managing and controlling user access in your VPN environment.
To create the domain controller, enter a name for it and make sure it is set as “active.” The domain controller will be the main server that all other servers and clients will connect to.
Before you can configure the domain controller, you need to confirm that the necessary prerequisites are in place. These include having a Windows infrastructure installed and the OpenVPN software running on all the connecting machines.
Next, you will configure the domain controller by entering the necessary details, such as the IP addresses and DNS names of the servers and clients in your VPN environment.
After configuring the domain controller, you can then set up the certificate authority. This is important for issuing and renewing SSL certificates for secure connections within the VPN.
The domain controller uses the Active Directory Domain Services (AD DS) to manage user accounts, groups, and computer names. You will need to configure the AD DS to ensure that all users and computers can authenticate and connect to the VPN.
Once the domain controller is set up, you can start interconnecting other servers and clients in your VPN environment. This can be done by configuring the network settings on each machine to point to the domain controller as the primary controller.
Finally, you can set up logon and dial-in policies to control user access to the VPN. This can be done through the Remote Access Dial-In User Service (RADIUS), which is a protocol that allows for authentication and authorization of remote users.
In summary, creating a domain controller is a crucial step in setting up a VPN environment with OpenVPN. It serves as the central authority for managing user access and controlling connections. By configuring the domain controller and setting up the necessary services, you can ensure that your VPN is secure and accessible to the right users.
Step 11: Next steps
1. Define network settings: In the Linux server, install OpenVPN and configure it to work with the domains and networks you want to connect to. This can be done using the OpenVPN server management bundle provided by the OpenVPN website or through a separate bundle that is specifically designed for your infrastructure.
2. Enable user support: After the server is installed and configured, you can enable user support for OpenVPN. This option allows users to connect to the VPN service using their own certificates and credentials, making it easier for them to access the network securely.
3. Configure firewalls and gateway: To ensure that the OpenVPN server and its clients can communicate with each other, you need to configure the firewalls and gateway settings for both the server and the connecting machines. This step will allow traffic to flow between the networks connected through the VPN.
4. Update network policies: If you want to change the way OpenVPN advertisements are handled or control the network policy, you can configure these details using the OpenVPN server management widget. This way, you can define how OpenVPN connects to your networks and advertise the VPN service to other members of your organization.
5. Install and configure NPS: In order to authenticate and authorize users who want to connect to the VPN service, you will need to install and configure Network Policy Server (NPS). This Microsoft tool can be used to define the policies and credentials for user authentication and access control.
Step 12: Create the NPS server
After setting up the Active Directory Certificate Services, the next step is to create the Network Policy Server (NPS) server. In this step, we will configure the NPS server to allow the VPN connections and authenticate the users.
Creating an NPS server
To create the NPS server, follow these steps:
- Open the NPS server console by clicking on “Start” and typing “NPS” in the search pane. Then, click on “Network Policy Server” to open the NPS console.
- In the NPS console, click on “RADIUS server for 802.1X Wireless or Wired Connections” and then click on “Configure 802.1X” to open the NPS Configuration Wizard.
- In the NPS Configuration Wizard, select “Create a new RADIUS server” and click “Next”.
- Enter a name for the NPS server and the IP address of the network adapter that will be used for VPN connections. If you have multiple network adapters, make sure to select the one that will be used for VPN.
- Select “Use this server as a RADIUS server” and click “Next”.
- On the “Authentication Methods” screen, select “Microsoft: Protected EAP (PEAP)” and click “Configure”.
- In the “Protected EAP Properties” dialog box, select the certificate that was created in Step 9 and click “OK”.
- Click “Next” to continue with the wizard.
- On the “Configure Accounting” screen, select the type of accounting to be used and click “Next”.
- On the “Configure Logging” screen, select the log file directory and log file name, and then click “Next”.
- On the “Configure Firewall” screen, select the type of firewall settings to be used. If you are using a remote access scenario, select “Windows Firewall with Advanced Security”. If you are using a site-to-site scenario, select “Custom Configuration”.
- If you selected “Windows Firewall with Advanced Security”, click “Next” and then click “Finish” to complete the NPS Configuration Wizard.
- If you selected “Custom Configuration”, click “Next” and then click “Finish” to complete the NPS Configuration Wizard. You will need to manually configure the firewall settings on the NPS server and any facing firewalls.
Note:
If you are using a Linux machine as the VPN gateway, then you will need to install and configure an NPS-compatible RADIUS server, such as FreeRADIUS or OpenRADIUS.
After creating the NPS server, it is important to check the NPS server settings and remove any pending or unused NPS servers. This can be done by clicking on “NPS (Local)” in the NPS console, and then clicking on “Registered Servers” in the details pane. From there, you can remove any NPS servers that are no longer used or facing any issues.
Step 13: Tutorial Deploy Always On VPN – Set up infrastructure for Always On VPN
In this step, we will introduce the scenario and set up the infrastructure for Always On VPN.
Step 13.1: Set up Zentyal Servers
To deploy Always On VPN, we need to have two Zentyal servers – one acting as the VPN server and the other as a domain controller. These servers will be located in the corp.contoso.com domain.
Step 13.2: Create a Separate Network
We need to create a separate network for the VPN infrastructure. This network will be used to connect the VPN clients to the servers. Configure the network interfaces on both Zentyal servers accordingly.
Step 13.3: Configure Zentyal Server as VPN Server
The Zentyal server that will act as the VPN server needs to be configured appropriately. This includes setting up the VPN protocol, configuring ports, and configuring remote access settings.
Step 13.4: Configure Zentyal Server as Domain Controller
The other Zentyal server needs to be configured as a domain controller. This involves setting up the domain, creating user accounts, and configuring other necessary settings.
Step 13.5: Generate and Deploy Certificates
We need to generate and deploy certificates for the Always On VPN infrastructure. These certificates will be used to authenticate the VPN clients and servers. Make sure to distribute the certificates to all the relevant members in the infrastructure.
Once these steps are completed, the infrastructure for Always On VPN will be set up and ready to be used.
Вопрос-ответ:
What is a virtual private network (VPN) service?
A virtual private network (VPN) service is a secure and encrypted connection between a user’s device and the internet. It allows users to browse the internet anonymously by masking their IP address and encrypting all the data transmitted between their device and the VPN server.
Why should I set up a virtual private network (VPN) service?
There are several reasons why setting up a VPN service can be beneficial. Firstly, it provides an additional layer of security by encrypting your internet traffic, making it much more difficult for hackers or eavesdroppers to intercept your data. Secondly, it allows you to bypass geo-restrictions and access content that may be blocked in your region. Additionally, a VPN service ensures your privacy by hiding your IP address and preventing your internet service provider from monitoring your online activities.
What is OpenVPN?
OpenVPN is an open-source software application that allows you to create a secure and encrypted virtual private network (VPN) connection. It is one of the most popular VPN protocols available and is known for its strong security and flexibility. OpenVPN can be used on various operating systems and devices, including Windows, Mac, Linux, Android, and iOS.
How do I set up OpenVPN?
Setting up OpenVPN involves several steps. Firstly, you need to download and install the OpenVPN software on your device. Next, you need to create a configuration file that contains the necessary settings for your VPN connection. This file is usually provided by your VPN service provider. Once you have the configuration file, you can import it into the OpenVPN software and establish a connection to the VPN server. Detailed instructions can be found in the official OpenVPN documentation or provided by your VPN service provider.
Are there any alternatives to OpenVPN?
Yes, there are several alternatives to OpenVPN. Some popular alternatives include IPsec, L2TP/IPsec, PPTP, and WireGuard. Each of these protocols has its own advantages and disadvantages in terms of security, speed, and compatibility. The choice of protocol depends on your specific needs and requirements. It is recommended to research and compare different protocols before choosing the one that suits you best.
Видео:
How To Use Private Internet Access | Quick and Easy PIA VPN Setup Tutorial
How To Use Private Internet Access | Quick and Easy PIA VPN Setup Tutorial by VPN Prince 1 month ago 5 minutes, 1 second 1,924 views
How to Install OpenVPN on Ubuntu (self-hosted VPN)
How to Install OpenVPN on Ubuntu (self-hosted VPN) by Tony Teaches Tech 1 year ago 9 minutes, 33 seconds 167,894 views
Step-by-Step Guide to Setting up a Free VPN with OpenVPN
Step-by-Step Guide to Setting up a Free VPN with OpenVPN by Buzz2day Tech 2 months ago 7 minutes, 33 seconds 15,905 views