Category Archives: Raspberry Pi

Raspberry Pi

Just before Christmas 2014 I got a Raspberry Pi B+ from Amazon just to see what is the all the buzz about. When I opened it I was impressed of the quality of the product even on visual evaluation. It is really pleasant to handle and work with.

Furthermore, I was impressed by the quality of the software available for Raspberry Pi. Raspbian is a full blown Linux distribution based on Debian distribution. It already has Continue reading

VLAN configuration on Ubuntu (Debian)

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 I have not come across of an adapter it would not work with.

I presume that you use a 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 at vlan101. And I have only one ethernet interface eth0.

Note: If you want to connect to only one VLAN or 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/interfaces file so it would contain the following:

# The loopback network interface
auto lo
iface lo inet loopback

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
auto vlan4
auto vlan5
auto vlan101

# VLAN 4
iface vlan4 inet static
address 192.168.0.8
netmask 255.255.255.192
network 192.168.0.0
broadcast 192.168.0.63
mtu 1500
vlan_raw_device eth0

# VLAN 5
iface vlan5 inet static
address 10.0.111.8
netmask 255.255.255.0
network 10.0.111.0
broadcast 10.0.111.255
mtu 1500
vlan_raw_device eth0

# VLAN 101
iface vlan101 inet static
address 172.12.101.8
netmask 255.255.255.0
network 172.12.101.0
broadcast 172.12.101.255
gateway 172.12.101.1
mtu 1500
vlan_raw_device eth0

Note: You have to replace my IP addresses, network masks and the gateway IP address with your own.

3. Make sure that the switch interface you are connected to is configured with respective VLANs.

4. Restart your network interface:
sudo /etc/init.d/networking restart

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 VLAN subsystem. Should be visible in /proc/net/vlan/config
Added VLAN with VID == 5 to IF -:eth0:-
Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config
Added VLAN with VID == 101 to IF -:eth0:-

And this is it. Nice and easy. Happy VLANing!