VLAN Configuration on a Cisco Switch

Configuring VLANs on a Cisco switch is a fundamental networking task. This tutorial is compatible with Cisco Packet Tracer for simulation purposes. Here’s a step-by-step guide to help you set up VLANs on a Cisco Switch (e.g., 2960) using Packet Tracer:

Step 1: Access the Cisco Switch

  1. Connect to the Switch:
    • In Packet Tracer, drag a Cisco switch to the workspace and connect to it using a console cable.
    • Click on the switch, then select the CLI tab to open the command-line interface.
  2. Enter Privileged EXEC Mode:
    enable

    If prompted, enter the enable password.

Step 2: Enter Global Configuration Mode

  1. Enter Global Configuration Mode:
    configure terminal

Step 3: Create VLANs

  1. Create a VLAN:
    vlan 10

    After entering this command, you’ll be in VLAN configuration mode.

  2. Name the VLAN (Optional):
    name Sales

    Exit VLAN configuration mode by typing exit:

    exit
  3. Repeat for Additional VLANs:
    
    vlan 20
    name Engineering
    exit
    vlan 30
    name Management
    exit
                        

Step 4: Assign Switch Ports to VLANs

  1. Enter Interface Configuration Mode:
    interface FastEthernet 0/1

    Replace FastEthernet 0/1 with the appropriate interface name based on your configuration.

  2. Set the Switchport Mode to Access:
    switchport mode access
  3. Assign the Port to a VLAN:
    switchport access vlan 10
  4. Exit Interface Configuration Mode:
    exit
  5. Repeat for Other Ports:

    Assign other interfaces to their respective VLANs using the same process.

Step 5: Configure Trunk Ports (Optional)

  1. Enter Interface Configuration Mode for a Trunk Port:
    interface FastEthernet 0/24

    Replace FastEthernet 0/24 with the appropriate trunk port interface name.

  2. Set the Switchport Mode to Trunk:
    switchport mode trunk

    This command sets the port to trunk mode, allowing it to carry traffic for multiple VLANs.

  3. Specify Allowed VLANs on the Trunk (Optional):
    switchport trunk allowed vlan 10,20,30

    This command specifies which VLANs are allowed to pass through the trunk port. If not configured, all VLANs are allowed by default.

  4. Exit Interface Configuration Mode:
    exit

Step 6: Save the Configuration

  1. Save the Running Configuration to Startup Configuration:
    write memory

    Alternatively:

    copy running-config startup-config

    These commands save the current running configuration to the startup configuration, ensuring that changes are preserved after a reboot.

Step 7: Verify the Configuration

  1. Show VLANs:
    show vlan brief

    This command displays a brief summary of all VLANs configured on the switch.

  2. Check Trunk Ports:
    show interfaces trunk

    This command shows the status and configuration of trunk ports, including allowed VLANs.

  3. Show Running Configuration:
    show running-config

    This command displays the current configuration of the switch.

Now your Cisco switch should have the VLANs configured with ports assigned accordingly. This setup allows you to segment network traffic, improving security and reducing broadcast domains.