Cisco IOS Commands

IOS has three places you type: user mode, privileged mode and configuration mode, and every command belongs to one of them. Learn the mode first and the prompt tells you where you are. The show commands below are the ones that answer most troubleshooting questions before any configuration changes.

Modes and navigation

CommandWhat it does
enableUser EXEC to privileged EXEC (prompt changes from > to #)
configure terminalEnter global configuration mode
interface GigabitEthernet0/1Enter interface configuration
line vty 0 4Enter configuration for the five remote terminal lines
exitUp one level
endStraight back to privileged EXEC from any config level
do show ip interface briefRun a privileged command from inside config mode
copy running-config startup-configSave the running configuration to NVRAM
write memoryOlder equivalent of the copy command above
reloadReboot the device

Show commands that answer most questions

CommandWhat it shows
show running-configThe active configuration
show startup-configThe saved configuration in NVRAM
show ip interface briefEvery interface, its address, and up/down state
show interfacesCounters, errors, duplex and speed per interface
show ip routeThe routing table with the code letter for each route source
show vlan briefVLANs and the access ports assigned to each
show interfaces trunkTrunk ports, encapsulation, native and allowed VLANs
show mac address-tableLearned MAC addresses and the port each was seen on
show ip arpThe IP-to-MAC mappings the device has resolved
show cdp neighborsDirectly connected Cisco devices and the ports between them
show spanning-treeSTP role and state per port, root bridge identity
show ip ospf neighborOSPF adjacencies and their state
show access-listsEvery ACL with per-line match counts
show versionIOS version, uptime, and the configuration register

Interface, VLAN and trunk configuration

CommandWhat it does
ip address 192.168.1.1 255.255.255.0Assign an IPv4 address and mask to an interface
no shutdownBring an interface up (router interfaces start shut down)
description Uplink to coreLabel the interface
vlan 10Create VLAN 10 (then name with the name command)
switchport mode accessMake a port an access port
switchport access vlan 10Assign the access port to VLAN 10
switchport mode trunkMake a port a trunk
switchport trunk native vlan 99Set the untagged VLAN on a trunk
switchport trunk allowed vlan 10,20Restrict which VLANs cross the trunk
interface vlan 10Create the switched virtual interface for VLAN 10
ip default-gateway 192.168.1.1Gateway for a Layer 2 switch's management traffic

Routing

CommandWhat it does
ip route 0.0.0.0 0.0.0.0 203.0.113.1Default static route via a next hop
ip route 10.2.0.0 255.255.0.0 10.1.1.2Static route to a network via a next hop
router ospf 1Start OSPF process 1
network 10.0.0.0 0.255.255.255 area 0Put matching interfaces into OSPF area 0 (wildcard mask)
router-id 1.1.1.1Set the OSPF router ID explicitly
passive-interface GigabitEthernet0/2Advertise the network without forming adjacencies on that port
ip ospf cost 10Set the interface cost OSPF uses for path selection

Access control lists

CommandWhat it does
access-list 10 permit 192.168.1.0 0.0.0.255Standard numbered ACL matching a source network
ip access-list extended WEBCreate a named extended ACL
permit tcp any host 10.1.1.10 eq 443Allow TCP to one host on port 443
deny ip any anyExplicit deny (an implicit one ends every ACL anyway)
ip access-group WEB inApply the ACL inbound on the current interface
access-class 10 inApply a standard ACL to VTY lines

Device access and security basics

CommandWhat it does
hostname CORE1Set the device name
enable secret Str0ngPassHashed privileged-mode password
service password-encryptionObscure plaintext passwords in the configuration
username admin secret Str0ngPassLocal account with a hashed password
ip domain-name example.comNeeded before generating RSA keys for SSH
crypto key generate rsaGenerate the key pair SSH uses
transport input sshOn VTY lines, accept SSH only
login localOn VTY lines, authenticate against local usernames
banner motd #Authorized access only#Message shown before login

Try it here

Three verified practice questions on this material. Answer one, and see the official page behind the answer.

6-5Automation and Programmability

Device configuration is exchanged over NETCONF. How is the configuration data encoded?

Five free questions on every practice exam. No account, no card.