Here is a quick guide how to enable VLANs on Ubuntu or Debian box.
VLANs on Linux will work with the most of the modern ethernet adapters. Frankly speaking Ihave not came across of adapter it would not work with.
I presume that you use standard kernel shipped with Ubuntu. However, if you use a custom built kernel make sure VLAN support is enabled in it.In this example I want my computer to connect to vlan4,vlan5 and vlan101. My default gateway is in vlan101. And I have only one ethernet interface eth0.
Note: If you want to connect to only one VLANor you have many network interfaces it is possible to do as well.
OK, now how to do this:
1. Install VLAN package on your computer:
sudo apt-get install vlan
2. Edit your /etc/network/interfacesfile so it would contain the following:
# The loopback network interface
iface lo inet loopback
# This is a list of hotpluggable network interfaces.
# They will be activatedautomatically by the hotplug subsystem.
# VLAN 4
iface vlan4 inet static
# VLAN 5
iface vlan5 inet static
# VLAN 101
ifacevlan101 inet static
Note: You have to replace my IPaddresses, network masks and gateway IP address with your own.
3. Make sure that switch interface you are connected to configured with respective VLANs.
4. Restart your network interface:
You should see something like:
Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config
Added VLAN with VID == 4 to IF -:eth0:-
Set name-type for...