Ubuntu 12.04 Server: Adding Vlan Tagging


We have a router/firewall with two NICs one used to connect to the Internet (WAN) and the other to connect to the local network (LAN). We would like to beef up the security aspect of our site and introduce a Demilitarized Zone (DMZ). If this should be implemented without the use of vlans we would have to buy a new switch and a third NIC for our router/firewall.

Luckily the switch used supports 802.1q. The switch configuration is done by adding a new vlan. How this is done should be documented in the switch documentation.


  • WAN
  • LAN
  • DMZ


sudo apt-get install vlan



Load the 8021q module into the kernel.

sudo modprobe 8021q

Create a new interface that is a member of a specific vlan, vlan id 10 is used.

sudo vconfig add eth1 10

Assigning an address to the new interface.

sudo ip addr add dev eth1.10


To make this setup permanent, some lines has to be added to some configuration files.

Add the module to the kernel on boot.

sudo su -c 'echo "8021q" >> /etc/modules'

Create the interface and make it available during the boot. Add the following lines to /etc/network/interfaces

auto eth1.10
iface eth1.10 inet static
    vlan-raw-device eth1

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
This entry was posted in Little Guides, Usefully Found Stuff and tagged , , , . Bookmark the permalink.

Comments are closed.