VLAN is the abbreviation for Virtual LAN, i.e. Virtual Local Area Network. This is a custom network we create from one or more existing LANs. It enables a group of devices from multiple networks (both wired and wireless) to be combined into a single Logical network. The result is a VLAN that can be administered like a physical area network. The network equipment like routers or switches must support the VLAN configurations to create a VLAN.
To know about LAN’s please refer to the article LAN Technologies.
Advantages of VLANs:
- Security: VLANs come up with extra security because users of the same group can send broadcast messages with an assurance that users from another group will not receive that broadcast message.
- Time and Cost Reduction: It can reduce the migration cost of stations because it is a lot easier and quicker to migrate using the software.
To know more about VLAN, you can refer to the article Virtual LAN(VLAN).
Let us create a network in Cisco Packet Tracer and configure VLAN in it. Here we create 2 LANs with 6 hosts each of them and in each LAN we create 2 VLANs and try to communicate between them.
Step 1: At first, we create a LAN, LAN-A with 6 hosts. To create a LAN we need one Layer 2 switch Switch0 and 6 end devices. Now we provide IP addresses to the hosts starting from 192.168.10.1 (you can provide any valid IP addresses). To provide an IP address to a host just select that host → Desktop → IP Configuration → IPv4 Addresses and provide an IP address and then ENTER, the Subnet Mask will be provided by default.
Step 2: Let us create 2 VLANs where the name of the first VLAN is VLAN-STUDENT and the second VLAN is VLAN-FACULTY. To configure VLANs we have to go to the switch Switch0 and move to Config → SWITCHING → VLAN Database. Now let us take the VLAN Number for STUDENT is 150 and for FACULTY is 250 and add these numbers to VLAN Database.
Step 3: Next we have to select the hosts under VLAN-STUDENT. Here I have put hosts with IP addresses from 192.168.10.1 to 192.168.10.3 under VLAN-STUDENT. To do so we have to select the switch Switch0 → Config → INTERFACE, here we choose FastEthernet0/1 corresponding to the host 192.168.10.1 which we consider to be in VLAN-STUDENT. Now we select the down arrow beside VLAN and select 150:STUDENT, which is for student VLAN.
Similarly, we do this same process for FastEthernet0/2 and FastEthernet0/3.
Step 4: Now we have to configure the hosts under VLAN-FACULTY. Here I have put hosts with IP addresses 192.168.10.4 to 192.168.10.6 under VLAN-FACULTY. To do so, just follow the process mentioned in Step 3, but instead of selecting the VLAN Number 150:STUDENT, select 250:FACULTY for FastEthernet0/4, FastEthernet0/5, and FastEthernet0/6.
Step 5: Lastly, just change the switch port mode from Access to Trunk for FastEthernet0/7.
You can create LAN-B similarly by following these steps and connect LAN-A and LAN-B by using a Cross-Over cable. And your end network will look like this:
Now our VLAN configuration is ready, and we can check this by sending data packets from one host to another under LAN-A. Let us ping from 192.168.10.1 to 192.168.10.3. To do so, we have to select the host with IP 192.168.10.1 and then select Desktop → Command Prompt. Now run the following command to ping 192.168.10.3.
You can get the Request timed out at first but don’t worry, if you followed all the steps mentioned properly then run the command again to ping, and it’ll do the job.
A visual representation of what you have done so far:
You can also ping the hosts under VLAN-FACULTY by following the previous steps, but you cannot ping from a host under VLAN-STUDENT to a host under VLAN-FACULTY or vice versa. It’ll generate a request time out because your created Virtual LAN STUDENT doesn’t contain any host with IP addresses from 192.168.10.3 to 192.168.10.6. Similarly, VLAN-FACULTY also doesn’t contain IP addresses from 192.168.10.1 to 192.168.10.3.
Now, let us try to ping from LAN-A VLAN-FACULTY to LAN-B VLAN-FACULTY.
Let us ping 192.168.10.5 of LAN-A VLAN-FACULTY to 192.168.10.12 of LAN-B VLAN-FACULTY. To ping again, run the command in the command prompt of the host with IP 192.168.10.5
As you can see that we’re getting replies from the VLAN-FACULTY host of LAN-B.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!