Cisco Catalyst Switch commands

Switching VLAN STP VTP DTP Ether Channels
Basic Switch Configuration Guide with Examples

Print
http://computernetworkingnotes.com/switching-vlan-stp-vtp-dtp-ether-channels/basic-switch-configurations.html

A Cisco Catalyst Switch includes hundreds of commands to fulfill the requirement of network. In this article, I will explain the essential commands. As a instructor I can personally assure you that those individuals who spent time in learning the essential technologies have always had a much higher chance of success, both in exam and on job.
To take full advantage of this article I recommend you to use Packet Tracer software. Packet Tracer is a network simulator software developed by Cisco System for critical hands-on experience. This software includes all necessary devices for the practice of entry level cisco exams. You can download Packet Tracer freely from our site. For this article I assume that you have packet tracer installed on your system.
Create a topology as showing in following image. Alternatively you can download this preconfigured topology.
Download pre configured practice topology for basic switch configuration commands
In this topology
I have used two 2960 Switches.
Switch1 (Interface Gig1/1) is connected with Switch2( Interface Gig1/1) via cross cable.
Switch1 has two PCs connected on interfaces Eth0/1 and Eth0/2 via straight through cable.
Same as switch1, Switch2 also has two PCs connected on its interfaces Eth0/1 and Eth0/2.
IP address is configured on all PCs PC0(192.168.1.1/24), PC1(192.168.1.2/24), PC2(192.168.1.3/24), PC3(192.168.1.4/24).
basic switch configuration guide practice topology
Click Switch1 and click CLI menu item and press Enter Key
access command prompt in packet tracer
Navigation between different switch command mode
Cisco switches run on proprietary OS known as Cisco IOS. IOS is a group of commands used for monitoring, configuring, maintaining cisco devices. For security and easy administration, IOS commands are divided in the set of different command modes. Each command mode has its own set of commands. Which commands are available to use, depend upon the mode you are in. Use following table to navigate between different switch command mode.
Mode Purpose Prompt Command to enter Command to exit
User EXEC Allow you to connect with remote devices, perform basic tests, temporary change terminal setting, list system information Switch > Default mode after booting. Login with password, if configured. Use exit command
Privileged EXEC Allow you to set operating parameters. It also includes high level testing and list commands like show, copy, debug. Switch # Use enable command from user exec mode Use exit command
Global Configuration Contain commands those affect the entire system Switch (config)# Use configure terminal command from privileged exec mode Use exit command
Interface Configuration Contain commands those modify the operation of an interface Switch (config-if)# Use interface type number command from global configuration mode Use exit command to return in global configuration mode
VLAN configuration Create new VLAN or configure, modify, delete existing VLAN. Switch(config-vlan)# Use vlan vlan-id from Global configuration mode Use exit to return previous mode. Use end command to return in privileged exec mode.
Line configuration Line configuration commands modify the operation of a terminal line. Line configuration commands always follow a line command, which defines a line number. Switch(config-line)# Use line vty line_number [ending_line_number] from global configuration mode Use exit command to return in global configuration mode.
How to get help on Cisco Switch command mode

Switch provides two types of context sensitive help, word help and command syntax help.
Word help

Word help is used to get a list of available commands that begin with a specific letter. For example if we know that our command begin with letter e. We can hit enter key after typing e? at command prompt, it will return with all possible commands that begin with letter e.
context help at cisco ios
We can list all available commands, if we don’t know the initials of our command. For example to list all available commands at User exec mode, just type ? at command prompt and hit enter key.
context help cisco ios
Command syntax help

Command syntax help can be used to get the list of keyword, commands, or parameters that are available starting with the keywords that we had already entered. Enter a ? after hitting a space and switch will return with the list of available command options. For example to know the parameters required by show ip command type show ip ? and prompt will return with all associate parameters. If prompt returns with only as option, that means switch does not need any additional parameters to complete the command. You can execute the command in current condition.


cisco ios context help


How to set name on switch


Switch name can be set from global configuration mode. Use hostname [desired hostname] command to set name on switch.


how to set hostname in switch


How to set password on a Catalyst switch


Passwords are used to restrict physical access to switch. Cisco switch supports console line for local login and VTYs for remote login. All supported lines need be secure for UserExec mode. For example if you have secured VTYs line leaving console line insecure. An intruder can take advantage of it to connect with device. Once you are connected with device, all remaining authentication are same. No separate configuration is required for further modes.


Password can be set from their respective line mode. Enter in line mode from global configuration mode.


console line password switch


VTY term stand for virtual terminal such as telnet or SSH. Switch may support from five to thousand of VTYs lines. By default first five (0 – 4) lines are enabled. If we need morelines, we have to enable them manually. 2960 Series switch supports 16 lines. We can set a separate password for each line, for that we have to specify the number of line. In our example we set a common password for all lines.


Above method is good for small companies, where number of network administrators are very few. In above method we have to share password between all administrators. Switch supports both local and remote server authentication. Remote server authentication is a complex process and not included in any entry level exams. For this article I am also skipping remote server method. In local database authentication method switch allows us to set a separate password for each user. Two global configuration commands are used to set local user database.


Switch(config)#username [Username] password[test123]


Or


Switch(config)#username [Username] secret[test123]


cisco switch console username password


Both commands do same job. Advantage of using secret over password is, in secret password is stored in MD5 encryption format while in password password is stored in plain text format.


Along with User Exec mode we can also secure Privilege Exec mode. Two commands are available for it.


Switch(config)# enable password Privilege_EXEC_password


or


Switch(config)# enable secret Privilege_EXEC_password


swtich configuration enable mode password


Again as I mentioned earlier password stored with secret command is encrypted while password stored with password command remains in plain text. You only need to use single command. If you would use both commands as I did, enable secret command would automatically replace the enable password command.


How to reset switch to factory defaults

During the practice several time we have to reset switch to factory defaults. Make sure you don’t run following commands in production environment unless you understand their effects clearly. In production environment we take backup of configuration before removing it. In Lab environment we could skip it. Following commands will erase all configurations from switch( without taking backup, I would include this process with backup in next article).
Switch>enable
Switch#delete flash:vlan.dat
Delete filename [vlan.dat]?                   [Press Enter Key]
Delete flash:vlan.dat? [confirm]          [ Reconfirm by pressing enter key]
Switch#erase startup-config
Switch#reload
How to set IP address in Switch
IP address is the address of device in network. Switch allows us to set IP address on interface level. IP address assigned on interface is used to manage that particular interface. To manage entire switch we have to assign IP address to VLAN1( Default VLAN of switch). We also have to set default gateway IP address from global configuration mode. In following example we would assign IP 172.16.10.2 255.255.255.0 to VLAN1 and set default gateway to 172.16.10.1.
Switch>enable
Switch#configure terminal
Switch(config)#interface vlan1
Switch(config-if)#ip address 172.16.10.2 255.255.255.0
Switch(config-if)#exit
Switch(config)#ip default-gateway 172.16.10.1
How to set interface description
Switches have several interfaces. Adding description to interface is a good habit. It may help you in finding correct interface. To add description use following commands. In following example we would add description Development VLAN to interface FastEthernet 0/1.
Switch(config)#interface fastethernet 0/1
Switch(config-if)#description Development VLAN
How to clear mac address table
Switch stores MAC addresses in MAC address table. Gradually it could be full. Once it full, switch automatically starts removing old entries. You can also clear these tables manually from privileged exec mode. To delete all entries use following command
switch#clear mac address-table
To delete only dynamic entries use
switch#clear mac address-table dynamic
How to add static MAC address in CAM table
For security purpose sometime we have to add mac address in CAM table manually. To add static MAC address in CAM table use following command
Switch(config)#mac address-table static aaaa.aaaa.aaaa vlan 1 interface fastethernet 0/1
In above command we entered an entry for static MAC address aaaa.aaaa.aaaa assigned to FastEnternet 0/1 with default VLAN1.
How to save running configuration in switch
Switch keeps all running configuration in RAM. All data from RAM is erased when we turned off the device. To save running configuration use following command
Switch#copy running-config startup-config
How to set duplex mode
Switch automatically adjust duplex mode depending upon remote device. We could change this mode with any of other supported mode. For example to force switch to use full duplex mode use
Switch(config)# #interface fastethernet 0/1
Switch(config-if)#duplex full
To use half duplex use
Switch(config)# #interface fastethernet 0/1
Switch(config-if)#duplex half
show version
show version command provides general information about device including its model number, type of interfaces, its software version, configuration settings, location of IOS and configuration files, and available memories.
show version cisco ios command
show mac-address-table
Switch stores MAC address of devices those are attached with its interfaces in CAM table. We can use show mac-address-table command to list all learned devices. Switch uses this table to make forward decision. See our previous article to learn more about switch functions.
show mac address table
show flash
Switch stores IOS image file in flash memory. show flash command will list the content of flash memory. This command is useful to get information about IOS file and available memory space in flash.
show flash command cisco ios
show running-config
Configuration parameter values are created, stored, updated and deleted from running configuration. Running configuration is stored in RAM. We can use show running-config command to view the running configuration.
show running configuration command
show startup-config
Any configuration stored in RAM is erased when devices is turned off. We can save running configuration in NVRAM. If we have saved running configuration in NVRAM, it would be automatically loaded back in RAM from NVRAM during the next boot. As switch load this configuration back in RAM in startup of device, at NVRAM it is known as startup-config.
show startup configuration command
show vlan
show vlan command will display the VLANs. For administrative purpose, switch automatically create VLAN 1 and assign all its interfaces to it. You can create custom VLANs from global configuration mode and then assign them to interfaces.
show vlan command cisco ios
show interface
show interface command displays information about interfaces. Without argument it would list all interfaces. To get information about specific interface we need to pass its interface number as an argument. For example to view details about FastEthernet 0/1, use show interface fastethernet 0/1.
show interface command cisco ios
First line from output provides information about the status of interface.
FastEthernet0/1 is up, line protocol is up ( connected)
The first up indicates the status of the physical layer, and the second up indicates to the status of the data link layer.
Possible interface status
up and up :- Interface is operational.
up and down :- Its data link layer problem.
down and down :- Its physical layer problem.
Administratively down and down :- Interface is disabled with shutdown command.
Possible values for physical layer status
Up :- Switch is sensing physical layer signal.
Down :- Switch is not sensing physical layer signal. Possible reasons could be cable is not connected, wrong cable type is used, remote end device is turned off.
Administratively down :- Interface is disabled by using shutdown command.
Possible values for data link layer status
Up :- The data link layer is operational.
Down :- The data link layer is not operational. Possible reasons could be a disabled physical layer, missed keepalives on a serial link, no clocking or an incorrect encapsulation type.
show ip interface brief
show ip interface brief command cisco ios
show ip interface brief is a extremely useful command to get quick overview of all interfaces on switch. It lists their status including IP address and protocol.
Written by Sanjay Kumar

Comments 

# Serbo 2015-02-03 16:58
Yes, this foundament lesson and explaination is so helpful for a beginner like me. Sanjay thanks for your consideration in explaining this subject very well. please provide the basic instruction about building a network and a flow chart.

2. Please provide basic ACL training and use the same training process related to switch configuration.

You can also please send any beginner training, for example: Subnetting and more.
Reply | Reply with quote | Quote
# vinay pratap 2015-01-07 06:51
thanks .
Reply | Reply with quote | Quote
# iltaf hussain 2014-12-31 08:12
Very helpfull info.Thanks for sharing
Reply | Reply with quote | Quote
# satyabhansinghg 2014-12-18 11:37
very good information, thanks a lot of switch sharing details.
Reply | Reply with quote | Quote
# bharath rathod 2014-12-13 07:15
OOOOOOOSUM every single line is very useful if anyone want to know about switching he or she do not need to go any where else..good guide and method….

thanx verry verry much
Reply | Reply with quote | Quote
# Papz 2014-12-03 21:29
I am a beginner and it helps me quite alot to configure switches.
Reply | Reply with quote | Quote
# Ravishankar 2014-12-03 08:06
Really useful information bro.Good work.
Reply | Reply with quote | Quote
# melooooo 2014-12-02 17:31
its useful some what i guess
Reply | Reply with quote | Quote
# Pawan Malviya 2014-11-07 16:17
It is very good for beginners and there is a mention in everything in short and clear.
Reply | Reply with quote | Quote
# loolo 2014-11-04 06:47
it is very good… and it is help me… thank you  🙂
Reply | Reply with quote | Quote
# kiran kumar 2014-11-02 14:17
Your short note is very helpfully and it was very simple and clear understandable and please post some more. thanks a lot.
Reply | Reply with quote | Quote
# pravin 2014-10-25 14:37
Superb!!! no words its very easy to understand i liked it very much thank you very much grt job bro god bless u
Reply | Reply with quote | Quote
# My Jay 2014-10-11 11:45
This is really cool stuff Sanjay, great work
Reply | Reply with quote | Quote
# Mohamed 2014-09-17 09:29
Thanks a lot. This is very very useful for beginners. Expecting more configuration tips. Once again thanks
Reply | Reply with quote | Quote
# Harshavardhan 2014-09-15 08:28
Thanks. it is very good information for beginner.

can send commands to know from which switch uplink is coming to existing switch. uplink switch ip.
Reply | Reply with quote | Quote
# prummanh 2014-09-08 04:48
I would to say thankful with all information clarify. I really love everyone.
Reply | Reply with quote | Quote
# Manish Meshram 2014-08-25 04:43
i am happy but put some more command like ip add binding
Reply | Reply with quote | Quote
# Syed Md. Naim 2014-08-19 04:54
Good guide. Thank you so much!!!
Reply | Reply with quote | Quote
# Riscks D.Kollie,JR 2014-07-24 11:13
Very much good help me a lot to do more practice
Reply | Reply with quote | Quote
# Cidriek 2014-06-27 12:34
Thanks for the info. In fact, you did answered my questions. Thanks!  😆
Reply | Reply with quote | Quote
# astro 2014-06-25 06:48
It so easy to understand I LIKED it.Thanks
Reply | Reply with quote | Quote
# chenthil 2014-06-20 18:40
good guide we can easily understand
Reply | Reply with quote | Quote
# maliro ivan 2014-06-18 14:59
thanks very much , it is a nice and well summarized,easi ly understandable and really they have helped me alot
MAY THE ALMIGHTY LORD REWARD U
Reply | Reply with quote | Quote
# Jorsef 2014-06-06 03:35
Very helpful thanks so mcuh
Reply | Reply with quote | Quote
# A.Rahman 2014-05-18 06:19
Cool Info keep it up. :>
Reply | Reply with quote | Quote
# Raj 2014-05-12 10:32
How to create access list to allow SSH access for few IP address (eg 10.149.21.0/24)
Reply | Reply with quote | Quote
# rajkumar 2014-05-12 06:57
Very good information
Reply | Reply with quote | Quote
# krishna 2014-04-09 06:21
good add more commands
Reply | Reply with quote | Quote
# sunil chambhore 2014-03-13 06:16
i have learning that time no chance for me very hard work to learning.thank you for me advise.
Reply | Reply with quote | Quote
# Calvan 2014-02-13 06:30
no mention,use the right command and all working good
Reply | Reply with quote | Quote
# aditya 2014-01-20 16:44
VERY GOOD METHOD AND THANKU FOR computernetwork ingnotes  😀
Reply | Reply with quote | Quote
# Calvan 2014-02-13 06:28
No mention,As long the command is correct and jageted .Is good to have it.
Reply | Reply with quote | Quote
# Collins285 2014-01-12 19:22
Thank you so much at least I can start somewhere with people like you around.
Reply | Reply with quote | Quote
# Eelo 2013-12-05 18:25
Really great guide but you forgot what is probably the most important command:
copy running-config startup-config

otherwise any changes you may have jsut made to your configuration will just go right out the window other than that good job.
Reply | Reply with quote | Quote
# Mega 2014-02-14 02:22
Um nice guide. But i wonder what is copy running-config startup-config?
Reply | Reply with quote | Quote
# Eelo 2014-02-17 13:37
Its the command that overwrites the current startup confuguration with the current running configuration. in other words if you dont use it all the changes made to your switch will be lost when it shuts off
Reply | Reply with quote | Quote
# GURULINGAPPA 2013-12-05 02:33
it’s useful for fresher
Reply | Reply with quote | Quote
# putar 2013-12-04 14:44
nice guide, thank you so much
Reply | Reply with quote | Quote
# akpro aimé félix 2013-12-03 16:12
I am very glad I had with you this doc
Reply | Reply with quote | Quote
# jasmine 2013-11-29 19:50
Thanks for your outstanding memorial encounter and I also had such an experience
Remote control system for lights and fans
Reply | Reply with quote | Quote
# vijo 2013-11-07 09:20
iam not able to send a message from the pc0 to pc2..help plz
Reply | Reply with quote | Quote
# Joshua Bachuba 2013-11-05 17:26
excellent guide, it is helpfully
Reply | Reply with quote | Quote
# wadood masood 2013-10-14 05:12
wowwwwwwww grate ??????????????? ? nice method
Reply | Reply with quote | Quote
# Ramesh 2013-10-11 14:11
thanks a lot….this information help me a lot……thank you verymuch
Reply | Reply with quote | Quote
# come2i 2013-10-07 13:41
hi
how come i cannot config interface ip address on a cisco switch 2960 in packet tracer
Switch(config-if)#ip address 192.168.0.10 255.255.255.0

help the new beeeeee
Reply | Reply with quote | Quote
# suman 2013-10-04 10:34
it is very good medium to understand ……thanku u cisco.
Reply | Reply with quote | Quote
# bharat rathod 2013-09-24 07:34
OOOOOOOSUM every single line is very useful if anyone want to know about switching he or she do not need to go any where else..good guide and method….

thanx verry verry much
Reply | Reply with quote | Quote
# Ravishankar 2013-09-24 04:14
Very good information, thanks a lot for sharing the switch details.
Reply | Reply with quote | Quote
# vineeth 2013-09-10 10:50
great,i liked very much.
Reply | Reply with quote | Quote
# P.K.pandya 2013-09-08 08:36
good guide………. …
Reply | Reply with quote | Quote
# Ajaz Wani 2013-09-07 07:19
OOOOOOOSUM every single line is very useful if anyone want to know about switching he or she do not need to go any where else..

I am very thankfull who ever is behind this. Thanks sir thanks very much this helps me a lot.  🙂
Reply | Reply with quote | Quote
# krishna p acharya 2013-09-03 06:12
good guide and method….
Reply | Reply with quote | Quote
# NASWAMY 2014-12-21 13:56
Quoting krishna p acharya:
good guide and method….

please provide bandwidth allocation commands
Reply | Reply with quote | Quote
Refresh comments list
Add comment

  

 

FOLLOW US

On Google plus

On Twitter

Like us on Facebook

CONTACT US

Write for us
We are always on the lookout for new talent and ideas. We provide you a platform to share your ideas and knowledge with the world while developing a name for yourself as an expert in your field. We encourage you to learn more and submit a article!
Advertise With us
Reach millions of global audience including network administrator and system admin. Advertising on ComputerNetworkingNotes.com will allow your company to tap into one of the largest online communities of computer networking.
Report an issue
We greatly appreciate our visitors helping us to find issues with the site. we will investigate your report and use the information you provide to improve our site.
Other reason
We love to hear from you! Regardless of the type of feedback, we are always ready to assist you.
Copyright © 2010 – 2015. ComputerNetworkingNotes.com
Terms and conditionsPrivacy PolicyContact UsWrite for usAdvertise with us

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s