Here is some example data that will be used for the network configuration file

  • VLAN Tag – 100
  • IP Address – 192.168.160.2
  • Netmask – 255.255.255.0
  • Device Name – enp0s41a7

First check if the VLAN module is loaded and the package is installed

lsmod | grep 8021q
dpkg-query -l | grep vlan

If it is not installed then run the installer and load into the modules

apt-get install vlan
modprobe 8021q && echo "8021q" >> /etc/modules

Once that is done next we want to list the adapter names available then open your interfaces config file in nano

ls /sys/class/net
nano /etc/network/interfaces

Here is what you would enter if you want to enable DHCP on the VLAN

auto enp0s41a7.100 
     iface enp0s41a7.100 inet dhcp

Here is what you would enter if you want to set a static address

auto enp0s41a7.100 
     iface enp0s41a7.100 inet static 
     address 192.168.160.2 
     netmask 255.255.255.0

For the best results I needed to unplug the cable then run the following command to restart the networking service

systemctl restart networking

You can then connect to your VLAN and test out the connection

ifconifg
ip address show
ping

References:

VLAN Interfaces on Debian – Support Centre – Simply Hosting & Servers
How to setup VLANs on Debian-based Linux (digitalarmedforces.org)