Study reference

Cisco Commands Cheat Sheet

Common Cisco commands for network engineers, grouped by task, with placeholders only.

1. Modes and saving

Router>                      user EXEC mode
Router> enable
Router#                      privileged EXEC mode
Router# configure terminal
Router(config)#              global configuration
Router(config)# interface GigabitEthernet0/1
Router(config-if)#           interface configuration
Router(config-if)# end       back to privileged EXEC

Router# copy running-config startup-config    save the configuration
Router# show running-config                   what is running now
Router# show startup-config                   what loads at boot

2. Everyday show commands

CommandShows
show versionSoftware version, uptime, model, memory
show ip interface briefInterface addresses and up or down status
show interfaces statusPort status, speed, duplex and VLAN (switches)
show interfaces GigabitEthernet0/1Detail and error counters for one interface
show vlan briefVLANs and the ports in them
show interfaces trunkTrunk ports and allowed VLANs
show mac address-tableMAC addresses the switch has learned
show ip arpIP to MAC address mappings
show spanning-treeSpanning tree roles and states
show etherchannel summaryPort-channel status
show cdp neighbors detailDirectly connected Cisco devices (show lldp neighbors for LLDP)
show ip routeThe routing table
show access-listsAccess lists and match counters
show ip nat translationsActive NAT entries
show loggingRecent log messages
show processes cpu sortedWhat is using the CPU

3. Interface and VLAN basics

interface GigabitEthernet0/1
 description Link to core switch
 ip address 192.168.1.1 255.255.255.0
 no shutdown

vlan 10
 name SALES

interface GigabitEthernet0/2
 switchport mode access
 switchport access vlan 10

interface GigabitEthernet0/24
 switchport mode trunk
 switchport trunk allowed vlan 10,20
! Some older multilayer switches first need:
!  switchport trunk encapsulation dot1q

4. Inter-VLAN routing

! Multilayer switch: one SVI per VLAN
ip routing
interface Vlan10
 ip address 192.168.10.1 255.255.255.0
 no shutdown

! Router on a stick: one sub-interface per VLAN
interface GigabitEthernet0/0.10
 encapsulation dot1Q 10
 ip address 192.168.10.1 255.255.255.0

5. Spanning tree, EtherChannel and port security

spanning-tree mode rapid-pvst
spanning-tree vlan 10 root primary

! Access port to a PC: fast start, protect against switches being plugged in
interface GigabitEthernet0/3
 spanning-tree portfast
 spanning-tree bpduguard enable
 switchport port-security
 switchport port-security maximum 2
 switchport port-security violation restrict
 switchport port-security mac-address sticky

! LACP EtherChannel
interface range GigabitEthernet0/1 - 2
 channel-group 1 mode active
interface Port-channel1
 switchport mode trunk

6. Routing (short forms)

ip route 0.0.0.0 0.0.0.0 192.168.1.254

router ospf 1
 router-id 1.1.1.1
 network 192.168.10.0 0.0.0.255 area 0

router bgp 65001
 neighbor 203.0.113.2 remote-as 65002

More detail is on the routing, OSPF and BGP sheets.

7. Access lists and NAT

! Named extended ACL. Rules are checked top to bottom, and there is an
! implicit "deny all" at the end, so end with a permit if you need one.
ip access-list extended BLOCK-TELNET
 deny tcp any any eq 23
 permit ip any any
interface GigabitEthernet0/1
 ip access-group BLOCK-TELNET in

! Allow only one network to manage the device over SSH
ip access-list standard MGMT-ONLY
 permit 192.168.10.0 0.0.0.255
line vty 0 4
 access-class MGMT-ONLY in

! NAT overload (PAT) for an inside network
interface GigabitEthernet0/0
 ip nat inside
interface GigabitEthernet0/1
 ip nat outside
access-list 1 permit 192.168.10.0 0.0.0.255
ip nat inside source list 1 interface GigabitEthernet0/1 overload

8. DHCP

ip dhcp excluded-address 192.168.10.1 192.168.10.20
ip dhcp pool SALES
 network 192.168.10.0 255.255.255.0
 default-router 192.168.10.1
 dns-server 192.0.2.53

9. Basic device security

hostname R1
enable secret <choose-a-strong-password>
username admin privilege 15 secret <choose-a-strong-password>
ip domain-name example.local
crypto key generate rsa modulus 2048
ip ssh version 2
line vty 0 4
 login local
 transport input ssh
service password-encryption
banner motd # Authorised use only #

Prefer secret over password. service password-encryption only lightly hides older passwords and is not strong protection. Never put real passwords in notes or screenshots.

10. Testing and troubleshooting

ping 192.168.1.2
ping 192.168.1.2 source GigabitEthernet0/1
traceroute 192.168.1.2
terminal length 0              show long output without paging

! Debug output can overload a device. Use only briefly, and switch off after.
debug ip ospf adj
undebug all

A sensible order: Layer 1 (cable, link lights, interface up), Layer 2 (VLAN, trunk, MAC table), Layer 3 (address, mask, gateway, route), then ACLs, NAT and the application.

More cheat sheets

Sources

This page is for study. Please confirm important details against the original standards and vendor documents.