Introduction to VLANs by HTRegz
Hey Hey,
I searched through the Tutorials Index and couldn't find anything on VLANs so I figured I'd throw this up. I've got a test on Configuring Cisco and Nortel switches for VLANs in a few hours, so I figure brushing up on the theory couldn't hurt. I find I learn best when I'm explaining for others, so here ya go. This is a introduction to VLANs, so for those of you with knowledge it will seem rather simple. If a more in-depth tutorial is wanted. I will go about doing some serious research and writing one.
What is a VLAN?
**As a side note, if you have never used webopedia before, I suggest you go take a look at it**Quote:
Source: Webopedia
Short for virtual LAN, a network of computers that behave as if they are connected to the same wire even though they may actually be physically located on different segments of a LAN. VLANs are configured through software rather than hardware, which makes them extremely flexible. One of the biggest advantages of VLANs is that when a computer is physically moved to another location, it can stay on the same VLAN without any hardware reconfiguration.
VLANs let you group people logically, rather than physically as the definition says.
Example:
You have Accounting and Marketing Departments. These departments both have 7 employees and 1 manager. Being a large corporation, your managers aren't on the same floor as the rest of the employees, they're a few floors up with bigger offices. Yet you want all people related to Accounting on one network and all those related to marketing on another, including the managers. This would be a pain if you were designing your network using physical layouts. You'd have to run some massively long wires and it would be counter productive if someone ever moved. Your switches would look something like this.
This would be rather messy. Say someone movies to a different cubicle or office, you would have to run wires back to the original switch.Code:Accounting Switch Marketing Switch
X X X X X X X X X X X X X X X X
| | | | | | | | | | | | | | | |
S S S S S S S 2 S S S S S S S 2
A A A A A A A A A A A A A A
M M M M M M M F M M M M M M M F
E E E E E E E L E E E E E E E L
O O
F F F F F F F O F F F F F F F O
L L L L L L L R L L L L L L L R
O O O O O O O S O O O O O O O S
O O O O O O O O O O O O O O
R R R R R R R U R R R R R R R U
P P
Solution: VLANs.
You setup 2 VLANs in your company. VLAN1 - Accounting and VLAN2 - Marketing. You configure your switches. Instead of the 2 8 port switches, you'd have a 16 port and for the other anything over 3 ports would do the trick, but we'll say an 8 port. On the floor with all the bean counters you'd have the 16 port switch. (instead of typing Same floor I will abreviate to SF to save space)
Now we've introduced something new. A Port labelled Trunk. Those of you who have done the CCNA will know this as the Trunk port, and those of you who have dealt with Nortel will know this as a Tagged port. Same thing... different name. A Trunk/Tagged port allows for communication between VLANs which span multiple switches (The Trunk/Tagged port must be a member of both VLANs when configured). Assuming our trunk ports are connected in the above example now an Employee on VLAN1 could ping the Manager on VLAN1's workstation. When the first trunk port recieves the data, it adds a tag to it. The recieving trunk port will remove this tag. The tag tells the recieving trunk port the VLAN ID of the transmitting workstation, so that it knows how to deal with the data. The tag is defined by IEEE 802.1q. A Tag Looks like this.Code:Employee Switch
VLAN1 | VLAN2
X X X X X X X X X X X X X X X X
| | | | | | | | | | | | | | |
S S S S S S S S S S S S S S T
F F F F F F F F F F F F F F R
U
N
K
Manager Switch
VLAN1 | VLAN2
X X X X X X X X
| | |
S S T
F F R
U
N
K
So Data Leaves the WS attached to port 1 on VLAN1. It travels to the trunk port and is tagged. It is recieved by the attached trunk port which looks at the VLAN ID in the TAG and switches it over to VLAN1 and removes the tag.Code:_________________________________________________________
| 6 Bytes | 6 Bytes | 4 Bytes | 2 Bytes | 46 - 1500 bytes |
| DST | SRC | TAG | PROTOCOL| DATA |
|___MAC___|___MAC___| |___TYPE__|_________________|
___________/ \___________
| 10 Bits | 3 Bits | 1 Bit | 12 Bits|
|_81-00___|PRIORITY|__CFI__|VLAN ID_|
This has all been an example of Port-based VLANs. You should know however that you can also do Host (MAC) based VLANs (this is handy) because if you move a computer, when you plug it in, it will be back on the same VLAN. There are also Protocol based VLANs which allow you to segregate networks based on protocol (IP, IPX, etc).
One last thing I will leave you with is that 2 VLANs cannot directly communicate, even if they are on the same switch. They are seperate networks and, therefore, require a router to communicate.
By Enabling dot1q encapsulation on the router and setting up the ethernet interface to be a trunk and using sub-interfaces to define each VLAN, we can configure the router to route packets from VLAN1 to VLAN2 and vise-versa. This is basically just a matter of configuration. If there is enough interest. I will write an addendum on the configuration of both nortel and cisco routers and switches to carry out these tasks. I will also do a more advanced VLAN tutorial if so desired. This is designed to be a simple introduction. Feedback is always appreciated.Code:
Switch
VLAN1 | VLAN2
X X X X X X X X
T
R
U
N
K
|
|
|
X
Router
Peace,
HT
Edit: Some of the formatting is messed up. I apologize for this and will attempt to fix it when I get a chance. However I'm already running late for class.
