Why can't we replace switches with routers?

VLAN - What is a Virtual Local Area Network?

With tagged VLANs, the assignment to VLANs works more dynamically: Instead of being fixed in the switch, a tag in the frame of the message packet ensures the assignment. For this reason, this technology is also called analogous to port-based networks frame-based. The tag contains information on which VLAN you are currently in. A switch can recognize in which segment the communication takes place and forwards the message accordingly.

A VLAN tag is 32 bits long and appears in the ethernet frame directly after the sender's MAC address. The tag begins with a two-byte protocol ID: The Tag Protocol Identifier (TPI) indicates whether a VLAN ID was specified at all. If a VLAN is marked via the frame, these blocks have the value 0x8100. The frame then indicates the priority of the message in three bits. This is followed by a bit for the Canonical Format Identifier (CFI). This position is only used to ensure compatibility between Ethernet and Token Ring.

The protocol only notes the actual VLAN ID (VID) in the last twelve bits. By the length of the frame area are 4,096 different VLANs available. Each VLAN has its own number. Tagged VLANs can also be implemented directly via the network cards. For example, Linux supports the standard out of the box. Windows users, on the other hand, depend on the manufacturer of the network card. The VLAN can then be set via the device driver.

The frame principle presented here follows the standard IEEE 802.1q. This is the most commonly used variant. In fact, there are other ways in which VLAN tags can be accommodated in the message packet. For example, Cisco uses the Inter-Switch Link Protocol (ISL) for its switches. In order to enable multiple VLANs, this protocol encapsulates the complete data frame.

The advantage of a tagged VLAN over one that works via port assignment is found in the connection between different switches. Port-based, at least two cables must be laid between the switches, as each virtual LAN needs its own connection. At Trunking in Tagged VLANs a cable is sufficient, since the distribution works via the information in the frame. The switch detects the correct VLAN and sends it on to the corresponding second switch. There the tag is removed and the package is forwarded to the correct recipient.