Cisco Switch Commands Cheat Sheet PDF
Cisco Switch Commands Cheat Sheet PDF
Cisco switches can be used as plug-and-play devices out of the box but they also offer an
enormous amount of features. Although the main purpose of the switch is to provide inter-
connectivity in Layer 2 for the connected devices of the network, there are myriad features
and functionalities that can be configured on Cisco Switches.
In the following Cisco Switch Commands Cheat Sheet, I have tried to include the most
important and frequently-used commands that Cisco professionals encounter in real world
networks. I know that the list is not exhaustive but I believe that the most useful commands
are included. Make sure to download the whole command cheat sheet in PDF format at the
end of the article so you can print it or save it on your computer for future reference.
The following commands will work on most Cisco switch models such as 4500, 3850, 3650,
2960, 3560 etc.
Verification Commands:
TestSwitch#show version [Displays software and hardware information]
TestSwitch#show start [Displays configuration in NVRAM which will be loaded after reboot]
TestSwitch#show vlan [Displays vlan number, name, status and ports associated with it]
TestSwitch#show vtp status [Displays VTP mode, Number of existing vlans and config revision]
TestSwitch#show interface status [Displays interface status, vlan, Duplex, Speed and type]
TestSwitch#show mac address-table [Displays current MAC address forwarding table and which MAC is
learned on each switch port]
MySwitch(config)#enable secret test1 [Sets encrypted secret password using MD5 algorithm. This
is the enable password that you will be asked to enter when trying to enter into “enable” mode]
Console Access:
MySwitch(config)#line con 0 [Enter into line console mode]
MySwitch(config-if)#ip address 192.168.1.2 255.255.255.0 [Set IP address which is the management IP of device]
MySwitch(config-if)#exit
MySwitch(config)#ip default-gateway 192.168.1.1 [Exit path for the switch – gateway IP]
Interface description
MySwitch(config)#interface g0/1
MySwitch(config-if)#description TO SERVER
Port-Security
MySwitch(config)#interface g0/1 [Enter the interface to set port-security]
MySwitch(config-if)#switchport port-security mac-address sticky [Interface converts all MAC addresses to sticky
secure addresses]
MySwitch(config-if)#switchport port-security maximum 1 [Only one MAC address will be allowed for this port]
MySwitch(config-if)#switchport port-security violation shutdown [Port will shut down if violation occurs]
MySwitch(config-if)#exit
MySwitch(config)#exit
PortFast
“Portfast” bypasses the Spanning Tree states and brings the port up as quickly as possible. Use it only if you
connect a regular host (e.g Computer) on the port. Do not use this command when the port is trunk or if you
connect other switches on the specific port.
MySwitch(config)# interface FastEthernet 0/1
Configuring VLANs
MySwitch(config)#vlan 20 [Create a Layer2 VLAN with id 20]
MySwitch(config-vlan)#exit
MySwitch(config)#exit
MySwitch(config-if)#exit
The following commands will select a range of interfaces (from 1 to 24) and add all of them to vlan20
MySwitch(config-if)#exit
Configuring trunk port
MySwitch(config)#interface g0/2
MySwitch(config-if)#switchport trunk native vlan 20 [Specify native vlan for 802.1q trunk - OPTIONAL]
MySwitch(config-if)#switchport trunk allowed vlan 2-5 [vlans 2 to 5 are allowed to pass through the trunk]
MySwitch(config-if)#switchport trunk allowed vlan add 7 [add also vlan 7 in the allowed vlans]
MySwitch(config-if)#switchport trunk allowed vlan remove 3 [remove vlan 3 from the allowed vlans in the trunk]
MySwitch#show interface g0/2 trunk [Verify the trunk ports and associated vlans on the specific interface]