CCNA commands cheat sheet (200-301)
This CCNA commands cheat sheet lists the Cisco IOS commands the 200-301 exam expects you to recognise, grouped by task: device basics, interfaces, VLANs and trunks, inter-VLAN routing, EtherChannel, spanning tree, CDP and LLDP, static routes, OSPF, HSRP, DHCP and NAT, SSH, and layer 2 security and ACLs. Each command comes with a one-line note on what it does. The exam cares as much about reading command output as typing commands, so the show commands for each topic are included alongside the configuration.
Device basics and saving the configuration
Every configuration starts in privileged EXEC mode and moves into global configuration. Changes take effect at once in the running configuration but are lost on reload until they are saved.
- enable — move from user EXEC (>) to privileged EXEC (#).
- configure terminal — enter global configuration mode.
- hostname R1 — name the device.
- enable secret <password> — protect privileged EXEC with a hashed password.
- service password-encryption — hide the remaining plain-text passwords in the configuration (weak encoding, not real encryption).
- copy running-config startup-config — save the configuration so it survives a reload.
- show running-config / show startup-config — compare the active and saved configurations.
- show version — software version, uptime and configuration register.
Interfaces
Router interfaces are shut down by default; switch ports are not. Most "why is this link down" questions come back to the two status columns in show ip interface brief.
- interface GigabitEthernet0/0/0 — enter interface configuration.
- ip address 192.168.1.1 255.255.255.0 — assign an IPv4 address and mask.
- no shutdown — enable the interface.
- description Link to ISP — label the interface.
- show ip interface brief — every interface with its address, Status (layer 1) and Protocol (layer 2).
- show interfaces — counters, errors, duplex and speed for each interface.
- show interfaces status — switch ports with VLAN, duplex, speed and err-disabled state.
VLANs and trunks
Access ports carry one VLAN untagged; trunks carry many, tagged with 802.1Q, except the native VLAN. A mismatched native VLAN or allowed list is a classic exam fault.
- vlan 10 then name SALES — create and name a VLAN.
- switchport mode access then switchport access vlan 10 — make a port an access port in VLAN 10.
- switchport mode trunk — make a port a trunk.
- switchport trunk allowed vlan 10,20 — limit the trunk to these VLANs (replaces the list).
- switchport trunk allowed vlan add 30 — add a VLAN without replacing the list.
- switchport trunk native vlan 999 — change the native (untagged) VLAN; it must match on both ends.
- switchport nonegotiate — turn off DTP negotiation on a trunk.
- show vlan brief — VLANs and their access ports (trunks are not listed).
- show interfaces trunk — trunking ports, native VLAN and allowed VLANs.
- show interfaces GigabitEthernet1/0/1 switchport — the administrative and operational mode of one port.
Inter-VLAN routing
There are two ways to route between VLANs: subinterfaces on a router (router on a stick) or switched virtual interfaces on a layer 3 switch.
- interface GigabitEthernet0/0/1.10 then encapsulation dot1Q 10 then ip address 192.168.10.1 255.255.255.0 — a router subinterface for VLAN 10.
- ip routing — enable routing on a layer 3 switch.
- interface vlan 10 then ip address 192.168.10.1 255.255.255.0 — an SVI that acts as the VLAN 10 gateway.
- no switchport — turn a layer 3 switch port into a routed port.
EtherChannel
The channel-group mode decides the protocol: active or passive negotiate LACP, desirable or auto negotiate PAgP, and on forces a channel with no negotiation. Two passive (or two auto) ends never form a channel.
- interface range GigabitEthernet1/0/1 - 2 — configure several ports at once.
- channel-group 1 mode active — bundle the ports with LACP.
- show etherchannel summary — bundled ports, protocol and the port-channel state.
Spanning tree
Root bridge placement and PortFast with BPDU Guard are the spanning tree commands the exam returns to most.
- spanning-tree vlan 10 root primary — make this switch root for VLAN 10 by lowering its priority.
- spanning-tree vlan 10 priority 4096 — set the bridge priority directly (a multiple of 4096).
- spanning-tree portfast — let an access port to an end device skip listening and learning.
- spanning-tree bpduguard enable — err-disable a PortFast port that receives a BPDU.
- errdisable recovery cause bpduguard — let err-disabled ports recover automatically.
- show spanning-tree vlan 10 — root bridge, port roles (Root, Desg, Altn) and states.
CDP and LLDP
CDP is Cisco-proprietary and on by default; LLDP is the open standard and must be enabled on Cisco devices.
- show cdp neighbors / show cdp neighbors detail — directly connected Cisco devices, with addresses and platform in the detailed form.
- no cdp enable — stop CDP on one interface (no cdp run stops it globally).
- lldp run — enable LLDP globally.
- show lldp neighbors — directly connected LLDP devices.
Static routes
A static route names the destination network, its mask, and either a next-hop address or an exit interface. The default route uses 0.0.0.0 0.0.0.0.
- ip route 10.20.0.0 255.255.0.0 192.168.1.2 — a static route via a next hop.
- ip route 0.0.0.0 0.0.0.0 203.0.113.1 — a default route.
- ip route 10.20.0.0 255.255.0.0 192.168.1.3 5 — a floating static route: a higher administrative distance makes it a backup.
- ipv6 unicast-routing then ipv6 route ::/0 2001:db8::1 — enable IPv6 routing and add an IPv6 default route.
- show ip route — the routing table, with each route source code and [administrative distance/metric].
OSPF
Single-area OSPFv2 is the routing protocol the CCNA configures. Know both ways to enable it on an interface and what blocks a neighbour relationship.
- router ospf 1 — start OSPF process 1.
- router-id 1.1.1.1 — set the router ID explicitly.
- network 10.0.0.0 0.0.0.255 area 0 — enable OSPF on interfaces in that range (a wildcard mask, not a subnet mask).
- ip ospf 1 area 0 — enable OSPF directly on an interface instead.
- passive-interface GigabitEthernet0/0/1 — advertise the network but send no hellos on that interface.
- ip ospf priority 0 — make an interface ineligible to become DR or BDR.
- ip ospf network point-to-point — skip the DR/BDR election on a point-to-point link.
- show ip ospf neighbor — neighbours and their state (FULL is the goal).
- show ip ospf interface brief — OSPF interfaces, area, cost and state.
- show ip protocols — router ID, networks and passive interfaces for each routing protocol.
First hop redundancy: HSRP
HSRP gives hosts a virtual gateway address shared by two routers. The higher priority wins, but only with preempt does it take back the active role after a failure.
- standby 1 ip 192.168.1.254 — the virtual gateway address for group 1.
- standby 1 priority 110 — raise this router above the default of 100.
- standby 1 preempt — take over as active whenever this router has the higher priority.
- standby version 2 — use HSRP version 2.
- show standby — group, state (Active or Standby), priority and virtual IP.
DHCP, NAT and other IP services
These commands make a router hand out addresses, relay DHCP across subnets and translate private addresses.
- ip dhcp excluded-address 192.168.1.1 192.168.1.10 — keep these addresses out of the pool.
- ip dhcp pool LAN then network 192.168.1.0 255.255.255.0 then default-router 192.168.1.1 — a DHCP pool with its gateway.
- ip helper-address 172.16.5.10 — relay DHCP broadcasts from this interface to a server on another subnet.
- ip address dhcp — make the interface a DHCP client.
- ip nat inside / ip nat outside — mark the inside and outside interfaces.
- ip nat inside source static 192.168.50.12 203.0.113.12 — one-to-one static NAT.
- access-list 1 permit 192.168.1.0 0.0.0.255 then ip nat inside source list 1 interface GigabitEthernet0/0/1 overload — PAT: many inside hosts share the interface address.
- show ip nat translations / show ip nat statistics — active translations and counters.
Device access and SSH
SSH needs a hostname, a domain name and RSA keys before the VTY lines can accept it.
- ip domain name example.net — required to generate keys.
- crypto key generate rsa — create the RSA key pair.
- ip ssh version 2 — allow only SSH version 2.
- username admin secret <password> — a local user account.
- line vty 0 4 then login local then transport input ssh — require local logins and allow only SSH on the VTY lines.
Layer 2 security and ACLs
Port security works only on access (or trunk) ports, not on ports left in dynamic mode. With ACLs, remember the implicit deny at the end and where each type belongs: standard ACLs near the destination, extended ACLs near the source.
- switchport port-security — enable port security (default: one MAC address, shutdown on violation).
- switchport port-security maximum 2 — allow two MAC addresses.
- switchport port-security mac-address sticky — learn and save the MAC addresses dynamically.
- switchport port-security violation restrict — drop and log violations instead of shutting the port.
- show port-security interface GigabitEthernet1/0/5 — status, violation mode and count.
- ip dhcp snooping then ip dhcp snooping vlan 10 then ip dhcp snooping trust (on the uplink) — block rogue DHCP servers.
- ip arp inspection vlan 10 then ip arp inspection trust (on the uplink) — Dynamic ARP Inspection using the snooping bindings.
- access-list 10 permit 192.168.1.0 0.0.0.255 — a standard ACL (source address only).
- ip access-list extended WEB then permit tcp any host 10.1.1.10 eq 80 — a named extended ACL.
- ip access-group WEB in — apply an ACL to an interface in one direction.
- access-class 10 in — apply an ACL to the VTY lines.
- show access-lists — every ACL with match counts.
Plan your prep
Questions, answered
Source
Exam facts in this guide come from the vendor's published exam guide. Vendors revise these — check the source for the current version before you book.