Setting up a VPN

About 4 min

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 clientopen in new window to download the client.

1.2 Install the openVPN Client

  • Click 'Next'.
pic1 install_openVPN(1)
pic1 install_openVPN(1)
  • Click 'I Agree'.
pic2 install_openVPN(2)
pic2 install_openVPN(2)
  • Left default components chosen, and then click 'next'.
pic3 install_openVPN(3)
pic3 install_openVPN(3)
  • Left default install directory or choose as needed, click 'Install' to start the installation.
pic4 install_openVPN(4)
pic4 install_openVPN(4)

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.
pic5 The downloading location of configuration file
pic5 The downloading location of configuration 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.)
pic6 The configuration directory of configuration file
pic6 The configuration directory of configuration file
  • If you encounter a prompt, "You need to provide administrator privileges to move files", during the moving process, just click 'Continue'.
pic7 administrator_privileges
pic7 administrator_privileges

3 Start the VPN connection

  • From desktop, double-click the openVPN client iconAlt text. If Alt text appears in the lower right corner of the taskbar, this indicates that the client is started.

  • Right-click on the icon Alt text, select the corresponding configuration, such as “gosc_235_3”, click 'connect'

pic8 connection page
pic8 connection page
  • 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.
pic9 enter username and password
pic9 enter username and password
  • If the connection is successful, the lower right corner of the taskbar will appear: Alt text , 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.
pic10 The downloading location of configuration file
pic10 The downloading location of configuration 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.

pic11 administrator permissions(1)
pic11 administrator permissions(1)
  • Enter the username and password on the pop-up page, and click 'Ok'.
pic12 administrator permissions(2)
pic12 administrator permissions(2)

2 Install the Tunnelblick and Start the VPN connection

2.1 Downloading the Tunnelblick Client

Please click the link Tunnelblick clientopen in new window to download Tunnelblick client.

2.2 Installation and Configuration

  • Click the downloaded file will pop up the figure as shown below.
pic20 Tunnelblick client download(1)
pic20 Tunnelblick client download(1)
  • 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.
pic21 Tunnelblick configuration files(1)
pic21 Tunnelblick configuration files(1)
  • 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.
pic22 Tunnelblick configuration files(2)
pic22 Tunnelblick configuration files(2)
  • At this point, the configuration process of the VPN node configuration file is finished.
pic23 Tunnelblick configuration files(3)
pic23 Tunnelblick configuration files(3)
  • If there is a warning about the Tunnelblick version, just click 'Ok'.
pic24 Tunnelblick configuration files(4)
pic24 Tunnelblick configuration files(4)
  • Then left-click the Tunnelblick client button in the upper right corner and select the connect option.
pic25 Tunnelblick Connection(1)
pic25 Tunnelblick Connection(1)
  • 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.)
pic26 Tunnelblick Connection(2)
pic26 Tunnelblick Connection(2)
  • If there is a prompt or warning as shown in Figure 27 or 28, you can directly click 'Ok' to skip.

pic27 Tunnelblick Connection(3)pic28 Tunnelblick Connection(4)

  • 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.
pic29 Tunnelblick Connection Successfully
pic29 Tunnelblick Connection Successfully

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.
Figure 5: Configuration File Download Location
Figure 5: Configuration File Download Location

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.

openvpn connection
openvpn connection

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.

openvpn connection success
openvpn connection success

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.

openvpn disconnection
openvpn disconnection
Last updated on:
Contributors: mimas