Setting up a VPN
Setting up a VPN
Some Service Units require a VPN to establish an SSH connection.
Windows
1 Install the openVPN client
1.1 Download the openVPN Client
Please click the link openVPN client to download the client.
1.2 Install the openVPN Client
- Click 'Next'.
- Click 'I Agree'.
- Left default components chosen, and then click 'next'.
- Left default install directory or choose as needed, click 'Install' to start the installation.
2 Install configuration file
There is a configuration file (i.e. VPN node configuration file) needs to be installed before starting a VPN.
Each Service Unit offers only one configuration file. That is, all the servers in the same Service Unit shares the same one configuration file.
2.1 Download the Configuration File
- As shown in Figure 5, click 'Download' to start the download of VPN Config File.
2.2 Install the Configuration File
- Move the config file to the openVPN's folder.
The default folder of openVPN is:C:\Program Files\OpenVPN\config, as shown in Figure 6. (If the directory location is modified during the installation process, you need to find the corresponding path by yourself.)
- If you encounter a prompt, "You need to provide administrator privileges to move files", during the moving process, just click 'Continue'.
3 Start the VPN connection
From desktop, double-click the openVPN client icon. If appears in the lower right corner of the taskbar, this indicates that the client is started.
Right-click on the icon , select the corresponding configuration, such as “gosc_235_3”, click 'connect'
- Enter username and password in the prompt, and then click 'OK'. Check “Save password” if needed, the password will be remembered to avoid future input. Username and password are available on the configuration file download page.
- If the connection is successful, the lower right corner of the taskbar will appear: , this means that the VPN is connected.
macOS
1 Configuration file
- There is a configuration file (i.e. VPN node configuration file) needs to be installed before starting a VPN.
- Each Service Unit offers only one configuration file. That is, all the servers in the same Service Unit shares the same one configuration file.
1.1 Download the Configuration File
- As shown in the following figure, click 'Download' to start the download of VPN Config File.
1.2 Move the Configuration File
Move the config file in the same folder, such as the following location: /Applications/OpenVPN Connect (Installation directory can be customized.)
If you encounter a prompt, 'Modifying OpenVPN requires an administrator name and password' during the moving process, please click 'Authenticate' directly.
- Enter the username and password on the pop-up page, and click 'Ok'.
2 Install the Tunnelblick and Start the VPN connection
2.1 Downloading the Tunnelblick Client
Please click the link Tunnelblick client to download Tunnelblick client.
2.2 Installation and Configuration
- Click the downloaded file will pop up the figure as shown below.
- Follow the instructions on the figure to implement the installation process.
- After the installation is complete, a prompt message for configuring configuration files will appear, and operate as required.
- Or double-click the Tunnelblick client button in the upper right corner of the screen to pop up the configuration page.
- Manually import the VPN node configuration file into the 'Configurations' column on the left, and select 'Only Me' on the pop-up page.
- At this point, the configuration process of the VPN node configuration file is finished.
- If there is a warning about the Tunnelblick version, just click 'Ok'.
- Then left-click the Tunnelblick client button in the upper right corner and select the connect option.
- Enter the username and password, the 'Security code' can be ignored temporarily. (Username and password are available on the download page of the configuration file.)
- If there is a prompt or warning as shown in Figure 27 or 28, you can directly click 'Ok' to skip.
- After the connection is successful, the Tunnelblick button in the upper right corner will turn dark, and a page indicating the connection status will appear when you right-click the button.
- At this point, SSH connection can be implemented to the server.
Linux
Taking CentOS 9 Stream operating system as an example.
1 Installing OpenVPN via Command Line
yum -y install epel-release
yum -y install openvpn
2 Service Unit Configuration File
- The configuration files correspond to service units. In other words, for virtual machines within the same service unit, they use the same configuration file, requiring configuration only once.
2.1 Downloading Configuration Files
- The download location is as shown in the image. Click on "Download" to initiate the download. For some browsers, you might need to right-click the link and select "Save link as" to download the file.
2.2 Moving Configuration Files
- Move the recently downloaded VPN configuration file to the designated configuration file storage path. In the Linux operating system, the default configuration file storage path for OpenVPN is: /etc/openvpn/client (if you've modified the directory location during installation, you'll need to locate the corresponding path yourself).
3 Connecting to the VPN
Enter the connection command.openvpn --daemon --cd /etc/openvpn/client --config gosc_33.3.ovpn --log-append /var/log/openvpn.log --auth-user-pass
, Enter the corresponding account and VPN password as prompted.
Explanation of Parameters:
- --daemon: Run in the Background
- --cd: Configuration File Directory Path
- --config: Configuration File Name
- --log-append: Log File
- --auth-user-pass: Account and Password for the Corresponding Service Unit VPN
Note: You can run multiple processes to connect to different VPNs simultaneously, but you cannot have multiple processes enabled for the same VPN at the same time.
4 Verification
Use the command tail -f /var/log/openvpn.log
to view the log. If you see the following prompt, it indicates a successful VPN connection.
5 Disconnecting from the VPN
Use the command ps -e | grep openvpn
to find the process ID (PID) of OpenVPN. Then, use the command kill -9 PID
to terminate the process.