Thursday, February 2, 2017

How to set up VLAN on Ubuntu

VLAN is the basic concept of network separation.  with VLAN, broadcast is limited in a small area, only in the same VLAN area.

On the LSW the VLAN number always appends to a physical interface with a dot,for example ethernet1/1.100. Here we follow the same rule, such as  eth0.100.

1. first , install the "vlan" package:

    sudo apt-get install vlan
2.  Load the 8021q kernel module:

    sudo modprobe 8021q

3.  Ensure that this module gets loaded after a reboot by adding to /etc/modules:

   
  sudo  sh -c 'grep -q 8021q /etc/modules || echo 8021q >> /etc/modules'

4.  Configure the interface by editing /etc/network/interfaces:

# The loopback network interface
auto lo
auto eth0.100
iface lo inet loopback
# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
iface eth0.100 inet static
address 192.168.99.1
netmask 255.255.255.0
gateway 192.168.0.1
mtu 1500
vlan_raw_device eth0
5. Bring the interface Up
sudo ifup eth0.100


Here is another way via GUI, from internet, not trying yet.

Desktop GUI method
Install the vlan package using Synaptic: System->Administration->Synaptic Package Manager
and search for and install the package 8021q.


Load the 8021q kernel module:


 
 
sudo modprobe 8021q
sudo  sh -c 'grep -q 8021q /etc/modules || echo 8021q >> /etc/modules'
Now we have to create a low-level interface that the network manager can see:

vconfig add eth0 100
Now we can find eth0.100 in the GUI System->Administration0>Network and configure it how we want.
 
 

No comments:

Post a Comment