Set up a VPN access with a Synology NAS
In this article, you’ll find all the information you need to set up VPN access using a Synology NAS (and more specifically the OpenVPN protocol as VPN server and an Android phone as client.
Objective
To set up the needed elements, we will perform the following steps:
- Create a specific user (named vpn) for VPN access.
- Install the VPN Server application .
- Install a Let’s Encrypt certificate
- Setting up the VPN Server application
- Installing and configuring VPN access on the phone (Android)
Create a specific user for VPN access
We’re going to create a local user, named vpn, on the NAS specifically to access the VPN server, so that we can limit rights if necessary.
To create the vpn user:
- Click on the
Main menu
(top left on the main screen) - Click on the
Control Panel
application - Click on the
User & Group
menu - Click on the
Create
button, then on theCreate user
option. - Fill in the details of the new local user (named vpn)
- Click on the
Save
button to validate changes
Install the VPN Server application
To install the VPN Server application, follow the steps below:
- Click on
Main menu
(top left of main screen) - Click on the
Package Center
application - Click on the
All Packages
filter in the menu on the left of the screen - Select the
VPN Server
application and click onInstall
Note : If the Package Center
application asks you to install dependencies, click on Yes
.
To check that the VPN Server application has been installed, follow the steps below:
- Click on
Main menu
(top left of main screen) - Click on the
Package Center
application - Click on the
Installed
filter in the menu on the left of the screen - You should see the
VPN Server
application with theOpen
option.
Install a Let’s Encrypt certificat
To secure access to the VPN, we’re going to set up a Let’s Encrypt certificate for the VPN Server application:
- Click on the
Main menu
(top left of main screen) - Click on the
Control Panel
application - Click on the
Security
menu and click on theCertificate
tab - Click on the
Add
button to add a certificate
- Fill in the description, select the
Get a certificate from Let's Encrypt
option and click on theNext
button
- Fill in the fields and click on the
Done
button to validate the certificate creation
Setting up the VPN Server application
We’re going to limit ourselves to the OpenVPN protocol, which will enable us to access all the services we require by connecting to the VPN access. It is also possible to use the PPTP and L2TP/IPSec protocols.
To access the VPN Server application configuration menu :
- Click on the
Main menu
(top left of main screen) - Click on the
VPN Server
application
Available options :
- Overview : Shows the current status of VPN usage by protocol (number of connections in progress)
- Connection List : Provides information on current connections (username, IP address, protocol, uptime)
- Log : Log message for connections, disconnections, …
- General Settings: Defines general application behavior and security
- Privilege: Manage rights between users and protocols
Les différentes options disponibles :
- Overview : Donne l’état actuel de l’utilisation du VPN en fonction de chaque protocole (le nombre de connexion en cours)
- Connection List : Donne des informations sur les connexions en cours (nom d’utilisateur, adresse IP, Protocole, uptime)
- Log : Message de log des connexions, déconnexions etc ….
- General Settings : Permet de définir le comportement général de l’application et la sécurité liée
- Privilege : Permet de gérer les droits d’utilisation entre les utilisateurs et les protocoles
Setting up the Privilege part
For the local user named vpn:
- Select OpenVPN protocol user rights only
- Click on the
Apply
button to validate the change
Setting up the General Settings part
For the general configuration :
- Set the
Network interface
option toLAN
. - Set
Account type
toLocal users
to use local NAS users. - You can enable the
Grant VPN permission to newly added local users
option if required - Click on the
Apply
button to validate changes
To set up additional security for VPN access :
- Click on the
Set up Auto Block
option to secure VPN access. - Check the
Enable auto block
box and fill in the desired values for the number of attempts before blocking (default 5). - Check the
Enable DoS protection
box on theLAN
network interface. - Click on the
Apply
button to validate changes
Setting up the OpenVPN protocol
To configure access using the OpenVPN protocol :
- Check the
Enable OpenVPN server
box. - Fill in the information
- Click on the
Apply
button to validate changes and activate VPN access.
Installing and configuring VPN access on the phone (Android)
Prerequisites: Create the profile file
- Retrieving the default profile file on your workstation :
- Click on
Main menu
(top left of main screen) - Click on the
VPN Server
application - Click on the
OpenVPN
option - Click on the
Export Configuration
button
- Click on
- Modifying the default profile file :
- Extract archive
openvpn.zip
containing the fileVPNConfig.ovpn
- Open the
VPNConfig.ovpn
file with a text editor and make the following changes :- Replace the term
YOUR_SERVER_IP
in theremote YOUR_SERVER_IP 6457
line with the IP address used to access the NAS (e.g.vpn.testing.com
) - Below the line modified in the previous step, add the line
client-cert-not-required
to be able to connect without needing a client-side certificate - Replace the last line
verify-x509-name 'testing.com' name
with the lineverify-x509-name "testing.com" name
- Replace the term
- Extract archive
- Copy the modified
VPNConfig.ovpn
file to the phone
Installing and configuring VPN access on the phone
- Install the
OpenVPN Connect
application using Google Play Store
- Open the application and select the
Upload File
tab for import the created profile file (prerequisite)
- Select the
VPNConfig.ovpn
file - click on the
OK
button to validate the import - Fill in the necessary information using the vpn user and click on the
Connect
button