Synology: How to add an additional IP for VLAN?

Synology uses a linux environment but its not the same as adding one for Linux. I have a 418+ and only has one enet connection but I wanted to have an additional IP for my lab and the other for general access. The one big difference is normally I would create a virtual IP but in Synologys case it did not work as it does in Linux so I went a different route.

Instead of creating a <enet>:0 and <enet>:1 as in Red Hat 8 I just added an IP to ifcfg.eth0 for my normal traffic and a VLAN 20 for my lab. Yes I can route through VLAN if I want to but I am restricting traffic on the lab side. Here is how I did it there may be another way but this worked.

Adding IP via CLI

First things first you will want to SSH into your Diskstation

  1. ssh <synology_ip>
    1. cd /etc/sysconfig/network-scripts

This is for a backup and RC parses the directory so don’t want any funkyness going on.

  1. sudo cp ifcfg-eth0 /var/tmp
    1. sudo vi ifcfg-eth0
# Make sure it looks something like this, using your subnet of course. 

DEVICE=eth0
 ONBOOT=yes
 BRIDGE=""
 BOOTPROTO=static
 IPADDR=10.0.1.166
 NETMASK=255.255.255.0
 IPV6INIT=auto_dhcp

I am using a VLAN tag of 20

  1. sudo cp ifcfg-eth0 ifcfg-eth0.20
    1. sudo vi ifcfg-eth0.20
# Make sure it looks something like this, using your subnet of course. 

DEVICE=eth0.20
 VLAN_ROW_DEVICE=eth0
 VLAN_ID=20
 ONBOOT=yes
 BOOTPROTO=static
 IPADDR=10.20.20.166
 NETMASK=255.255.255.0
 IPV6INIT=auto_dhcp

Once your done and everything looks good, double check!!! Then you can restart your network or reboot your choice.

  1. Restart Network
    1. sudo /etc/rc.network restart
    2. Check if it took
$ ip a
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
     inet 127.0.0.1/8 scope host lo
        valid_lft forever preferred_lft forever
     inet6 ::1/128 scope host 
        valid_lft forever preferred_lft forever
 2: eth0:  mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
     link/ether 00:11:32:XX:XX:XX brd ff:ff:ff:ff:ff:ff
     inet 10.0.1.166/24 brd 10.0.1.255 scope global eth0
        valid_lft forever preferred_lft forever
     inet6 fe80::211:32ff:xxxx:xxxx/64 scope link 
        valid_lft forever preferred_lft forever
 3: sit0@NONE:  mtu 1480 qdisc noop state DOWN group default qlen 1
     link/sit 0.0.0.0 brd 0.0.0.0
 8: eth0.20@eth0:  mtu 1500 qdisc noqueue state UP group default qlen 1000
     link/ether 00:11:32:XX:XX:XX brd ff:ff:ff:ff:ff:ff
     inet 10.20.20.166/24 brd 10.20.20.255 scope global eth0.20
        valid_lft forever preferred_lft forever
     inet6 fe80::211:32ff:xxxx:xxxx/64 scope link 
        valid_lft forever preferred_lft forever
  1. Verify ping both IPs
$ ping 10.20.20.166
 PING 10.20.20.166 (10.20.20.166): 56 data bytes
 64 bytes from 10.20.20.166: icmp_seq=0 ttl=64 time=0.330 ms
 64 bytes from 10.20.20.166: icmp_seq=1 ttl=64 time=0.349 ms
 ^C
 --- 10.20.20.166 ping statistics ---
 2 packets transmitted, 2 packets received, 0.0% packet loss
 round-trip min/avg/max/stddev = 0.330/0.340/0.349/0.009 ms

$ ping 10.0.1.166
 PING 10.0.1.166 (10.0.1.166): 56 data bytes
 64 bytes from 10.0.1.166: icmp_seq=0 ttl=64 time=0.269 ms
 64 bytes from 10.0.1.166: icmp_seq=1 ttl=64 time=0.452 ms
 ^C
 --- 10.0.1.166 ping statistics ---
 2 packets transmitted, 2 packets received, 0.0% packet loss
 round-trip min/avg/max/stddev = 0.269/0.361/0.452/0.091 ms

Thats it, I hope you find it valuable.