VLAN Interfaces on Debian

This step by step guide is for configuring VLAN interfaces on Debian based operating systems.

For the following guide we will use the following data and assume that you are running all commands as the root user:

TypeValue
VLAN Tag1000
IP Address192.0.2.1
Netmask255.255.255.0
Deviceem1

Step-by-step guide

How to do it:

  1. Determine whether the 802.1q VLAN module is loaded:
lsmod | grep 8021q
  1. If it is loaded, go straight to step 5, otherwise make sure the VLAN package is installed:
dpkg-query -l | grep vlan
  1. If it is installed go to step 4, otherwise install it with:
apt-get install vlan
  1. With the package installed you can now load the module:
modprobe 8021q && echo "8021q" >> /etc/modules
  1. With the 802.1q module loaded into the kernel we need to determine what the interfaces are called:
ls /sys/class/net
  1. Open the existing interfaces file in your favourite editor in order to add the new VLAN interface to it. 
nano /etc/network/interfaces
  1. At the end of this file, we append the configuration for the VLAN – please replace the data here with the correct interface name, VLAN tag and your preferred IP addressing schema (This should be RFC1918 private address space to avoid issues).

Info: This guide is intended for single interface configurations only, VLAN interfaces on bonded interfaces follow a similar configuration, however the primary interface at this point will be called something like “bond0” as referenced in the bonding guide.

auto em1.1000 
     iface em1.1000 inet static 
     address 192.0.2.1 
     netmask 255.255.255.0
  1. Bring up the VLAN interface by either restarting the networking stack or issuing the up command manually
Debian 6/Ubuntu 12: "/etc/init.d/networking stop; /etc/init.d/networking start" 
Debian 7/Ubuntu 14: "/etc/init.d/networking stop; /etc/init.d/networking start" 
Debian 8/Ubuntu 16: "systemctl restart networking"
  1. The device should now be up and visible under the “ifconfig” or “ip address show” commands. You may test it by issuing a ping command to another machine that is already configured

Get in touch

If you need advice on VLAN Interfaces for Debian, we’re here to help.

Call us on 0333 247 0222: Monday – Friday, 9am – 5.30pm.

Chat with us on LiveChat: Monday – Friday, 9am – 5.30pm.

Write to us: Send us a support ticket from your Simply portal and we’ll get back to you as soon as we can.

If you don’t have an account with Simply Hosting yet, you can also send our Sales team an enquiry and we’ll get back to you between 9am and 5.30pm, Monday to Friday.


Was this article helpful?

Related guides