This is done when you - the administrator - set some switch ports in the VLAN except VLAN 1 - the default VLAN. All ports in a single VLAN are in a single broadcast domain.
Since switches can communicate with each other, some ports on switch A may be in VLAN 10 and some ports on switch B may also be in VLAN 10. The broadcast messages between these computers will not be exposed. on ports belonging to any VLAN except VLAN 10. However, all of these computers can communicate with each other because they belong to the same VLAN. Without additional configuration, they will not be able to communicate with other computers outside this VLAN.
Is VLAN necessary?
Currently, VLAN plays a very important role in LAN technology. To see clearly the benefits of VLANs, let us consider the following case:
Suppose a company has 3 divisions: Engineering, Marketing, Accounting, each of which is spread out over 3 floors. To connect computers in one part together, we can install each switch on each floor. That means that each floor must use 3 switches for 3 parts, so to connect 3 floors in the company need to use 9 switches. Obviously, this method is very expensive and cannot take full advantage of the inherent port numbers of a switch. Therefore, VLAN solution was born to solve the problem in a simple way but still save resources.
As shown in the figure above, each layer of the company needs only one switch, and this switch is divided into VLANs. The computers in the engineering department will be assigned to VLAN Engineering, the PCs in other parts will also be assigned to the corresponding VLANs, Marketing and Accounting. This way of making it possible to save the maximum number of switches must be used and make the most of the available ports.
Benefits of VLANs
One important thing I need to emphasize is that you don't need to configure a virtual LAN unless your computer network is too big and has too much traffic. Many times people use VLAN simply because the computer network they are working on already uses them.
Another important issue is that on Cisco switches, VLANs are enabled by default and all computers are in a VLAN. That VLAN is VLAN 1. So by default, you can use all ports on the switch and all computers are able to communicate with each other.
When do you need a VLAN?
You need to consider using VLAN in the following cases:
Why not subnet?
One common question is why not subnet (instead of using VLAN)? Each VLAN should be in its own subnet. VLANs have advantages over subnets in that computers in different physical locations (not returning to the same router) can be in the same network. The drawback of dividing subnets with a router is that all computers on that subnet must be connected to the same switch and that switch must be connected to a port on the router.
With VLANs, a computer can be connected to this switch while another computer can connect to the other switch, all computers are still on the same VLAN (broadcast domain).
How can computers on different VLANs communicate with each other?
Computers on different VLANs can communicate with a router or a Layer 3 switch. Since each VLAN is its own subnet, a Layer 3 switch or router must be used to route between subnets.
What is trunk port?
When a link between two switches or between a router and a switch carries the traffic of multiple VLANs, that port is called trunk port.
Trunk port must run special communication protocol. The protocol used may be Cisco's proprietary ISL protocol or IEEE 802.1q standard.
How to configure a VLAN network can vary depending on different Cisco switch models. Your goal is:
Suppose we want to create VLAN 5 and 10. We want to put port 2 and 3 into VLAN 5 (Marketing) and port 4 and 5 into VLAN 10 (HR). Here's how to do it on the Cisco 2950 switch:
At this point, only ports 2 and 3 can communicate with each other as only ports 4 and 5 can communicate with each other. The reason is because they are on the same VLAN. In order for the computer on port 2 to communicate with the computer on port 4, you need to configure the trunk port to the router so that it can disassemble the VLAN information, route the packet and replenish the VLAN information.
What does VLAN provide?
VLANs increase the performance of medium and large LANs because they restrict broadcast messages. As the number of computers and the traffic flow increases, the number of broadcast packets also increases. By using VLANs, you will limit the advertisement.
VLANs also enhance security because you essentially put a group of computers in a VLAN on their own network.
summary
Below is a summary of the main ideas in the lesson: