Back to Networking Examples
Quick reference · Cisco IOS 15.x

Cisco IOS Command Reference

The most-used Cisco IOS CLI commands for routers and switches, in ten categories so you can find the right one fast. Every block is copy-ready: the prompts are shown for context but aren't copied, and ! comments are stripped too. Where a topic has its own guide on this site — setup, NAT, VLANs — the section says so and links to it.

The three prompts every command below assumes
Router> enable ← user EXEC: look, don't touch Router# configure terminal ← privileged EXEC: show, save, reboot Router(config)# ← global configuration: change things
Categories 10
REF 01

CLI navigation & modes.

Router & Switch

IOS has three main privilege levels: User EXEC (>), Privileged EXEC (#), and Global Configuration ((config)#). Sub-modes nest inside global config.

CommandFrom PromptWhat It Does
enableRouter>Enter privileged EXEC mode
configure terminalRouter#Enter global configuration mode
end or Ctrl+Zany config modeReturn to privileged EXEC immediately
exitany modeGo up one level in mode hierarchy
write memoryRouter#Save running config to NVRAM (same as copy run start)
reloadRouter#Reboot the device
?anyContext-sensitive help — list available commands
show versionRouter#IOS version, uptime, hardware info
💡 Explain it simply

You spent an hour configuring a router, unplugged it, and it came back blank. Explain the difference between show running-config and show startup-config, and which one command would have saved you.

Reveal a plain-language answer

The running config is the router's working memory — every command you type changes it instantly, and it lives in RAM, which empties when the power goes. The startup config is the copy on the tiny flash chip that survives a reboot. Nothing copies one to the other for you. write memory (the same as copy running-config startup-config) is that copy. Type it after every change you want to keep, and reading both configs side by side tells you exactly what is still unsaved.

Tab completion

Press Tab to complete any unambiguous command. Press ? after a partial command to see matching options. IOS accepts unique abbreviations: conf t = configure terminal.

REF 02

Essential show commands.

Router & Switch

The most important read-only commands for viewing device state. These never change configuration — use them freely to investigate any problem.

CommandWhat You See
show running-configCurrent config in RAM (what is active right now)
show startup-configSaved config in NVRAM (what loads on boot)
show ip interface briefAll interfaces: IP, status, protocol — one line each
show interfacesDetailed stats and error counters for every interface
show ip routeIP routing table
show arpARP cache (IP ↔ MAC mappings)
show mac address-tableSwitch MAC address table
show cdp neighbors detailDirectly connected Cisco devices
show processes cpuCPU utilization by process
show flashFlash memory contents (IOS image files)
REF 03

Interface configuration.

Router & Switch

Configure IP addresses, speed, duplex, and state on router and switch interfaces.

Router — interface setup
! Assign an IP address to a router interface
Router(config)# interface GigabitEthernet 0/0
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Router(config-if)# description LAN — Staff Network
Router(config-if)# no shutdown
Router(config-if)# exit

! Force speed and duplex (useful for older or mismatched devices)
Router(config-if)# speed 100
Router(config-if)# duplex full

! Shut down an interface
Router(config-if)# shutdown

! View detailed interface stats and error counters
Router# show interfaces GigabitEthernet 0/0
Abbreviations

IOS accepts unique abbreviations. int g0/0, interface gi0/0, and interface GigabitEthernet 0/0 are all equivalent.

REF 04

Static & default routes.

Cisco 1921

Static routes are manually configured paths. A default route (0.0.0.0/0) is the gateway of last resort — traffic with no matching route is sent here.

1921 — static routing
! Default route — send unknown traffic to ISP gateway
Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1

! Static route to a specific network via next-hop IP
Router(config)# ip route 10.10.0.0 255.255.0.0 192.168.1.254

! Static route via exit interface (floating)
Router(config)# ip route 10.10.0.0 255.255.0.0 GigabitEthernet 0/1

! Remove a static route
Router(config)# no ip route 10.10.0.0 255.255.0.0 192.168.1.254

! Verify routing table
Router# show ip route
CodeMeaning
CConnected — directly attached network
LLocal — the router's own interface IP (/32)
SStatic — manually configured
S*Static default route — gateway of last resort
OOSPF learned
DEIGRP learned
REF 05

VLAN commands.

C2960L

Quick reference for creating VLANs, assigning ports, and configuring trunks on a Cisco Catalyst switch. See the full VLAN guide for step-by-step setup.

CommandWhat It Does
vlan 10Create VLAN 10 (in global config)
name StaffName the VLAN (in vlan config mode)
show vlan briefAll VLANs and their assigned ports
switchport mode accessSet port to access mode (one VLAN, untagged)
switchport access vlan 10Assign port to VLAN 10
switchport mode trunkSet port to trunk mode (multiple VLANs, tagged)
switchport trunk allowed vlan 10,20,30Restrict trunk to specific VLANs
switchport trunk allowed vlan add 40Add VLAN 40 to existing trunk allowed list
show interfaces trunkAll trunk ports and their allowed VLANs
show mac address-table vlan 10MACs learned on VLAN 10
REF 06

NAT commands.

Cisco 1921

Configure and verify Network Address Translation. See the full NAT Configuration Guide for step-by-step setup including PAT, static NAT, and port forwarding.

CommandWhat It Does
ip nat insideMark interface as inside NAT (LAN side)
ip nat outsideMark interface as outside NAT (WAN side)
ip nat inside source list LAN_ACL interface Gi0/0 overloadPAT — map all LAN IPs to WAN interface IP
ip nat inside source static 192.168.10.20 203.0.113.5Static NAT — permanent 1:1 IP mapping
show ip nat translationsActive NAT translation table
show ip nat statisticsTranslation counts and miss counters
clear ip nat translation *Flush all NAT translations
debug ip natReal-time NAT events (use with caution)
REF 07

Access control lists (ACLs).

Cisco 1921

ACLs filter traffic. Standard ACLs match source IP only. Extended ACLs match source, destination, protocol, and port — much more powerful.

1921 — named ACLs
! Named standard ACL — permit a subnet
Router(config)# ip access-list standard PERMIT_LAN
Router(config-std-nacl)# permit 192.168.10.0 0.0.0.255
Router(config-std-nacl)# deny any
Router(config-std-nacl)# exit

! Named extended ACL — block Telnet from Guests to Servers
Router(config)# ip access-list extended BLOCK_GUEST_TELNET
Router(config-ext-nacl)# deny tcp 192.168.20.0 0.0.0.255 192.168.30.0 0.0.0.255 eq 23
Router(config-ext-nacl)# permit ip any any
Router(config-ext-nacl)# exit

! Apply ACL inbound on sub-interface for VLAN 20
Router(config)# interface GigabitEthernet 0/0.20
Router(config-subif)# ip access-group BLOCK_GUEST_TELNET in

! Verify ACLs
Router# show ip access-lists
Wildcard masks

ACLs use wildcard masks — the inverse of subnet masks. Wildcard for /24 is 0.0.0.255. An implicit deny any exists at the end of every ACL.

Every ACL ends with an invisible deny any. If you only wrote deny lines, you just blocked everything.

REF 08

DHCP commands.

Cisco 1921

The 1921 can act as a DHCP server, relay agent, or client. These are the most common commands for configuring and verifying DHCP pools.

CommandWhat It Does
ip dhcp excluded-address 192.168.10.1 192.168.10.10Reserve IPs — won't be handed out by DHCP
ip dhcp pool STAFFCreate and name a DHCP pool
network 192.168.10.0 255.255.255.0Subnet the pool serves (in dhcp-config mode)
default-router 192.168.10.1Gateway sent to DHCP clients
dns-server 8.8.8.8DNS server sent to clients
lease 7Lease duration in days (default is 1)
show ip dhcp bindingAll active DHCP leases
show ip dhcp poolPool stats: total, leased, available
clear ip dhcp binding *Revoke all leases (forces devices to re-request)
ip helper-address 10.0.0.1Relay DHCP requests to a remote DHCP server
REF 09

Basic security commands.

Router & Switch

Secure console, VTY (SSH/Telnet), and privileged EXEC access. Disable services you don't need — the fewer attack surfaces, the better.

Router — hardening
! Set encrypted enable password
Router(config)# enable secret Str0ng_P@ss!

! Encrypt all plaintext passwords in running-config
Router(config)# service password-encryption

! Secure console port with login timeout
Router(config)# line console 0
Router(config-line)# password C0ns0le!
Router(config-line)# login
Router(config-line)# exec-timeout 5 0
Router(config-line)# exit

! Restrict VTY lines to SSH only
Router(config)# line vty 0 4
Router(config-line)# transport input ssh
Router(config-line)# login local
Router(config-line)# exec-timeout 10 0
Router(config-line)# exit

! Create local user for SSH and enable SSHv2
Router(config)# username admin privilege 15 secret Str0ng_P@ss!
Router(config)# ip domain-name yourdomain.local
Router(config)# crypto key generate rsa modulus 2048
Router(config)# ip ssh version 2

! Disable unused services
Router(config)# no ip http server
Router(config)# no ip http secure-server
Router(config)# no cdp run
REF 10

Troubleshooting commands.

Router & Switch

Diagnose connectivity issues with ping, traceroute, and debug. Always disable debug when finished — it can consume significant CPU on production devices.

Router — diagnostics
! Ping from the router itself
Router# ping 8.8.8.8

! Extended ping — specify source interface or IP
Router# ping 8.8.8.8 source GigabitEthernet 0/0
Router# ping 8.8.8.8 source 192.168.10.1

! Traceroute — show each hop to destination
Router# traceroute 8.8.8.8

! Debug IP ICMP — watch ping packets in real time
Router# debug ip icmp
Router# no debug all

! View syslog messages
Router# show logging
Debug warning

debug commands generate high CPU load. Always run no debug all (or undebug all) when finished. On a live router, prefer show commands first.

Ping SymbolMeaning
!Success — reply received within 2 seconds
.Timeout — no reply within 2 seconds
UDestination unreachable (ICMP message returned)
NNetwork unreachable
QSource quench (rate limiting)
GUIDES

The step-by-step guides these commands come from.

1

Cisco 1921 Intro

Console cable, first boot, the three prompts, saving your first config.

2

1921 & C2960L Setup

Initial device configuration from scratch: identity, interfaces, DHCP, NAT, SSH.

3

NAT configuration

PAT, static NAT, and port forwarding, with verification and troubleshooting.

4

VLANs & inter-VLAN routing

Router-on-a-stick step by step.