I just did this on Debian 9, it might work on older versions and more than likely Ubuntu

Do everything as root: sudo su -

Install vlan package: apt-get install vlan

Load 8021q module: modprobe 8021q

Add 8021q module at bootup: echo 8021q | sudo tee -a /etc/modules

Make sure it is in the file: cat /etc/modules

Now we need to edit the interfaces file: nano /etc/network/interfaces

There will probably be something like below

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

To add vlan support you just have to change the above to the below. You just have to add .300 for vlan 300 or .200 for vlan 200

# The primary network interface
allow-hotplug eth0
iface eth0.300 inet dhcp

Once that has been done you have to remember for each vlan to add the following for each vlan if it isn’t there already

auto eth0.300