5 VLAN Configuration Explained
1. VLAN Creation
VLAN creation involves defining a new VLAN on the switch. This is typically done by assigning a unique VLAN ID and a name to the VLAN. The VLAN ID is a number between 1 and 4094, with 1 being the default VLAN.
Example: To create a VLAN for the HR department with ID 10, you would use the command /interface vlan add name=HR_VLAN vlan-id=10
. This command creates a new VLAN named "HR_VLAN" with the ID 10.
2. VLAN Assignment to Ports
VLAN assignment to ports involves configuring switch ports to belong to specific VLANs. This can be done in two modes: access mode and trunk mode. Access mode assigns a single VLAN to a port, while trunk mode allows multiple VLANs to pass through the port.
Example: To assign Port 1 to the HR VLAN in access mode, you would use the command /interface ethernet set [interface=ether1] vlan-mode=access vlan-id=10
. This command configures Port 1 to only carry traffic for VLAN 10.
3. Trunk Configuration
Trunk configuration allows a single physical link to carry traffic for multiple VLANs. This is essential for connecting switches and ensuring that traffic for different VLANs can be transmitted over a single link.
Example: To configure Port 2 as a trunk port that carries VLANs 10, 20, and 30, you would use the command /interface ethernet set [interface=ether2] vlan-mode=trunk allowed-vlan=10,20,30
. This command enables Port 2 to carry traffic for VLANs 10, 20, and 30.
4. VLAN Tagging
VLAN tagging involves adding a VLAN tag to Ethernet frames. This tag contains the VLAN ID, allowing network devices to identify and route traffic to the correct VLAN. VLAN tagging is essential for managing traffic in networks with multiple VLANs.
Example: When a device sends data to another device in a different VLAN, the switch adds a VLAN tag to the Ethernet frame. The receiving switch reads the VLAN tag and routes the frame to the appropriate VLAN, ensuring that traffic is isolated and managed correctly.
5. Inter-VLAN Routing
Inter-VLAN routing enables communication between devices in different VLANs. This is typically achieved by configuring a router or a Layer 3 switch to route traffic between VLANs. Inter-VLAN routing is crucial for creating a unified network where devices in different segments can communicate.
Example: Suppose you have a router with multiple interfaces, each connected to a different VLAN. You can configure each interface with the appropriate VLAN IP address. When a device in the HR VLAN (192.168.10.10) needs to communicate with a device in the IT VLAN (192.168.20.20), the router will route the traffic between these VLANs, ensuring that the communication is successful.