jueves, 26 de julio de 2012

TIPS: Linux Vlan Configuration


Now we are going to show how to configure vlans using linux. You may ask why this is necessary? and here is the answer, this is necessary when you connect your linux server directly to a router/L3 Switch and the port in router/switch end is configured as a Trunk port.

The frame that pass through a Trunk port must be tagged with a VLAN ID, This VLAN ID, tells the router what vlan to use to route the traffic to the destination. If the frame that is send through a Trunk port is not tagged then the router is going to discard the frame.
Find Below how to configure vlans with linux

  • 1. Verify if the module is active using the command modprobe. If you do not receive any message then the module is installed and we can continue with step 2


  1. 2. Create the vlan using the command vconfig. The command shown below create vlan 109 in the eth1 interface

vlan creation using vconfig

  1. 3.  Assign an ip address to the vlan.  

ip address using ifconfig

  1. 4. Verify that the VLAN is UP using the command ifconfig 

verify vlan working

This procedure create the vlan in the RAM memory, when you restart the machine all the configuration will be lost. To make the change persistent follow the next procedure

  • Copy the file /etc/sysconfig/network-scripts/ifcfg-eth1 to /etc/sysconfig/network-scripts/ifcfg-eth1.109 

copy file linux
  •  Edit the newly copied file using your preferred linux editor, for this example I’m using vim

vim
  • Change the DEVICE line from eth1 to eth1.109

  •  Add the line VLAN=yes. Your file should look like the image below

  •  Restart the networking daemon using the command “service network restart


No hay comentarios:

Publicar un comentario