Press "Enter" to skip to content

Using 802.1q VLANs on Linux

The vlan tools (user mode utilities) should already be present on the Linux host (vconfig). On GNU/Debian they may be installed with “apt-get install vlan”.

Setting up the VLAN interfaces (as root):

# modprobe 8021q

You may skip the line above if your kernel was compiled with 802.1q and not as module.

Let’s add two VLAN interfaces based on eth4 and having the id’s 100 and 101:

# vconfig add eth4 100 
# vconfig add eth4 101 

The VLAN interfaces may now be referenced from BalanceNG as eth4.100 and eth4.101 like this (starting another BalanceNG instance for testing):

# bng start 10
BalanceNG: starting up instance 10 ...
# bng control 10
BalanceNG: connected to instance 10 PID 6425
bng# hostname "vlan-test"
vlan-test# interface eth4.100
interface eth4.100 successfully attached
vlan-test# interface eth4.101
interface eth4.101 successfully attached
vlan-test# show conf
  //        configuration taken Sat Mar 10 10:44:27 2007
  //        BalanceNG 1.807 (created 2007/03/09)
  hostname  vlan-test
  interface eth4.100
  interface eth4.101
  //        end of configuration
vlan-test#