Connecting OpenVPN Client to Host Server on a Windows PC: A Comprehensive Guide
In this article, we will discuss the process of setting up an OpenVPN host server on a Windows PC and initiating a connection from a client. OpenVPN is an open-source virtual private network (VPN) software that allows users to securely connect to remote networks over the internet. It is widely used for creating secure connections between a client and a server, enabling remote access to a private network, and securing internet traffic.
Prerequisites
- A Windows PC with administrative privileges
- OpenVPN software for Windows
- A second Windows PC or a device with OpenVPN client software
Setting Up the OpenVPN Host Server on a Windows PC
To set up the OpenVPN host server on a Windows PC, follow these steps:
- Download and install the OpenVPN software for Windows from the official website.
- Create a new folder on the host PC to store the necessary configuration files.
- Create a new text file in the folder and add the following lines:
dev tun
proto udp
port 1194
ca ca.crt
cert server.crt
key server.key
dh dh.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
cipher AES-256-CBC
comp-lzo
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
verb 3
This configuration file sets up a TUN device, uses UDP protocol on port 1194, and specifies the necessary certificates and keys for the server. It also creates a virtual network (10.8.0.0/24) and sets up DNS servers for the clients.
- Generate the necessary certificates and keys using OpenVPN's easy-rsa tool or a third-party tool.
- Place the ca.crt, server.crt, server.key, dh.pem, and ipp.txt files in the same folder as the configuration file.
- Run the OpenVPN GUI as an administrator and right-click the icon in the system tray. Select "Import > File" and choose the configuration file.
- Right-click the OpenVPN icon again and select "Start this configuration." The OpenVPN host server should now be running.
Initiating a Connection from the OpenVPN Client
To initiate a connection from the OpenVPN client, follow these steps:
- Download and install the OpenVPN client software on the client device.
- Create a new text file on the client device and add the following lines:
client
dev tun
proto udp
remote [host IP address or hostname] 1194
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
cipher AES-256-CBC
comp-lzo
verb 3
Replace [host IP address or hostname] with the IP address or hostname of the OpenVPN host server.
- Save the text file with a .ovpn extension.
- Place the ca.crt file in the OpenVPN client's config folder.
- Run the OpenVPN client software and import the .ovpn file.
- Click the "Connect" button to initiate the connection.
In this article, we have discussed the process of setting up an OpenVPN host server on a Windows PC and initiating a connection from an OpenVPN client. By following the steps outlined in this article, users can securely connect to a remote network over the internet and access resources on the private network.
References
- OpenVPN Community (n.d.). OpenVPN 2.5.5 x86\_64-w64-mingw32 [Software]. Retrieved from https://openvpn.net/community-downloads/
- OpenVPN (n.d.). EasyRSA 3.0.8 [Software]. Retrieved from https://github.com/OpenVPN/easy-rsa/releases/tag/v3.0.8
- OpenVPN (n.d.). Configuration Variables. Retrieved from https://openvpn.net/community-resources/reference-manual-for-openvpn-2-4/