Linux Vlan Howto

Basic Usage:

Is required installing vlan package (ubunto being showed):

||/ Name                  Version               Description
+++-=====================-=====================-==========================================================
ii  vlan                  1.9-3ubuntu3.1        user mode programs to enable VLANs on your ethernet device

Creating and removing virtual interfaces:
Given the physical interface

eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2398 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3993 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:170133 (170.1 KB)  TX bytes:589565 (589.5 KB)
          Interrupt:9 Base address:0xd240

Add device
ocm@achtung:~$ sudo vconfig add eth0 2
Added VLAN with VID == 2 to IF -:eth0:-

ocm@achtung:~$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 08:00:27:ed:ee:81
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2506 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4096 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:179096 (179.0 KB)  TX bytes:603475 (603.4 KB)
          Interrupt:9 Base address:0xd240

eth0.2    Link encap:Ethernet  HWaddr 08:00:27:ed:ee:81
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Remove
ocm@achtung:~$ sudo vconfig rem eth0.2
Removed VLAN -:eth0.2:-