π§ VLAN Configuration in Cisco Switch (Step-by-Step + Real Example +
Troubleshooting)
π Introduction (Real Problem Scenario)
In many real-world networks, you may face issues like:
- All users accessing each otherβs systems
- Slow network due to broadcast traffic
- No proper separation between departments
π These problems usually occur when VLAN is not configured correctly.
Managing a flat network is a nightmare:
- β Everyone is in the same broadcast domain
- β Network becomes slow as users increase
- β No isolation β security risk
- β Troubleshooting becomes painful
π This is exactly why VLAN configuration in Cisco switchesΒ becomes critical.
π In enterprise environments, a small VLAN misconfiguration can break connectivity across the entire network.
With VLANs, you can:
- β Separate departments logically
- β Reduce broadcast traffic
- β Improve performance
- β Increase network security
In this guide, you will learn:
- VLAN configuration step-by-step
- Real Cisco commands
- Trunk configuration
- Troubleshooting techniques
π What is VLAN? (Simple + Practical)
VLAN (Virtual Local Area Network) allows you to split one physical switch into multiple logical networks.
π‘ Example:
- VLAN 10 β HR
- VLAN 20 β IT
- VLAN 30 β Finance
π Even if devices are on the same switch, VLAN keeps them isolated.
πΉ What is VLAN Configuration?
VLAN configuration is the process of:
- Creating VLANs
- Assigning switch ports
- Controlling traffic between networks
π It helps in network segmentation, security, and performance improvement
β‘ VLAN Configuration (Quick Steps)
- Enter configuration mode
- Create VLAN
- Assign VLAN to port
- Configure trunk (if needed)
- Verify configuration
So here below is the step by stepΒ vlan configuration commands in detail.
π π‘ Key Insight:
Always verify VLAN configuration before moving to troubleshooting.
π§± Step-by-Step: VLAN Configuration in Cisco Switch
Here below is a scenario on the basis of which we will do vlan configurations.
π’ Scenario:
| Department | VLAN | Ports |
|---|---|---|
| HR | 10 | Fa0/1β10 |
| IT | 20 | Fa0/11β20 |
| Finance | 30 | Fa0/21β24 |
πΉ Step 1: Create VLANs in a Switch
Login to switch and enter into configuration mode by using the bellow command.
Switch> enable
Switch# configure terminal
πΉ Step 2: Create VLANs in a Switch
Now enter the below vlan configuration commands to create HR,IT and FINANCE Vlans.
Switch(config)# vlan 10
Switch(config-vlan)# name HR
Switch(config-vlan)# exit
Switch(config)# vlan 20
Switch(config-vlan)# name IT
Switch(config-vlan)# exit
Switch(config)# vlan 30
Switch(config-vlan)# name FINANCE
Switch(config-vlan)# exit
π‘ Pro Tip:
Always name VLANs β helps during troubleshooting.
πΉ Step 3: Assign VLAN to Ports
After creating the required Vlans, we now need to assign the ports to the respective vlans.
Switch(config)# interface fastEthernet 0/1 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan 10 Switch(config)# interface fastEthernet 0/11 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan 20Switch(config)# interface range fastEthernet 0/21-24 Switch(config-if-range)# switchport mode access Switch(config-if-range)# switchport access vlan 30
π Now:
- Fa0/1 β VLAN 10 (HR)
- Fa0/11 β VLAN 20 (IT)
- Fa0/21-24 β VLAN 30 (FINANCE)
π― Result:
- Departments are isolated
- Broadcast traffic reduced
- Network becomes scalable
πΉ Step 4: VLAN Trunk Configurations
We now need to configure a port as a trunk port so that it can carry multiple vlan traffics.
Switch(config)# interface gigabitEthernet 0/1
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20,30
π‘ Pro Tip:
Always restrict allowed VLANs for security.
πΉ Step 5: Verify VLAN Configurations
After creating vlans and assigning ports to the vlans, we can now check the current vlan configurations. with the help of below commands.
Switch# show vlan brief
Switch# show running-config
Switch# show mac address-table
π‘ These commands help you validate everything quickly.
π§ VLAN Flow (How Traffic Moves)
Here from the below image, we can easily learn the concept as how Vlan traffic flows inside the switch.

π Understanding this makes troubleshooting 10x easier:
- Same VLAN β Direct communication
- Different VLAN β Needs routing
β οΈ Common VLAN Issues + Fixes (Real Troubleshooting)
β Issue 1: VLAN Not Working
β Check:
show vlan brief
β Fix:
- VLAN not created β create it
- Port not assigned β assign correctly
β Issue 2: No Communication Between PCs
π Reason:
- Devices in different VLANs
β Fix:
- Configure Inter-VLAN Routing (Router or Layer 3 switch)
β Issue 3: Trunk Not Passing VLAN
β Check:
show interfaces trunk
β Fix:
switchport trunk allowed vlan 10,20,30
β Issue 4: Wrong Port Mode
β Fix:
switchport mode access
β Issue 5: MAC Not Learning
β Check:
show mac address-table
β Fix:
- Check cable / NIC
- Ensure port is active
β οΈ Common Mistakes (Avoid These)
- β Forgetting
switchport mode access - β Assigning VLAN without creating it
- β Not verifying configuration
- β Allowing all VLANs on trunk (security risk)
- β Ignoring inter-VLAN routing
- β VLAN created but not assigned β Device stays in default VLAN
- β Trunk not configured β VLANs wonβt communicate across switches
- β Native VLAN mismatch β Causes connectivity issues
- β Using trunk mode for end devices
- β Always use access mode for PCs
π Difference between Access vs Trunk Port (Quick Comparison)
Here below is the difference between Access Port vs Trunk Port in detail.
| Feature | Access Port π’ | Trunk Port π΅ |
|---|---|---|
| Purpose | Connect end devices | Connect switches / routers |
| VLAN Support | Single VLAN | Multiple VLANs |
| Used For | PC, Laptop, Printer | Switch-to-switch |
| VLAN Tagging | β No | β 802.1Q tagging |
| Configuration | Simple | Moderate |
| Traffic Handling | One VLAN traffic | Multiple VLAN traffic |
| Security | More secure | Needs proper config |
| Cisco Command | switchport mode access | switchport mode trunk |
| Example | Fa0/1 β VLAN 10 | Gi0/1 β VLAN 10,20,30 |
π‘ Pro Tip
π Use Access Ports for:
- End devices (PCs, printers)
π Use Trunk Ports for:
- Switch-to-switch communication
- Carrying multiple VLANs
πΌ Real-World Example
Use Cases
- π’ Offices β Department separation
- π« Schools β Staff vs Students
- π¨ Hotels β Guest isolation
- π Data Centers β Server segmentation
In an office network:
- VLAN 10 β HR (Ports Fa0/1βFa0/5)
- VLAN 20 β IT (Ports Fa0/6βFa0/10)
π Result:
- π Departments are isolated
- β‘ Network performance improves
- π§ Traffic is well organized
π Access Port vs Trunk Port (Quick Comparison)
| Feature | Access Port | Trunk Port |
|---|---|---|
| VLAN Support | Single VLAN | Multiple VLANs |
| Used for | End devices | Switch-to-switch |
| Tagging | Untagged | Tagged (802.1Q) |
π οΈ VLAN Troubleshooting (Step-by-Step)
1. π Check VLAN assignment
show vlan brief
2. π Check trunk configuration
show interfaces trunk
3. π Check interface status
show ip interface brief
π π‘ Pro Tip:
Always check VLAN and trunk before troubleshooting deeper network problems.
π― Interview Questions
- How to configure VLAN in Cisco switch?
- Difference between access and trunk port?
- What is native VLAN?
π Related Topics (Recommended Reading)
- β‘οΈ What is VLAN (Complete Guide)
- β‘οΈ How VLAN Works
- β‘οΈ VLAN Tagging (802.1Q Explained)
- β‘οΈ VLAN Troubleshooting Guide
π These will help you build complete networking expertise
β FAQs
Q1. How to create VLAN in switch?
Here is the command :
Under the config mode , type the below command.
vlan 10
name HR
Your Vlan 10 with name HR will get created.
Q2. How to assign VLAN to port?
interface fa0/1
switchport access vlan 10
Q3. Why VLAN is not working?
Some possible reasons are :
- VLAN not created
- Port not assigned
- Trunk misconfigured
- Check Vlan configuration
Q4. What is trunk port?
A port that carries multiple VLANs between switches.
Q5. Can different VLANs communicate?
β No (default)
β Yes (with Inter-VLAN Routing)
π― Conclusion (Action-Oriented)
VLAN configuration in Cisco switches is a must-have skill for any network admin.
π If you apply what you learned:
- Your network becomes faster
- Your setup becomes secure
- Your troubleshooting becomes easy
π Mastering VLAN configuration makes troubleshooting and network design much easier.
