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
- 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.
- Enter Privileged EXEC Mode:
enableIf prompted, enter the enable password.
Step 2: Enter Global Configuration Mode
- Enter Global Configuration Mode:
configure terminal
Step 3: Create VLANs
- Create a VLAN:
vlan 10After entering this command, you’ll be in VLAN configuration mode.
- Name the VLAN (Optional):
name SalesExit VLAN configuration mode by typing
exit:exit - Repeat for Additional VLANs:
vlan 20 name Engineering exit vlan 30 name Management exit
Step 4: Assign Switch Ports to VLANs
- Enter Interface Configuration Mode:
interface FastEthernet 0/1Replace
FastEthernet 0/1with the appropriate interface name based on your configuration. - Set the Switchport Mode to Access:
switchport mode access - Assign the Port to a VLAN:
switchport access vlan 10 - Exit Interface Configuration Mode:
exit - Repeat for Other Ports:
Assign other interfaces to their respective VLANs using the same process.
Step 5: Configure Trunk Ports (Optional)
- Enter Interface Configuration Mode for a Trunk Port:
interface FastEthernet 0/24Replace
FastEthernet 0/24with the appropriate trunk port interface name. - Set the Switchport Mode to Trunk:
switchport mode trunkThis command sets the port to trunk mode, allowing it to carry traffic for multiple VLANs.
- Specify Allowed VLANs on the Trunk (Optional):
switchport trunk allowed vlan 10,20,30This command specifies which VLANs are allowed to pass through the trunk port. If not configured, all VLANs are allowed by default.
- Exit Interface Configuration Mode:
exit
Step 6: Save the Configuration
- Save the Running Configuration to Startup Configuration:
write memoryAlternatively:
copy running-config startup-configThese commands save the current running configuration to the startup configuration, ensuring that changes are preserved after a reboot.
Step 7: Verify the Configuration
- Show VLANs:
show vlan briefThis command displays a brief summary of all VLANs configured on the switch.
- Check Trunk Ports:
show interfaces trunkThis command shows the status and configuration of trunk ports, including allowed VLANs.
- Show Running Configuration:
show running-configThis 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.