Cisco Switch Commands
Step 1 of 813%

Lab Environment, Topology & Safety

Before you type troubleshooting commands, build a safe Packet Tracer network that gives those commands something real to inspect. This page creates the small lab topology the rest of the lab uses and defines the setup terms before asking you to use them.

After this page, you should be able to:

  • Place, rename, and cable the Packet Tracer devices used throughout this lab
  • Paste starter switch and router setup while understanding what each part is for
  • Set PC and printer IP addresses
  • Run first connectivity tests and record what works or fails
  • Separate read-only inspection from configuration changes
  • Capture baseline notes before moving into the command workflow

Start with Packet Tracer

Cisco Packet Tracer is the main path for this lab because it lets you build switches, cables, and endpoints without buying hardware. This page does not assume you already know Cisco switching terms. When a term matters for setup, it is explained before you need to make a decision with it. Download it from the Cisco Networking Academy lab downloads page. You will need to create a free Cisco Networking Academy account and enroll in the introductory Cisco Packet Tracer course before the download is available.

Two ways to start this lab

If you want the fastest path, download the ready-built Packet Tracer file and open it in Packet Tracer. If you want the hands-on setup practice, build the topology yourself using the device list and cabling map below.

Recommended Packet Tracer devices:
- 1 router: 2911 or any router with GigabitEthernet ports
- 2 switches: 2960 switches work well
- 1 PC: PC1
- 1 printer or second PC: PRINTER1

A router connects different networks to each other. A switch connects nearby devices, such as PCs and printers, to the local network. In this lab, the router is named R1, the switches are named SW1 and SW2, and the end-user devices are named PC1 and PRINTER1.

If this is your first time in Packet Tracer, keep the workspace simple: place the router above the switches, place SW2 under SW1, then put the endpoints under SW2. The physical layout on screen does not change networking behavior, but a tidy topology makes troubleshooting much easier.

Cisco Modeling Labs, GNS3/EVE-NG, or spare gear can work too, but the exact clicks and interface names may differ. If you are new, follow the Packet Tracer path first.

Build the lab topology

In Packet Tracer, add the devices, then rename them so the rest of the lab is easy to follow: R1, SW1, SW2, PC1, and PRINTER1. The names matter because the later instructions tell you exactly which device to open.

Interface names are port names. In the cable map below, GigabitEthernet ports are faster switch or router ports and FastEthernet ports are the endpoint-facing ports Packet Tracer commonly gives PCs and printers. G0/1 is a short way to write GigabitEthernet0/1, and Fa0/1 is a short way to write FastEthernet0/1.

Cable the topology like this:
R1 GigabitEthernet0/0 -> SW1 FastEthernet0/1
SW1 FastEthernet0/2  -> SW2 FastEthernet0/1
PC1 FastEthernet0    -> SW2 FastEthernet0/2
PRINTER1 FastEthernet0 -> SW2 FastEthernet0/3

Two setup words matter before the next note. A is a numbered network group on a switch. In this lab, VLAN 10 is the user PC network and VLAN 20 is the printer network. A trunk is a device-to-device link that can carry more than one VLAN, such as the link from SW1 to SW2.

Manual setup note

If you manually set up the lab, know that Packet Tracer's automatic cabling feature may choose different switch ports than the lab instructions assume. That can make the physical links turn green while VLAN traffic still fails. For example, if the SW1-to-SW2 cable lands on a different SW2 port than Fa0/1, the config in this lab will no longer match the cable. Either cable the exact ports shown above or stop and verify the actual port numbers before continuing.

Think of SW2 as the lower switch where users plug in. SW1 is the switch above it, closer to the router. R1 is the router that sits above the switches and connects the lab networks to each other.

Add starter switch config

The commands below intentionally configure the Packet Tracer lab. They are setup scaffolding, not a habit to copy into production. An access port is a switch port for one ordinary endpoint, such as a PC or printer. A trunk port is a switch-to-switch or switch-to-router link that can carry more than one VLAN.

On SW1, the setup marks Fa0/1 as the trunk toward R1 and Fa0/2 as the trunk toward SW2. You do not need to memorize this yet; the next pages teach you how to inspect it.

Command translation: enable opens the more capable command prompt, configure terminal enters the setup area, hostname renames the device, vlan creates a VLAN number, interface selects a port, description labels a port, switchport mode trunk makes a shared device-to-device link, switchport mode access makes an endpoint port, end exits setup mode, and copy running-config startup-config saves the current setup.

enable
configure terminal
hostname SW1
interface fastEthernet0/1
 description uplink to R1
 switchport trunk allowed vlan 10,20
 switchport mode trunk
interface fastEthernet0/2
 description downstream to switch2
 switchport trunk allowed vlan 10,20
 switchport mode trunk
end
copy running-config startup-config

On SW2, use the known-good lab baseline below. Fa0/1 is the trunk toward SW1, Fa0/2 is PC1 in VLAN 10, and Fa0/3 is PRINTER1 in VLAN 20.

enable
configure terminal
hostname SW2
interface fastEthernet0/1
 description Uplink to SW1
 switchport trunk allowed vlan 10,20
 switchport mode trunk
interface fastEthernet0/2
 description PC1
 switchport access vlan 10
 switchport mode access
interface fastEthernet0/3
 description Printer1
 switchport access vlan 20
 switchport mode access
end
copy running-config startup-config

If Packet Tracer asks whether you want the initial configuration dialog, answer no. You want the normal CLI prompt so you can paste or type the lab setup.

Add starter router config and endpoint IPs

The router gives each VLAN a . A default gateway is the address a device uses when it needs to reach a different network. PC1 will use 192.168.10.1 as its gateway, and PRINTER1 will use 192.168.20.1.

The router config uses one physical router port, GigabitEthernet0/0, with two logical subinterfaces: GigabitEthernet0/0.10 for VLAN 10 and GigabitEthernet0/0.20 for VLAN 20. You may hear this design called router-on-a-stick, but you only need to understand that one router cable is carrying both lab networks.

enable
configure terminal
hostname R1
interface gigabitEthernet0/0
 description Trunk to SW1 G0/1
 no shutdown
interface gigabitEthernet0/0.10
 encapsulation dot1Q 10
 ip address 192.168.10.1 255.255.255.0
interface gigabitEthernet0/0.20
 encapsulation dot1Q 20
 ip address 192.168.20.1 255.255.255.0
end
copy running-config startup-config

Router command translation: no shutdown turns the router port on, encapsulation dot1Q 10 ties that router section to VLAN 10, encapsulation dot1Q 20 ties the next section to VLAN 20, and each ip address line creates the gateway address for that VLAN.

Then click each endpoint in Packet Tracer, open Desktop then IP Configuration, and set these addresses. The IP address identifies the device. The subnet mask tells the device which nearby addresses are part of its local network. The default gateway is the router address it uses for other networks.

PC1:
IP address:      192.168.10.10
Subnet mask:     255.255.255.0
Default gateway: 192.168.10.1

PRINTER1:
IP address:      192.168.20.50
Subnet mask:     255.255.255.0
Default gateway: 192.168.20.1

After you enter the endpoint IP settings, test from PC1. A ping is a simple reachability test: it asks, "Can this device answer me?" In Packet Tracer, click PC1, open Desktop, then open Command Prompt. Type these two commands and press Enter after each one:

ping 192.168.10.1
ping 192.168.20.50

The first address, 192.168.10.1, is PC1's gateway address on the router. The second address, 192.168.20.50, is PRINTER1's address. Record whether each ping succeeds or fails.

Expected result with the downloadable PKT and the configs shown above: both pings should succeed. If either ping fails, check the endpoint IP settings and confirm the cables match the port map at the top of this page.

If your router uses a different physical interface name, use that name instead of gigabitEthernet0/0. The idea is the same: physical interface on, VLAN 10 subinterface, VLAN 20 subinterface.

Know the difference between setup and inspection

Most commands in the rest of this lab begin with show. Those are inspection commands. Commands entered after configure terminal can change device state. Treat configuration mode with extra care, especially on ports that connect to other network devices or to production users.

show interfaces status
configure terminal
interface Fa0/1
shutdown

The first command only displays information. The next three show the path into configuration mode, select port Fa0/1, and shut that port down. They are shown here so you can recognize the difference; do not run the shutdown example unless a later lab step explicitly tells you to.

In plain English: inspect first, write down evidence, and only make changes in the lab or through a real approval process.

Production warning: Do not change production switchports because a tutorial told you to. Confirm the device and interface, capture the current config, follow change control, and ask a senior admin before touching production network settings, shared device-to-device links, or ports people depend on.

Checkpoint

  • Your Packet Tracer topology has R1, SW1, SW2, PC1, and PRINTER1.
  • PC1 and PRINTER1 have IP settings from this page.
  • You ran the first ping tests and recorded whether they passed or failed.
  • You can tell whether you are inspecting the lab or changing lab configuration.
  • You have baseline notes ready before troubleshooting.

Hands-On Practice

Build the Packet Tracer topology first, then use the fields below as your saved lab evidence sheet.

Your checklist and answers are saved locally in this browser.

Build

Verify

Record Evidence