HowTo: Set up an OpenVPN instance to establish a Client-to-Site VPN connection
In this tutorial, we will teach you how to install OpenVPN on TWSC VCS instances to establish a secure connection from the local computer to the jump server, and then from the jump server to other instances in the same virtual network.
Below we use the combination of a Linux (Ubuntu) VCS instance and a local Windows computer as an example.
Step 1. Create a VCS instance (Linux)
The following steps are only applicable to instances with Ubuntu 18.04 or above.
Please refer to Create a VCS instance to create a Linux VCS instance with a public IP as a jump server to set up OpenVPN and connect to other unattached IP appliances.
Step 2. Set up the security group of the jump server
Since OpenVPN uses UDP 1194 port for communication by default, please refer to Security Group to add Ingress UPD 1194 security group rule to the jump server.
Step 3. Connect and install OpenVPN
- Connect to Linux instances and use
wget
command to download the OpenVPN installation script.
wget https://git.io/vpn -O openvpn-ubuntu-install.sh
- Use the chmod command to set permissions so that the installation script can be run successfully.
chmod -v +x openvpn-ubuntu-install.sh
- Run the script to install OpenVPN.
sudo ./openvpn-ubuntu-install.sh
- You can press
Enter
to continue the dialog during installation.
- After installation, the
client.ovpn
file will be created and stored under /root .
- Change the directory of the
client.ovpn
file.
sudo mv /root/client.ovpn /home/ubuntu
- Download
client.ovpn
to the local computer.
Step 4. Install OpenVPN Client locally
Please download and install OpenVPN Client on your local computer for VPN connection.
Step 5. Activate VPN connection
- Open the OpenVPN program, drag and import the
client.ovpn
file downloaded in Step 3. directly into FILE.
- After dragging is complete, click CONNECT to connect.
- Connected successfully!
Step 6. Make sure VPN encrypted connection is enabled
Confirm that with the VPN connection activated in step 5. the local computer can connect to the jump server and other instances in the same virtual network with private IP, which means the VPN connection is successful.
- Obtain the private IP of the jump server.
- Open CMD on the local computer and use the ping command to confirm that it can connect to the private IP of the jump server.
- You can also ping other VCS instances in the same virtual network at the same time.