The objective of this article is to go through the commonly used functions for the command line interface (CLI) on the Catalyst 1200 or 1300 switch.
Switches can be accessed and configured through the Command Line Interface (CLI). Accessing the CLI allows commands to be entered in a terminal based window. For a user who has had more experience with terminal commands, this may be an easier alternative to navigating the web configuration utility.
You can access the CLI of the switch using a standard SSH client like PuTTY. For more information on how to access the CLI via PuTTY, click here.
Log in to the switch by using the username and password.
User Name: cisco
Password: *****
The hostname of the switch is in the first line on the command prompt. In order to change this, enter into global configuration mode by typing configure.
switch# configure
Type hostname and the name you want to assign to the switch. In this example, it is Switch3.
switch(config)# hostname Switch3
To exit the global configuration mode, type exit or end.
Switch3(config)# end
To verify this, type show system and you will see the change to the System Name.
Switch3# show system
To create a user who can log into the switch as an administrator, enter the global configuration mode.
Switch3# configure
Type the command username followed by the name of the user you want to create. In this example, it is Tim. Type the command password followed by the password you want to use.
Switch3(config)#username Tim password Enter123
You can choose whether to encrypt the password or not. Hit the space bar on the keyboard and add a question mark to view the available commands. In this example sha-512 is used as the encryption on the password.
Switch3(config)#username Tim password Enter123 method sha512
To assign the user as an administrator, they will need both read and write privileges. Enter privilege followed by control question mark on your keyboard.
Switch3(config)# username Tim password Enter123 method sha512 privilege
In this example, 15 is selected.
Switch3(config)# username Tim password Enter123 method sha512 privilege 15
Type exit to log out of the switch.
Switch3(config)# exit
Switch3#exit
Log back into the switch with the newly created user.
User Name: Tim
Password: ********
Type show users command to see information regarding Username, Protocol, Location, and Session time.
Switch3# show users
The show running configuration command will provide much of the information you might need about the switch.
Switch3# show running-config
Most of the switches have smart ports that allow the switch to determine what is physically plugged into it’s ports and based on macros that are configured, it will auto configure the port. Auto configuring may sometimes not be desirable if we're not aware of the specifics of how it works. Smart port can be disabled in such instances.
Enter the global configuration mode.
Switch3# configure
Type macro auto disabled.
Switch3(config)# macro auto disabled
To turn it back on, run the command macro auto enabled.
Switch3(config)# macro auto enabled
To set the switch to default settings type no macro auto.
Switch3(config)#no macro auto
Enter the global configuration mode and type interface VLAN1.
Switch3(config)# interface vlan 1
Enter the IP address and subnet mask.
Switch3(config-if)#ip address 172.19.76.4 255.255.255.0
To look at the configuration, type the command do show run.
Switch3(config-if)# do show run
While in the global configuration mode, type the VLAN number you want to configure. In this example, it is VLAN 20.
Switch3(config)#vlan 20
To create a VLAN, use the command interface VLAN number and you can configure the interface directly.
Switch3(config)# interface vlan 30
Type do show vlan to look at the VLANs you have created.
Switch3(config-if)# do show vlan
To add a name to the VLAN, type name and then the name you would like to call the VLAN. In this example, it is DATA.
Switch3(config-if)#name DATA
To find commonly or frequently used commands, use the up and down arrow keys to cycle through previously typed commands.
To configure an interface as an access port, type the interface. In this example, it is g1/0/10 for port 10.
Switch3(config)#interface g1/0/10
Create an access port by typing switchport mode access.
Switch3(config-if)#switchport mode access
To assign it to a VLAN, type switchport access followed by the VLAN number. In this example, it is assigned to VLAN 20.
Switch3(config-if)#switchboard access vlan 20
To create a trunk port, enter interface number. In this example, it is g1/0/12.
Switch3(config-if)#interface g1/0/12
Type the command switch port mode trunk.
Switch3(config-if)#switch port mode trunk
To assign the VLANs, enter the command switchport trunk along with the VLAN IDs. In this example, VLANs 1, 20, and 30 are included.
Switch3(config-if)#switchport trunk allowed vlan 1, 20, 30
To add a native VLAN which is the untagged VLAN for the trunk, type switchport trunk native followed by the VLAN ID. In this example, VLAN 1 is used.
Switch3(config-if)# switchport trunk native vlan 1
To save the configuration type exit and hit enter twice.
Switch3(config-if)# exit
Type the command copy running configuration startup configuration.
Switch3#copy running-config startup-config
To confirm, enter Y.
Overwrite file [startup-config]….(Y/N)[ ] ? Y
Now you know all about the commonly used CLI commands to manage your Catalyst 1200 or 1300 switch.
Check out the following pages for more information on the Catalyst 1200 and 1300 switches.
For other configurations and features, refer to the Catalyst series Administration Guide.
Revision | Publish Date | Comments |
---|---|---|
1.0 |
07-Aug-2023 |
Initial Release |