According to Wikipedia, “In computer networking, a single layer-2 network may be partitioned to create multiple distinct broadcast domains, which are mutually isolated so that packets can only pass between them via one or more routers; such a domain is referred to as a Virtual Local Area Network, Virtual LAN or VLAN.”
VLAN’s simplify network management, limit the size of a broadcast domain and improve network efficiency. VLANs are of two types.
- Static VLAN
- Dynamic VLAN
In a static VLAN, we assign specific ports to a specific VLAN. whereas in dynamic VLAN we assign MAC addresses to a specific VLAN. In this chapter we are going to see how to create and configure a static VLAN. We are going to create three VLANs and assign ports to them. For this example, we will create three VLANs named Java, SAP and HR.
We need to be in global configuration mode to create VLANs. The command “vlan 2” assigns number 2 to the VLAN we are going to create. We can assign any number from 2 to 4094 to the vlan. The command “name java” names our vlan as java. Similarly we can create the vlans SAP and HR.
Assigning ports to VLAN
Before assigning ports to the VLAN let’s see the port states in our switch.
We can see above that all the ports of the switch are members of VLAN 1. VLAN 1 is a special purpose VLAN used for administration. It is the only precreated VLAN on the Cisco switch. All ports are members of this VLAN by default. So when you are assigning a port to a specific VLAN, you are just changing the port from VLAN1 to that VLAN.
Now let’s assign ports to the VLANs we just created. First, let’s assign three ports to the VLAN java.
interface fastethernet 0/1 command selects the fastethernet port 1. The
switchport access vlan2 command assigns this port to VLAN java. Similarly we can add the fastethernet ports 2 and 3 to the VLAN 2. Now let’s see the port states once again.
We can see that the first three fastethernet ports have been assigned to the VLAN java. Now we will assign fastethernet ports 4 and 5 to VLANs SAP and HR respectively.
This is how our network will look like if we connect the host devices.
And our port states will look like this.