Cisco IOS Command Reference
The commands you actually type, grouped by task and shown with the prompt at
which they run. Use the mode column: > user EXEC, # privileged
EXEC, (config)# global configuration, and interface/config sub-modes.
CLI modes & basic setup
The prompt tells you where you are. Move deeper with enable and configure terminal; return with exit or end.
| Task | Command | Mode |
|---|---|---|
| Enter privileged EXEC | enable | > |
| Enter global config | configure terminal | # |
| Set hostname | hostname R1 | (config)# |
| Protect privileged mode | enable secret StrongPass123 | (config)# |
| Encrypt plaintext passwords | service password-encryption | (config)# |
| Set minimum password length | security passwords min-length 10 | (config)# |
| Console password & login | line console 0 then password ..., login | (config)# |
| Idle timeout | exec-timeout 5 0 | (config-line)# |
| Save configuration | copy running-config startup-config | # |
| Disable DNS lookup (avoid typos hanging) | no ip domain-lookup | (config)# |
Interfaces
| Task | Command | Mode |
|---|---|---|
| Select an interface | interface gi0/1 | (config)# |
| Describe an interface | description Link to R2 | (config-if)# |
| Assign IPv4 address | ip address 10.0.0.1 255.255.255.0 | (config-if)# |
| Enable / disable | no shutdown / shutdown | (config-if)# |
| Set speed and duplex | speed 1000 then duplex full | (config-if)# |
| Interface range | interface range fa0/1-10 | (config)# |
| Loopback interface | interface loopback 0 then ip address ... | (config)# |
| Turn a switch port into a routed port | no switchport | (config-if)# |
VLANs, trunks & voice
| Task | Command | Mode |
|---|---|---|
| Create / name a VLAN | vlan 20 then name SALES | (config)# |
| Set an access port | switchport mode access | (config-if)# |
| Assign access VLAN | switchport access vlan 20 | (config-if)# |
| Set a trunk | switchport mode trunk | (config-if)# |
| Restrict allowed VLANs | switchport trunk allowed vlan 10,20 | (config-if)# |
| Set native VLAN | switchport trunk native vlan 99 | (config-if)# |
| Disable DTP negotiation | switchport nonegotiate | (config-if)# |
| Voice VLAN | switchport voice vlan 150 | (config-if)# |
| Management SVI | interface vlan 1 then ip address ..., no shutdown | (config)# |
Spanning Tree & EtherChannel
| Task | Command | Mode |
|---|---|---|
| Select STP mode | spanning-tree mode rapid-pvst | (config)# |
| Become root for a VLAN | spanning-tree vlan 10 root primary | (config)# |
| Set a port as PortFast | spanning-tree portfast | (config-if)# |
| Guard against rogue switches | spanning-tree bpduguard enable | (config-if)# |
| Build an LACP channel | channel-group 1 mode active | (config-if)# |
| Configure the port-channel | interface port-channel 1 then switchport mode trunk | (config)# |
Static routing
| Task | Command | Mode |
|---|---|---|
| Static route via next hop | ip route 192.168.2.0 255.255.255.0 10.0.0.2 | (config)# |
| Default route | ip route 0.0.0.0 0.0.0.0 10.0.0.2 | (config)# |
| Floating static (backup) | ip route 0.0.0.0 0.0.0.0 10.0.0.2 111 | (config)# |
| Enable IPv4 routing | ip routing | (config)# |
| IPv6 static route | ipv6 route ::/0 2001:db8::1 | (config)# |
| Enable IPv6 routing | ipv6 unicast-routing | (config)# |
OSPF
| Task | Command | Mode |
|---|---|---|
| Start OSPF process | router ospf 1 | (config)# |
| Set router ID | router-id 1.1.1.1 | (config-router)# |
| Advertise a network | network 10.1.1.0 0.0.0.255 area 0 | (config-router)# |
| Enable OSPF on an interface | ip ospf 1 area 0 | (config-if)# |
| Passive interface | passive-interface gi0/0 | (config-router)# |
| Reset the process | clear ip ospf process | # |
! Advertise two networks in area 0 using classic network statements
R1(config)# router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)# network 10.1.1.0 0.0.0.255 area 0
R1(config-router)# network 10.1.2.0 0.0.0.255 area 0
HSRP
| Task | Command | Mode |
|---|---|---|
| Set virtual IP | standby 1 ip 10.0.0.1 | (config-if)# |
| Set priority (higher wins) | standby 1 priority 150 | (config-if)# |
| Enable preemption | standby 1 preempt | (config-if)# |
| Verify HSRP | show standby brief | # |
NAT & DHCP
| Task | Command | Mode |
|---|---|---|
| Mark inside / outside | ip nat inside / ip nat outside | (config-if)# |
| Source ACL for NAT | access-list 1 permit 10.0.0.0 0.0.0.255 | (config)# |
| Configure PAT | ip nat inside source list 1 interface gi0/0 overload | (config)# |
| Static one-to-one NAT | ip nat inside source static 10.0.0.10 203.0.113.10 | (config)# |
| Exclude addresses | ip dhcp excluded-address 10.0.0.1 10.0.0.9 | (config)# |
| Create a DHCP pool | ip dhcp pool LAN | (config)# |
| Pool network & gateway | network 10.0.0.0 255.255.255.0, default-router 10.0.0.1, dns-server 8.8.8.8 | (config-dhcp)# |
| DHCP relay | ip helper-address 10.0.0.9 | (config-if)# |
Access control lists
| Task | Command | Mode |
|---|---|---|
| Standard numbered ACL | access-list 10 permit 10.0.0.0 0.0.0.255 | (config)# |
| Extended numbered ACL | access-list 100 permit tcp any host 10.0.0.5 eq 80 | (config)# |
| Named ACL | ip access-list standard MGMT | (config)# |
| Apply to an interface | ip access-group 10 in | (config-if)# |
| VTY access control | access-class 10 in | (config-line)# |
NTP, SNMP, syslog, SSH
| Task | Command | Mode |
|---|---|---|
| NTP server | ntp server 10.0.0.5 | (config)# |
| Time zone | clock timezone GMT 0 | (config)# |
| Syslog server | logging host 192.168.1.50 | (config)# |
| Syslog trap level | logging trap warning | (config)# |
| SNMP community (read-only) | snmp-server community public RO | (config)# |
| SNMP host for traps | snmp-server host 192.168.1.60 version 2c public | (config)# |
| DNS client | ip name-server 8.8.8.8 | (config)# |
| SSH: domain name first | ip domain-name example.com | (config)# |
| Generate RSA keys | crypto key generate rsa | (config)# |
| Local user | username admin secret StrongPass123 | (config)# |
| SSH-only VTY | line vty 0 4 then transport input ssh, login local | (config)# |
Port security & Layer 2 protection
| Task | Command | Mode |
|---|---|---|
| Enable port security | switchport port-security | (config-if)# |
| Max MAC addresses | switchport port-security maximum 2 | (config-if)# |
| Static MAC address | switchport port-security mac-address 00aa.bbcc.ddee | (config-if)# |
| Sticky learning | switchport port-security mac-address sticky | (config-if)# |
| Violation mode | switchport port-security violation restrict | (config-if)# |
| DHCP snooping (global) | ip dhcp snooping | (config)# |
| Trust an uplink | ip dhcp snooping trust | (config-if)# |
| Dynamic ARP Inspection | ip arp inspection vlan 10 | (config)# |
| Disable unused ports | shutdown on unused interfaces | (config-if)# |
Verification (show commands)
| Question | Command | Mode |
|---|---|---|
| Interfaces up/down and IPs | show ip interface brief | # |
| Routing table | show ip route | # |
| OSPF neighbours | show ip ospf neighbor | # |
| OSPF database | show ip ospf database | # |
| MAC address table | show mac address-table | # |
| VLANs and port members | show vlan brief | # |
| Trunk status | show interfaces trunk | # |
| EtherChannel summary | show etherchannel summary | # |
| Spanning tree | show spanning-tree | # |
| CDP / LLDP neighbours | show cdp neighbors / show lldp neighbors | # |
| NAT translations | show ip nat translations | # |
| Access lists | show access-lists | # |
| Running configuration | show running-config | # |
| Current time / NTP | show clock / show ntp status | # |
Self-test (10 questions)
Answer all ten; feedback and explanations appear immediately.
-
Which command saves the running configuration to NVRAM?
write memory /allsave configcopy running-config startup-configcommit
copy running-config startup-configpersists the running config to NVRAM. The olderwrite memoryalso works on many IOS versions. -
Which command enters global configuration mode from privileged EXEC?
enableconfigure terminalinterface gi0/0show running-config
configure terminalmoves from#to(config)#.enablemoves from user to privileged EXEC. -
Which command assigns VLAN 30 to the current access port?
switchport access vlan 30switchport trunk allowed vlan 30vlan 30 accessip vlan 30
switchport access vlan 30sets the access VLAN. The allowed-VLAN command applies to trunks, not access ports. -
Which command builds an LACP EtherChannel on an interface?
channel-group 1 mode desirablechannel-group 1 mode onchannel-group 1 mode passive-onlychannel-group 1 mode active
mode activeis LACP and negotiates.desirableis PAgP andonforces the bundle with no protocol. -
Which command configures a default route via next hop 10.0.0.2?
ip route 10.0.0.2 0.0.0.0ip route 0.0.0.0 0.0.0.0 10.0.0.2default-route 10.0.0.2ip default 10.0.0.2
A default route is
ip route 0.0.0.0 0.0.0.0 NEXT-HOP.ip default-gatewayexists but applies to a device acting as a host, not for routing. -
Which command advertises 10.1.1.0/24 in OSPF area 0?
network 10.1.1.0 255.255.255.0 area 0ospf network 10.1.1.0 area 0network 10.1.1.0 0.0.0.255 area 0area 0 network 10.1.1.0/24
OSPF network statements use a wildcard mask, not a subnet mask. The wildcard for /24 is 0.0.0.255.
-
Which command configures PAT using interface Gi0/0 and ACL 1?
ip nat inside source list 1 interface gi0/0 overloadip nat source list 1 overloadnat inside pat gi0/0ip nat pool gi0/0 overload
This exact command translates sources matched by ACL 1 to the Gi0/0 address with overload (PAT). Remember to mark the inside and outside interfaces.
-
Which command restricts VTY lines to SSH and uses the local user database?
transport input telnetlogin sship ssh enable-vtytransport input sshandlogin local
Under
line vty 0 4,transport input sshallows only SSH andlogin localforces local username/password authentication. -
Which command sets a port-security maximum of 3 MAC addresses?
port-security max-mac 3switchport port-security maximum 3switchport secure 3mac-address limit 3
After enabling
switchport port-security, set the limit withswitchport port-security maximum 3. The port must be an access or manually configured port. -
Which command lists the directly connected Cisco neighbours?
show ip routeshow vlan briefshow cdp neighborsshow ntp status
show cdp neighborslists directly connected Cisco devices and their platforms and interfaces. LLDP is the open equivalent.
Sources & references
- Cisco. CCNA (200-301) Exam Topics, configuration and verification. cisco.com.
- Cisco. Cisco IOS Configuration Fundamentals Command Reference. cisco.com.
- Cisco. Cisco IOS IP Routing: OSPF Command Reference. cisco.com.
- IEEE. IEEE 802.1Q: Bridges and Bridged Networks. standards.ieee.org.
Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.