Recommended resources
The freely available resources this lesson will direct you to.
Welcome back! In our previous lesson, we explored the "brain" of a network switch—the MAC address table—and understood the theory behind how it learns and forwards frames. Now, it's time to put theory into practice.
This lesson marks our first dive into hands-on device configuration. We will connect to a switch using its Command-Line Interface (CLI) and perform the essential initial setup. By the end of this session, you will be able to configure a switch's hostname, set a management IP address for remote access, and define a default gateway. These are the foundational steps for integrating any new switch into a network.
Getting Started: Navigating the Cisco IOS CLI
Before you can configure a device, you need to know how to navigate its operating system. Cisco switches and routers run an OS called IOS (Internetwork Operating System), which is primarily managed through a CLI. The CLI has several distinct modes, each with different privileges and available commands.
Let's start with a video that walks through these fundamental modes. Understanding this hierarchy is crucial for any configuration task.
Basic Router & Switch IOS configuration commands - CCNA beginner
This video from danscourses provides a clear introduction to the different command modes in Cisco IOS.
Watch the first part of the video, from the beginning up to the demonstration of configuration modes. Pay close attention to: User EXEC Mode (Switch>): The initial, limited-access mode. Privileged EXEC Mode (Switch#): Accessed with the enable command, it allows you to view and manage the system. Global Configuration Mode (Switch(config)#): Accessed with configure terminal, this is where you make system-wide changes. Sub-configuration Modes (e.g., Switch(config-if)#): For configuring specific parts of the switch, like an interface or a console line.
As the video demonstrated, you'll constantly move between these modes. A helpful tip is to look at the prompt, as it always tells you which mode you are currently in.
Step 1: Configure the Hostname
The very first setting you should configure on a new device is its hostname. The default name is simply "Switch," which isn't helpful in a network with dozens or hundreds of devices. A descriptive hostname is critical for identification during troubleshooting.
Cisco Basic Router and Switch Configuration
This section from FlackBox explains the importance of setting a hostname and shows the command to do it.
Read the short section titled "Hostname." Focus on why a descriptive hostname is useful and how the command prompt changes immediately after you apply the command.
To set the hostname, you use the hostname command in global configuration mode. For example, to name your switch "SW1":
Switch> enable
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# hostname SW1
SW1(config)#
Notice how the prompt immediately changes from Switch(config)# to SW1(config)#.
Step 2: Configure a Management IP Address
By default, a Layer 2 switch operates without an IP address, using only MAC addresses to forward frames. However, to manage the switch remotely (for example, using SSH or Telnet), you must assign it an IP address.
This is done on a virtual interface, not a physical one. This special interface is called a Switch Virtual Interface (SVI). By default, every Cisco switch has a pre-configured SVI for VLAN 1. All physical ports on the switch belong to VLAN 1 by default, meaning you can plug your management PC into any port to connect to this SVI.
Let's watch a detailed walkthrough of this process.
22. How to Configure a Switch IP Address
The video "How to Configure a Switch IP Address" by System Engineer clearly explains the why and how of setting a management IP.
Watch these segments to understand the full context and see the configuration in action: Start with the introduction on why a switch needs an IP address. Review the network topology and IP plan used in the example. Finally, watch the step-by-step CLI configuration of the SVI.
The key commands to configure the management SVI are:
interface vlan 1: Enter interface configuration mode for the SVI.ip address <IP_ADDRESS> <SUBNET_MASK>: Assign the IP address and mask.no shutdown: Enable the interface. Although the VLAN 1 SVI is often up by default, it's best practice to always use this command when configuring an interface to ensure it is active.
Here is what it looks like in the CLI:
SW1(config)# interface vlan 1
SW1(config-if)# ip address 192.168.1.10 255.255.255.0
SW1(config-if)# no shutdown
SW1(config-if)# exit
Step 3: Configure the Default Gateway
Now that the switch has an IP address, it can communicate with other devices on its own IP subnet. But what if your management workstation is on a different network? For the switch to send traffic back to a remote network, it needs a default gateway. This is the same concept as the default gateway on a PC. For a switch, the default gateway is typically the IP address of the router interface to which it is connected.

Configuring the default gateway is done in global configuration mode. Let's see how.
22. How to Configure a Switch IP Address
Let's return to the same video to see how the default gateway is configured.
Watch the segment that explains and demonstrates the default gateway configuration. Notice that this command is executed in global configuration mode, not interface mode.
The command is straightforward:
SW1(config)# ip default-gateway 192.168.1.1
Here, 192.168.1.1 would be the IP address of the router that connects this local network to other networks.
Verification and Saving Your Work
Configuration changes are not permanent until you save them. Any changes you make are applied immediately to the running configuration (the active config in RAM). If the switch reboots, this configuration is lost. To make your changes permanent, you must copy the running configuration to the startup configuration (the saved config in NVRAM), which is loaded when the switch boots up.
First, let's look at how to verify our settings, and then we'll save them.
22. How to Configure a Switch IP Address
Verification is a critical skill. This final segment from the "System Engineer" video shows you the essential commands to check your work.
Watch the section on verification methods. Focus on the output of these commands: show ip interface brief: A quick summary of your interfaces and their IP status. show running-config: Displays the entire active configuration. ping: Used to test connectivity to the switch itself and its default gateway.
Once you have verified that your settings are correct, save them using the copy running-config startup-config command from privileged EXEC mode:
SW1# copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
Pressing Enter at the prompt confirms the destination filename. A common shorthand for this command is copy run start.
Conclusion
Congratulations on completing your first hands-on Cisco IOS configuration! You have learned the essential first steps for preparing a switch for a production network. These basic settings are the foundation upon which all other configurations are built.
Key Takeaways:
- CLI Modes: You must navigate between User EXEC, Privileged EXEC (
enable), and Global Configuration (configure terminal) modes to perform tasks. - Hostname: A descriptive hostname (
hostname <NAME>) is crucial for device identification. - Management SVI: A Layer 2 switch is managed via an IP address configured on a Switch Virtual Interface (
interface vlan 1). The interface must be enabled withno shutdown. - Default Gateway: The
ip default-gateway <GATEWAY_IP>command is necessary for the switch to communicate with devices on remote networks. - Save Your Work: Configurations are temporary (
running-config) until saved to thestartup-configwith thecopy running-config startup-configcommand.
In our next lesson, we will expand on the concept of VLANs. You've already used the default VLAN 1 for management; next, you'll learn how to create additional VLANs to segment your network, improving both security and efficiency.