VLAN: one switch, several separate networks
This lesson is open to everyone. The other lessons open with a package: sign in or sign up, then choose a package.
Key points
- A VLAN (Virtual LAN) splits one physical switch into several separate logical networks.
- Each VLAN is a separate broadcast domain: a broadcast in VLAN 10 does not reach VLAN 20.
- An access port belongs to only one VLAN. End devices (PCs, printers, cameras) connect here.
- A trunk port carries several VLANs over one cable and adds an 802.1Q tag to frames.
- Communication between VLANs needs a Layer 3 device: a router or an L3 switch.
The problem
If a hotel's guest Wi-Fi and the POS (cash desk) computer are on the same network, any guest can "see" the cash desk. Buying a separate switch for each group is expensive. A VLAN splits one switch into several separate networks.
Two port types
- Access port: belongs to one VLAN. The device does not know about the VLAN; frames go untagged.
- Trunk port: carries several VLANs over the same cable. It is used between switches or between a switch and a router. An 802.1Q tag (4 bytes) is added to each frame so the VLAN it belongs to is known.
Remember: the VLAN ID is 12 bits; the usable range is 1–4094. VLAN 1 is the default VLAN. The VLAN that travels untagged on a trunk is the native VLAN; by default it is also VLAN 1.
Configuration on Cisco
Switch# configure terminal Switch(config)# vlan 10 Switch(config-vlan)# name GUEST Switch(config-vlan)# vlan 20 Switch(config-vlan)# name POS Switch(config-vlan)# exit ! The POS computer is connected to port 5 Switch(config)# interface fa0/5 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan 20 ! Trunk to the router Switch(config-if)# interface gi0/1 Switch(config-if)# switchport mode trunk Switch(config-if)# end Switch# show vlan brief
show vlan brief shows which port is in which VLAN, and show interfaces trunk shows the trunk ports.
Communication between VLANs
Different VLANs cannot talk to each other without a router. This is a Layer 3 job: you need either a router (router-on-a-stick) or an L3 switch. We will build this in the "Inter-VLAN routing" lesson.
Check yourself
5 questions · answers are shown instantly · 3 correct answers complete the lesson
1Which standard adds the VLAN tag on a trunk port?
2How should the port where the POS computer is connected be configured?
3Can a guest device in VLAN 10 ping the POS in VLAN 20?
4What is the usable VLAN ID range?
5Which command briefly shows the VLANs and ports on a switch?
Comments
Sign in to comment.