Build Your First VLAN Lab in Cisco Packet Tracer: Step-by-Step Guide

Build Your First VLAN Lab in Cisco Packet Tracer: Step-by-Step Guide
Networking ATN Campus November 02, 2026 12 views

Build Your First VLAN Lab in Cisco Packet Tracer: Step-by-Step Guide

VLANs (Virtual Local Area Networks) are an important part of modern network design. They allow network administrators to divide a physical network into multiple logical networks, improving organization, security, and traffic management.

In this practical tutorial, you will learn how to create VLANs, assign switch ports, connect PCs, and verify VLAN configurations using Cisco Packet Tracer.


1. What Is a VLAN?

A VLAN is a logical network created within a physical switched network. Devices assigned to the same VLAN can communicate at Layer 2, even if they are connected to different physical switch ports.

By default, switch ports belong to VLAN 1. Network administrators can create additional VLANs to separate users and departments.

Example: Company Departments

Imagine a company with three departments:

  • HR Department: VLAN 10
  • IT Department: VLAN 20
  • Finance Department: VLAN 30

Each department can have its own logical network, even when all devices connect to the same physical switch.

2. What Is Cisco Packet Tracer?

is a network simulation tool that allows students and networking professionals to design, configure, and test network topologies without requiring physical routers and switches.

You can use Packet Tracer to practice:

  • Switch and router configuration.
  • VLAN creation and management.
  • Trunk links and Inter-VLAN routing.
  • IP addressing and subnetting.
  • Network troubleshooting.

3. Lab Requirements

For this beginner VLAN lab, you need the following devices:

DeviceQuantityPurpose
Cisco 2960 Switch1Connects all computers
PC6Represents company employees
Copper Straight-Through Cable6Connects PCs to the switch

Network Topology

              Cisco 2960 Switch
                 [SW1]
                   |
       +-----------+-----------+
       |           |           |
     VLAN 10     VLAN 20     VLAN 30
       |           |           |
     PC1 PC2     PC3 PC4     PC5 PC6

      HR           IT         Finance
    

Connect each PC to the switch using copper straight-through cables.

PCSwitch PortVLANIP Address
PC1Fa0/110192.168.10.10
PC2Fa0/210192.168.10.11
PC3Fa0/320192.168.20.10
PC4Fa0/420192.168.20.11
PC5Fa0/530192.168.30.10
PC6Fa0/630192.168.30.11

Use subnet mask 255.255.255.0 for all six PCs. No default gateway is needed for this same-VLAN-only lab.

4. Step 1: Create the Network Topology

  1. Open Cisco Packet Tracer.
  2. Drag one Cisco 2960 switch into the workspace.
  3. Drag six PCs into the workspace.
  4. Connect each PC to the switch using copper straight-through cables.
  5. Use the port assignments from the addressing table.

After connecting the devices, wait for the switch links to become active.

5. Step 2: Configure IP Addresses on PCs

Each PC needs an IP address in the network assigned to its department.

  1. Click PC1.
  2. Open the Desktop tab.
  3. Select IP Configuration.
  4. Enter the IP address and subnet mask.
  5. Repeat the process for all remaining PCs.

For example, PC1 should use:

IP Address:   192.168.10.10
Subnet Mask:  255.255.255.0
Default GW:   Leave blank
    

Configure the remaining PCs using the addressing table.

6. Step 3: Access the Switch CLI

Click the switch and open its CLI tab. Press Enter if required to access the command prompt.

Enter privileged EXEC mode and global configuration mode:

Switch> enable
Switch# configure terminal
Switch(config)#
    

You are now ready to configure VLANs.

7. Step 4: Create VLANs

Create three VLANs and assign meaningful names to them.

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
    

These commands create three separate logical networks on the switch.

8. Step 5: Assign Switch Ports to VLANs

Now assign the switch ports according to the department of each PC.

Assign Ports to VLAN 10 – HR

Switch(config)# interface range fa0/1 - 2
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 10
Switch(config-if-range)# exit
    

Assign Ports to VLAN 20 – IT

Switch(config)# interface range fa0/3 - 4
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 20
Switch(config-if-range)# exit
    

Assign Ports to VLAN 30 – Finance

Switch(config)# interface range fa0/5 - 6
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 30
Switch(config-if-range)# exit
    

What does this mean? The switchport mode access command configures the interface as an access port, while switchport access vlan assigns it to the selected VLAN.

9. Step 6: Verify VLAN Configuration

Use the following commands to check whether the VLANs and port assignments are correct.

Display VLAN Information

Switch# show vlan brief
    

Expected VLAN information should look similar to this:

VLAN Name       Status    Ports
---- ---------- --------- ----------------
1    default    active
10   HR         active    Fa0/1, Fa0/2
20   IT         active    Fa0/3, Fa0/4
30   FINANCE    active    Fa0/5, Fa0/6
    

The exact output may differ depending on the Packet Tracer device and switch configuration.

Check Individual Interfaces

Switch# show interfaces fa0/1 switchport
    

This command provides details about the switchport mode and VLAN assignment.

10. Step 7: Test Network Connectivity

Now test communication between PCs using the ping command.

Test 1: Same VLAN Communication

From PC1, open Command Prompt and enter:

ping 192.168.10.11
    

Expected result: PC1 should successfully communicate with PC2 because both belong to VLAN 10 and use the same IP subnet.

Test 2: Different VLAN Communication

From PC1, enter:

ping 192.168.20.10
    

Expected result: The ping should fail in this lab because VLAN 10 and VLAN 20 are separate Layer 2 networks, and no router or Layer 3 switch has been configured to route between them.

11. Common VLAN Configuration Mistakes

  • Wrong VLAN assignment: Check that each switch port belongs to the intended VLAN.
  • Incorrect IP address: Ensure each PC uses the correct subnet.
  • Incorrect cable or port: Verify that each PC is connected to the intended switch interface.
  • VLAN not created: Confirm the VLAN exists using show vlan brief.
  • Expecting cross-VLAN communication: Communication between different VLANs requires a Layer 3 routing solution.

12. Save Your Switch Configuration

After completing the configuration, save it so it remains available after a switch restart.

Switch# copy running-config startup-config
    

Press Enter to accept the default destination filename if prompted.

13. Frequently Asked Questions

Can two PCs in different VLANs communicate?

Not through Layer 2 switching alone. They need a Layer 3 device, such as a router or Layer 3 switch, to route traffic between their VLANs.

Why do we use VLANs?

VLANs logically separate departments, reduce unnecessary broadcast traffic within each VLAN, and help administrators apply different network policies.

What is an access port?

An access port is typically configured to carry traffic for one assigned VLAN for an attached end device.

What is the purpose of the show vlan brief command?

It displays VLAN IDs, names, status, and access ports assigned to each VLAN.

14. Quick Knowledge Check

Question 1: What is a VLAN?

Answer: A Virtual Local Area Network that creates a logical Layer 2 network.

Question 2: Which command creates VLAN 10?

Answer: vlan 10 from global configuration mode.

Question 3: Which command assigns a switch port to VLAN 20?

Answer: switchport access vlan 20.

Question 4: Which command displays VLAN and port information?

Answer: show vlan brief.

15. Key Takeaways

  • VLANs divide a physical switched network into logical Layer 2 networks.
  • VLAN IDs identify separate VLANs.
  • Access ports connect end devices to their assigned VLANs.
  • Devices in the same VLAN and subnet can communicate without inter-VLAN routing.
  • Communication between different VLANs requires Layer 3 routing.
  • Packet Tracer provides a practical environment for learning switch configuration.

Practice Networking with ATN Campus

Move beyond theory and build practical networking skills through hands-on labs, guided exercises, and certification-focused learning.

  • CCNA and CCNP
  • Network Routing and Switching
  • Subnetting and IP Addressing
  • Network Security and CEH
  • Cisco CyberOps
  • Cloud Networking
  • Python for Network Automation
  • Practical Networking Labs

???? Want to learn networking? Visit ATN Campus.

???? Learn Networking.
???? Master Routing & Switching.
???? Practice with Real Labs.
???? Prepare for Certifications.
???? Build Your IT Career with ATN Campus.
Document ATN CAMPUS