Objective

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.

Applicable Devices | Software Version

- Catalyst 1200 (Data Sheet)

- Catalyst 1300 (Data Sheet)

Introduction

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.

Table of Contents

- Common CLI Commands

- Smartport Commands

- Assign Static IP Address

- Configure VLANs

Common CLI Commands

Step 1

Log in to the switch by using the username and password.

User Name: cisco

Password:*****

Step 2

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

Step 3

Type hostname and the name you want to assign to the switch. In this example, it is Switch3.

switch(config)# hostname Switch3

Step 4

To exit the global configuration mode, type exit or end.

Switch3(config)# end

Step 5

To verify this, type show system and you will see the change to the System Name.

Switch3# show system

Step 6

To create a user who can log into the switch as an administrator, enter the global configuration mode.

Switch3# configure

Step 7

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

Step 8

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

Step 9

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

- Privilege level 1 - Read-Only CLI Access - User can’t access the GUI and can only access CLI commands that don’t change the device configuration.

- Privilege level 7 - Read/Limited Write CLI Access - User can’t access the GUI and can only access some CLI commands that change the device configuration.

- Privilege level 15 - Read/Write Management Access - User can access the GUI and can configure the device.

In this example, 15 is selected.

Switch3(config)# username Tim password Enter123 method sha512 privilege 15

Step 10

Type exit to log out of the switch.

Switch3(config)# exit

Switch3#exit

Step 11

Log back into the switch with the newly created user.

User Name: Tim

Password: ********

Step 12

Type show users command to see information regarding Username, Protocol, Location, and Session time.

Switch3# show users

Step 13

The show running configuration command will provide much of the information you might need about the switch.

Switch3# show running-config

Smartport Commands

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.

Step 1

Enter the global configuration mode.

Switch3# configure

Step 2

Type macro auto disabled.

Switch3(config)# macro auto disabled

Step 3

To turn it back on, run the command macro auto enabled.

Switch3(config)# macro auto enabled

Step 4

To set the switch to default settings type no macro auto.

Switch3(config)#no macro auto

Assign Static IP Address

Step 1

Enter the global configuration mode and type interface VLAN1.

Switch3(config)# interface vlan 1

Step 2

Enter the IP address and subnet mask.

Switch3(config-if)#ip address 172.19.76.4 255.255.255.0

Step 3

To look at the configuration, type the command do show run.

Switch3(config-if)# do show run

Configure VLANs

Step 1

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

Step 2

To create a VLAN, use the command interface VLAN number and you can configure the interface directly.

Switch3(config)# interface vlan 30

Step 3

Type do show vlan to look at the VLANs you have created.

Switch3(config-if)# do show vlan

Step 4

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.

Step 5

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

Step 6

Create an access port by typing switchport mode access.

Switch3(config-if)#switchport mode access

Step 7

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

Step 8

To create a trunk port, enter interface number. In this example, it is g1/0/12.

Switch3(config-if)#interface g1/0/12

Step 9

Type the command switch port mode trunk.

Switch3(config-if)#switch port mode trunk

Step 10

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

Step 11

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

Step 12

To save the configuration type exit and hit enter twice.

Switch3(config-if)# exit

Step 13

Type the command copy running configuration startup configuration.

Switch3#copy running-config startup-config

Step 14

To confirm, enter Y.

Overwrite file [startup-config]….(Y/N)[ ] ? Y

Conclusion

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.

- Why Upgrade to Cisco Catalyst 1200 or 1300 Series Switches Feature Comparison

- Cisco Catalyst 1200 and 1300 Series Switches At-a-Glance

For other configurations and features, refer to the Catalyst series Administration Guide.