Linux VLAN Trunking: Difference between revisions

From ITCwiki
Jump to navigation Jump to search
No edit summary
 
(28 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Basic VLAN Trunking in Debian based Linux.=
=Basic VLAN Trunking for Linux.=
==Goals of Lab==
;Goals<nowiki>:</nowiki>
*Enable 802.1Q Tagging
*Create sub-interfaces with VLAN tagging enabled
*Create Virtual Interfaces


== Scenario ==
== Scenario ==
Line 15: Line 14:
==Step 2==
==Step 2==
Load the 802.1Q module into the kernel
Load the 802.1Q module into the kernel
:sudo modprobe 8021q
:modprobe 8021q
Then verify the module has been loaded into the kernel
Then verify the module has been loaded into the kernel
:lsmod | grep 8021q
:lsmod | grep 8021q
Line 23: Line 22:


==Step 3==
==Step 3==
Use vconfig to add virtual interfaces / VLANS
Use vconfig to add VLANS
:vconfig add eth0 10
:vconfig add "''interface''" "''VLAN''"
:vconfig add eth0 20
:vconfig add eth0 30
:vconfig add eth0 40


:[[File:Vconfig.jpg|middle]]
:[[File:Vconfig.jpg|middle]]
:VLAN's 10, 20, 30, and 40 are now created (as sub-interfaces), labeled as eth0.10, eth0.20, eth0.30, eth0.40


==Step 4==
==Step 4==
Configure IP Addresses on the virtual interfaces.
Configure IP Addresses on the VLANS / sub-interfaces.
:ifconfig etho.10 10.0.1.2 netmask 255.255.255.0
:ifconfig "''interface''.''VLAN''" "''ip address''" netmask "''subnet mask''"
:ifconfig etho.20 10.0.2.2 netmask 255.255.255.0
:ifconfig etho.30 10.0.3.2 netmask 255.255.255.0
:ifconfig etho.40 10.0.4.2 netmask 255.255.255.0


:[[File:Configvlanip.jpg|middle]]
:[[File:Configvlanip.jpg|middle]]
:<nowiki>*</nowiki>Verify the VLANS / sub-interfaces were added and up by running the ''ifconfig'' command<nowiki>*</nowiki>


==Step 5==
==Step 5==
Configure the default gateway for each virtual interface / VLAN
Configure the default gateway (add a route) for each VLAN / sub-interface


:route add -net 10.0.1.0 netmask 255.255.255.0 gw 10.0.1.1
:route add -net "''network address''" netmask "''subnet mask''" gw "''default gateway''"
:route add -net 10.0.2.0 netmask 255.255.255.0 gw 10.0.2.1
:route add -net 10.0.3.0 netmask 255.255.255.0 gw 10.0.3.1
:route add -net 10.0.4.0 netmask 255.255.255.0 gw 10.0.4.1


:[[File:Defaultroute.jpg|middle]]
:[[File:Defaultroute.jpg|middle]]
;The server should now be trunking VLANS 10,20,30, and 40 over eth0

Latest revision as of 15:59, 11 May 2010

Basic VLAN Trunking for Linux.

Goals:
  • Create sub-interfaces with VLAN tagging enabled

Scenario

Linuxproject.jpg

Step 1

The first thing you'll want to do is install the VLAN package using aptitude.

aptitude install vlan
Installvlan.jpg

Note: if aptitude can't find the package, use the command "aptitude update" before trying to install the package.

Step 2

Load the 802.1Q module into the kernel

modprobe 8021q

Then verify the module has been loaded into the kernel

lsmod | grep 8021q

The output on your screen should look similar:

Modprobe.jpg

Step 3

Use vconfig to add VLANS

vconfig add "interface" "VLAN"
Vconfig.jpg
VLAN's 10, 20, 30, and 40 are now created (as sub-interfaces), labeled as eth0.10, eth0.20, eth0.30, eth0.40

Step 4

Configure IP Addresses on the VLANS / sub-interfaces.

ifconfig "interface.VLAN" "ip address" netmask "subnet mask"
Configvlanip.jpg


*Verify the VLANS / sub-interfaces were added and up by running the ifconfig command*

Step 5

Configure the default gateway (add a route) for each VLAN / sub-interface

route add -net "network address" netmask "subnet mask" gw "default gateway"
Defaultroute.jpg
The server should now be trunking VLANS 10,20,30, and 40 over eth0