Sunday, June 27, 2010

Setting up VLAN on Ubuntu 9.10

VLAN has an important role at enterprise networks. If your company is medium to high size it could benefit from vlan feature.

In this post I'll talk about how to set up VLAN on Ubuntu and Debian. If you don't know what is VLAN or would like more basic information how VLAN works on linux, read this post
http://goitenterprise.blogspot.com/2010/06/vlan-on-linux.html

Don't forget to have vlan working well, you kernel must support it and your system should have vlan tools installed.

In your system, open the interfaces file
sudo nano /etc/network/interfaces

As you can see there are some interfaces defined like lo or eth0

Edit the file typing the following text doing the necessary changes for your environment.
Put the following text at the end of the file

sudo nano /etc/network/interfaces

# ---------------------beginning of the file -------------------------------#
auto vlan10
auto vlan100


# VLAN 10
iface vlan10 inet static
address 192.168.10.1
netmask 255.255.255.0
network 192.168.10.0
broadcast 192.168.10.255
mtu 1500
vlan_raw_device eth0



# VLAN 100
iface vlan100 inet static
address 192.168.100.1
netmask 255.255.255.0
network 192.168.100.0
broadcast 192.168.100.255
mtu 1500
vlan_raw_device eth0

#------------------------- enf of the file -----------------------------------#

Save the file and restart the network interfaces

sudo /etc/init.d/networking restart

check if the NIC is communicating. Try to ping some host at the same VLAN.tag

I've seen many distributions where after the networking restart, they show some error saying the module for 802.1Q support must be loaded first. The case is I've never had to load that module in new distros, it's just a warning. You could check if the module is loaded typing

# lsmod |grep 8021q

If you see something like:

8021q                20832 0
then, the module is attached to kernel. Good news !

Well, any questions about it, any problem, send me a comment. I appreciate.

1 comment:

  1. a colleague at job asked me if this method can sign VLAN IDs to the card interfaces. At that time I didn't have any answer. Today I've made some tests with it and, for sure, it sign a vlan ID ! Ubuntu is awesome !

    Thanks for your comments Fabiano.

    ReplyDelete