This is a basic guide on configuring a Cisco network switch using the CLI (Command-line interface). Most of the examples provided in this guide will be performed using Cisco Packet Tracer.
Initial switch configuration
When first connecting to the switch, we start in user EXEC mode. This is a very limited mode. Enter the enable
command to elevate to Privileged EXEC mode.
Now that we are in Privileged EXEC mode, we need to elevate to Global Configuration mode to configure the switch.
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#
When a command is entered incorrectly, Cisco IOS will get hung up attempting to resolve the mistyped command to an IP address and require Ctrl
+Shift
+ 6
to break out of it. The following command will prevent this behavior.
Switch(config)#no ip domain-lookup
A Cisco switch comes with a default name of Switch, the default name can be changed by running the following command. Notice how the start of the command prompt now starts with S1.
Switch(config)#hostname S1
S1(config)#
Console Password: Add a password to the console session.
S1(config)#line console 0
S1(config-line)#password cisco
S1(config-line)#login
Privilege EXEC Password: Add a password to privilege EXEC mode.
S1(config)#enable secret cisco
Show Running Config: Verify passwords were configured correctly by stepping back down to Privileged EXEC and run:
⚠️ Create a MOTD Banner: Warn against unauthorized access using a MOTD (Message of the Day) banner.
S1(config)#banner motd "Authorized access only. Violators will be prosecuted to the full extent of the law."
Configure an IP on an Interface: Add an IP address to the default Vlan 1
interface.
S1(config)#interface vlan 1
S1(config-if)#ip address 192.168.1.253 255.255.255.0
S1(config-if)#no shutdown
S1(config-if)#
%LINK-5-CHANGED: Interface Vlan1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
Verify IP addressing by running show ip interface brief
S1#show ip interface brief
FastEthernet0/22 unassigned YES manual down down
FastEthernet0/23 unassigned YES manual down down
FastEthernet0/24 unassigned YES manual down down
GigabitEthernet0/1 unassigned YES manual down down
GigabitEthernet0/2 unassigned YES manual down down
Vlan1 192.168.1.253 YES manual up up