Synology DSM7 Multiple VLAN’s

For an project I needed to have multiple VLAN’s on my Synology NAS (216+ II). There was an need for 4 VLAN’s on the NAS. It’s an test NAS so is already has DSM 7.0 (41222) installed on it. On DSM 6 I once tried to map some VLAN’s on an instance, but this just doesn’t work nice with them DSM software. It bugs and only shows the interface with the highest VLAN ID. Today I’ve tried it again with DSM 7, and to my surprise it worked quite flawless. So my idea of starting an blog was then confirmed and so here is my first blog post on TechBlik!
The steps for adding VLAN’s
Step 1: Configuring network interface
We first go to Control panel > Network > Network Interface > LAN-edit. Then we will “Enable VLAN (802.1Q)” Then in de “VLAN ID” field we will enter our desired VLAN ID (the first one, the rest comes later).
Step 2: Enabling SSH
To enable we need to go to Control Panel > Terminal & SNMP > Terminal > Enable SSH service. It’s possible to change the SSH port for security purposes.
Step 3: Accessing the NAS by SSH
To access the system you need an SSH client Putty for example. I personally prefer the use of MobaXterm (Free version). When you have an client open fill in the IP or on CLI (Command Line Interface) type “ssh admin-user@192.168.1.2 -p 22 (or other port)”
Step 4: Gaining root access
When we are logged in we will need to get root access. This is because only root is allowed to make changes in system files. We can become root by issuing the following command “sudo -i” followed by the admin password. At this stage we have an shell on root level.
Step 5: Creating interface config files
Now we need to copy an existing interface file and change the name and contents of this file. We first need to move in to the following folder: “cd /etc/sysconfig/network-scripts“. In this folder are all the interface config files stored (ls to show contents of folder). In this folder the following file will be present ifcfg-ETH0.90. This name is built up in ifcfg-(Name of the NIC).(VLAN ID)
So: LAN1=eth0 and VLAN90=90 makes: ifcfg-eth0.90
Step 5.5: Copying and modifying interface config files
First we need to copy an existing config file “cp ifcfg-eth0.90 ifcfg-eth0.10” then we open the copied file with “vi ifcfg-eth0.10” then for changing the file you need to press the [i] key, this opens the –Insert– modus in VI. Then we need to change the first line “device” here we need to change (in my case) the device from “eth0.90 to eth0.10“. Also the “VLAN“ line needs to be changed to the desired VLAN ID. When done changing the file the procedure for exiting VI is “[ESC] :wq!”, Escape to stop editing : to open the option line and w (write) q (quit) ! (override).
cp ifcfg-eth0.90 ifcfg-eth0.10
vi ifcfg-eth0.10
#VLAN network interface
DEVICE=eth0.10
VLAN_ROW_DEVICE=eth0
VLAN_ID=10
ONBOOT=yes
BOOTPROTO=dhcp
Step 6: Finishing and rebooting
When all files are changed and created we need to reboot the NAS. You can do this by typing the command “reboot” on the CLI. When the reboot is finished the interfaces will appear in the DSM settings.
Update: As metioned by Partick in the comments an sudo /etc/rc.network restart is sufficient.
And then we are done!
Have fun with you DS an VLAN interfaces!
It’s possible to change network settings in the network control panel. Those settings will be nicely changed in de VLAN configuration file so this will not give problems. On a soft reset (4sec reset button hold) the network settings will be restored and our VLAN setting and config files will be removed!