If you need to connect to an OpenVPN server using an .ovpn file, you can establish a connection through the following steps in QTS 4.2:
Create a text file “openvpn_client_login.txt” with your username and password in it:
Admin Connection username Password123 Connection password
- The .ovpn configuration file (hereinafter referred to as “openvpn.ovpn”.)
- Certificate (hereinafter referred to as “ca.crt”, if it is not provided, then it is unnecessary.)
Text file: “openvpn_client_login.txt”.
Change mode openvpn_client_login.txt:
chmod 600 /etc/openvpn/openvpn_client_login.txt
mv /etc/openvpn/openvpn.ovpn /etc/openvpn/client.conf
- ca /etc/openvpn/ca.crt (Specify the certification location)
- auth-user-pass /etc/openvpn/openvpn_client_login.txt (Specify the username and password)
- up /etc/openvpn/openvpn_up
- down /etc/openvpn/openvpn_down
Using the QNAP NAS' built-in OpenVPN Server configuration file as an example (modified parts are marked in yellow):
remote 172.17.20.134 1194
Add the command lines in /etc/config/vpn.conf
Enable = TRUE
Status = 1
Index = 4
Gateway = 1
Allow Connect = 0
Reconnect = 1
Server Address = OpenVPN.myQNAPcloud.com
Profile File = OpenVPN4
VPN Proto Type = TCP
VPN Port = 1194
Compress = 1
Re-direct gateway = 1
Encryption = 1
Name = admin
AccessCode = AAA
Time Stamp = 0
[OPENVPN_CLIENT4]: According to your established OpenVPN Client connection number +1. As in the following illustration: three OpenVPN connection is established, so enter: 4.
- Enable = TRUE: Enable this connection (it will be “False” when the connection is disconnected.)
- Status = 1: Enable this connection (it will be “0” when the connection is disconnected.)
- Index = 4: Same as item A.
- Gateway = 1: If you want to set this VPN connection to be the default gateway then set to 1, and vice versa, set to 0.
- Server Address = OpenVPN.myQNAPcloud.com: The VPN server’s IP address or domain.
- Profile File = OpenVPN4: The name shown on the VPN client page.
- VPN Proto Type = TCP: The VPN connection protocol.
- VPN Port = 1194: The VPN connection port number.
- Compress = 1: Enable compression, or set as 0 to disable it.
Name = admin: The connection username.
- [OPENVPN_CLIENT4]: According to your established OpenVPN Client connection number +1. As in the following illustration: three OpenVPN connection is established, so enter: 4.
Start VPN connection:
Enter the command: /etc/init.d/vpn_openvpn_client.sh start 4 &
(Note: the number “4” is the index of this connection)
Edit /etc/resolv.conf, adding the DNS IP address (e.g. 18.104.22.168)
Check the connection:
Enter ps | grep openvpn, If the reply contains the red part, it means that the connection has been established:
6714 admin 536 R grep openvpn
31906 admin 2152 S /usr/sbin/openvpnclient /etc/openvpn/client.conf
Or you can go to VPN client page, the connection is already receiving and transmitting packets.
Click “disconnect” in the VPN client page.
Please note, if you want to reconnect to the VPN, do not click the “connect” button in the VPN client page. Please repeat these settings:
Enable = TRUE
Status = 1
- Enter the command line: # /etc/init.d/vpn_openvpn_client.sh start 4 &
- Edit /etc/config/vpn.conf:
Release date: 2015-10-06
Was it helpful?
26% of people think it helps.