VLAN configuration on Ubuntu (Debian)

Posted: November 13, 2009 in Debian

Quick guide how to enable VLANs on Ubuntu or Debian.

1. Install VLAN package

aptitude install vlan

2. Edit your /etc/network/interfaces

#####################################################

 

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback

#Vlan
auto vlan1
auto vlan2

#VLAN1
iface vlan1 inet static
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
network xxx.xxx.xxx.xxx
broadcast xxx.xxx.xxx.xxx
mtu 1500
vlan_raw_device eth0

#VLAN1
iface vlan2 inet static
address 100.100.100.1
netmask 255.255.255.0
network 100.100.100.0
broadcast 100.100.100.255
mtu 1500
vlan_raw_device eth0
#####################################################
3. Make sure that switch interface you are connected to configured with respective VLANs.
4. Restart your network interface:
/etc/init.d/networking restart
it should be like this

* Reconfiguring network interfaces…                                                                                                                       Ignoring unknown interface eth0=eth0.
WARNING:  Could not open /proc/net/vlan/config.  Maybe you need to load the 8021q module, or maybe you are not using PROCFS??
Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config
Added VLAN with VID == 1 to IF -:eth0:-
WARNING:  VLAN 1 does not work with many switches,
consider another number if you have problems.
Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config
Added VLAN with VID == 2 to IF -:eth0:-
[ OK ]
your vlan is running ;p

Leave a comment