Introduction to Switch and Basic Switching
Commands in Cisco Packet Tracer
Table of Contents
1. Introduction to Switches
○ What is a Switch?
○ How Does a Switch Work?
○ Types of Switches
2. Basic Switching Commands in Cisco IOS
○ Accessing the Switch CLI
○ Basic Configuration Commands
○ Port Configuration
○ VLAN Configuration (Basic)
○ Saving Configuration
3. Lab Demonstration in Cisco Packet Tracer
○ Setting Up the Topology
○ Configuring Hostnames & Passwords
○ Configuring Switch Ports
○ Verifying Connectivity
○ Saving Configuration
1. Introduction to Switches
What is a Switch?
A switch is a networking device that operates at Layer 2 (Data Link Layer) of the OSI
model. It connects multiple devices within a Local Area Network (LAN) and uses MAC
addresses to forward data to the correct destination.
How Does a Switch Work?
● Learning: The switch builds a MAC address table by recording the source MAC
addresses of incoming frames.
● Forwarding: It forwards frames only to the port where the destination MAC is
located (unicast).
● Flooding: If the destination MAC is unknown, the switch floods the frame to all
ports (except the source port).
● Filtering: Does not forward frames if the source and destination are on the same
port.
Types of Switches
● Unmanaged Switch: Plug-and-play, no configuration needed.
● Managed Switch: Configurable (e.g., Cisco switches).
● Layer 2 Switch: Operates at the Data Link Layer (MAC-based forwarding).
● Layer 3 Switch: Can perform routing (IP-based forwarding).
2. Basic Switching Commands in Cisco IOS
Accessing the Switch CLI
1. Open Cisco Packet Tracer and drag a switch (e.g., 2960) into the workspace.
2. Click on the switch and go to the CLI tab.
3. You will see the User Exec Mode (>), enter enable to go to Privileged Exec Mode
(#).
bash
Copy
Download
Switch> enable
Switch#
Basic Configuration Commands
Setting Hostname
bash
Copy
Download
Switch# configure terminal
Switch(config)# hostname SW1
SW1(config)#
Setting Passwords (Console & Enable Secret)
bash
Copy
Download
SW1(config)# enable secret class123 (Privileged mode password)
SW1(config)# line console 0
SW1(config-line)# password cisco
SW1(config-line)# login
SW1(config-line)# exit
SW1(config)# line vty 0 15 (Remote access via Telnet/SSH)
SW1(config-line)# password cisco
SW1(config-line)# login
SW1(config-line)# exit
Encrypting Passwords
bash
Copy
Download
SW1(config)# service password-encryption
Port Configuration (Access & Trunk Ports)
Setting Access Port (Connects to End Devices)
bash
Copy
Download
SW1(config)# interface fastEthernet 0/1
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 10
SW1(config-if)# no shutdown
SW1(config-if)# exit
Setting Trunk Port (Connects to Another Switch/Router)
bash
Copy
Download
SW1(config)# interface fastEthernet 0/24
SW1(config-if)# switchport mode trunk
SW1(config-if)# no shutdown
SW1(config-if)# exit
VLAN Configuration (Basic)
bash
Copy
Download
SW1(config)# vlan 10
SW1(config-vlan)# name Sales
SW1(config-vlan)# exit
SW1(config)# vlan 20
SW1(config-vlan)# name HR
SW1(config-vlan)# exit
Saving Configuration
bash
Copy
Download
SW1# copy running-config startup-config
or
SW1# write memory
3. Lab Demonstration in Cisco Packet Tracer
Step 1: Setting Up the Topology
1. Drag a Switch (2960) and two PCs into the workspace.
2. Connect PC1 → FastEthernet 0/1 and PC2 → FastEthernet 0/2.
Step 2: Configuring Hostname & Passwords
bash
Copy
Download
Switch> enable
Switch# configure terminal
Switch(config)# hostname SW1
SW1(config)# enable secret admin123
SW1(config)# line console 0
SW1(config-line)# password cisco
SW1(config-line)# login
SW1(config-line)# exit
Step 3: Configuring Switch Ports
bash
Copy
Download
SW1(config)# interface fastEthernet 0/1
SW1(config-if)# switchport mode access
SW1(config-if)# no shutdown
SW1(config-if)# exit
SW1(config)# interface fastEthernet 0/2
SW1(config-if)# switchport mode access
SW1(config-if)# no shutdown
SW1(config-if)# exit
Step 4: Verifying Connectivity
● Assign IP addresses to PCs:
○ PC1: 192.168.1.10/24
○ PC2: 192.168.1.20/24
● Ping from PC1 to PC2 (should work).
Step 5: Saving Configuration
bash
Copy
Download
SW1# copy running-config startup-config
Conclusion
● A switch forwards traffic based on MAC addresses.
● Basic configurations include hostname, passwords, VLANs, and port settings.
● Use show running-config to verify settings.
● Always save configurations using copy run start.
This guide provides a hands-on approach to configuring a Cisco switch in Packet
Tracer. 🚀
Would you like any additional details or advanced configurations? 😊