Cisco IOS cheatsheet
Doorzoekbare Cisco IOS/IOS-XE-referentie: interfaces, VLAN’s, routering, access lists, port security, STP, EtherChannel, SNMP en NAT, met elke parameter uitgelegd.
Draait in je browser · er wordt niets verstuurdNieuw
41 commando’s
Modes & navigation
enable
configure terminal
interface <name>
exit / endThe core mode hierarchy: user EXEC (>) -> privileged EXEC (#, via "enable") -> global configuration (config)# -> a sub-mode like interface config (config-if)#.
enable
configure terminal
interface <name>
exit / endThe core mode hierarchy: user EXEC (>) -> privileged EXEC (#, via "enable") -> global configuration (config)# -> a sub-mode like interface config (config-if)#."exit" moves up one level; "end" jumps straight back to privileged EXEC from any configuration sub-mode. Ctrl+Z does the same as "end".
Voorbeeld
enable configure terminal interface GigabitEthernet0/1 ip address 192.168.1.1 255.255.255.0 no shutdown end
? (question mark)Press ? at any point to list available commands or keywords at the current position, and Tab to auto-complete a partially typed command.
? (question mark)Press ? at any point to list available commands or keywords at the current position, and Tab to auto-complete a partially typed command.Works mid-command too, for example "show ip ?" lists every keyword that can follow "show ip".
<show-command> | include <pattern>
<show-command> | section <pattern>Filter show command output to matching lines, or a matching configuration section.
<show-command> | include <pattern>
<show-command> | section <pattern>Filter show command output to matching lines, or a matching configuration section.Voorbeeld
show running-config | section interface GigabitEthernet0/1
Opties
| include <pattern> | Keep only lines containing the pattern. |
|---|---|
| exclude <pattern> | Remove lines containing the pattern. |
| section <pattern> | Keep whole config sections whose header line matches the pattern. |
| begin <pattern> | Show output starting from the first matching line onward. |
System & info
show versionShow the IOS version, uptime, hardware model, memory, and the configuration register value.
show versionShow the IOS version, uptime, hardware model, memory, and the configuration register value.The configuration register controls boot behavior; a value other than the normal 0x2102 is worth investigating if a device is not booting as expected.
show running-configShow the active configuration currently running in RAM. This is what the device is actually doing right now.
show running-configShow the active configuration currently running in RAM. This is what the device is actually doing right now.Changes made in configuration mode take effect immediately in the running-config, but are lost on reboot unless saved to startup-config.
show startup-configShow the configuration stored in NVRAM, which is what the device loads on the next boot.
show startup-configShow the configuration stored in NVRAM, which is what the device loads on the next boot.Compare against "show running-config" to see exactly which changes have not been saved yet.
copy running-config startup-configSave the current running configuration to NVRAM so it survives a reboot.
copy running-config startup-configSave the current running configuration to NVRAM so it survives a reboot.The older shorthand "write memory" (or just "write"/"wr") does the same thing on most IOS versions and is still widely used, though "copy running-config startup-config" is the documented form.
reloadReboot the device.
reloadReboot the device.Opties
reload in <minutes> | Schedule a reload after a delay; useful as a safety net before a risky change (cancel with "reload cancel" if the change works). |
|---|
show ip interface briefShow a compact one-line-per-interface summary: IP address, and the interface's administrative and line protocol status.
show ip interface briefShow a compact one-line-per-interface summary: IP address, and the interface's administrative and line protocol status."administratively down" means someone configured "shutdown" on it; "down" (line protocol) with "up" (admin) usually means a physical/Layer 1 or Layer 2 problem.
Interfaces & VLANs
interface <type><number>
ip address <ip> <mask>
no shutdownConfigure an interface: assign an IPv4 address and subnet mask, and bring the interface up.
interface <type><number>
ip address <ip> <mask>
no shutdownConfigure an interface: assign an IPv4 address and subnet mask, and bring the interface up.Voorbeeld
interface GigabitEthernet0/1 ip address 192.168.10.1 255.255.255.0 no shutdown
Opties
no shutdown | Administratively enable the interface. Interfaces on routers are shutdown by default out of the box; switch ports typically are not. |
|---|---|
shutdown | Administratively disable the interface. |
description <text> | Free-text label, shown in "show interfaces" and "show ip interface brief" with some output formats; purely documentation, no functional effect. |
interface <name>
switchport mode access
switchport access vlan <id>Put a switch port into access mode and assign it to a single VLAN, the standard config for a port connecting to an end device.
interface <name>
switchport mode access
switchport access vlan <id>Put a switch port into access mode and assign it to a single VLAN, the standard config for a port connecting to an end device.Voorbeeld
interface GigabitEthernet0/5 switchport mode access switchport access vlan 20
interface <name>
switchport mode trunk
switchport trunk allowed vlan <list>Put a switch port into trunk mode, carrying tagged traffic for multiple VLANs, typically used between switches.
interface <name>
switchport mode trunk
switchport trunk allowed vlan <list>Put a switch port into trunk mode, carrying tagged traffic for multiple VLANs, typically used between switches.Opties
switchport trunk allowed vlan <list> | Restrict which VLANs are carried on the trunk, for example "10,20,30" or "10-30". Without this, a trunk carries all VLANs by default. |
|---|---|
switchport trunk native vlan <id> | VLAN carried untagged on the trunk. Must match on both ends or traffic leaks between VLANs. |
vlan <id>
name <label>Create a VLAN and give it a descriptive name.
vlan <id>
name <label>Create a VLAN and give it a descriptive name.Voorbeeld
vlan 20 name Guest-WiFi
interface vlan <id>
ip address <ip> <mask>
no shutdownCreate a switch virtual interface (SVI), giving a VLAN a routable IP address, typically the default gateway for devices in that VLAN.
interface vlan <id>
ip address <ip> <mask>
no shutdownCreate a switch virtual interface (SVI), giving a VLAN a routable IP address, typically the default gateway for devices in that VLAN.Requires IP routing enabled ("ip routing" in global config) on a Layer 3 switch to actually route between VLANs.
Routing
ip route <destination-network> <mask> <next-hop-or-interface>Add a static route.
ip route <destination-network> <mask> <next-hop-or-interface>Add a static route.A destination of 0.0.0.0 with mask 0.0.0.0 is a default route, matching any traffic that has no more specific route.
Voorbeeld
ip route 0.0.0.0 0.0.0.0 203.0.113.1
show ip routeShow the full routing table, with each route's source (connected, static, or a routing protocol code like O for OSPF, D for EIGRP).
show ip routeShow the full routing table, with each route's source (connected, static, or a routing protocol code like O for OSPF, D for EIGRP).A code letter before a route line explains why it is there: C for directly connected, S for static, O for OSPF-learned, D for EIGRP-learned, B for BGP-learned.
router ospf <process-id>
network <network> <wildcard-mask> area <area-id>Enable OSPF and advertise a network into a given area.
router ospf <process-id>
network <network> <wildcard-mask> area <area-id>Enable OSPF and advertise a network into a given area.OSPF uses a wildcard mask (inverse of a subnet mask), not a regular subnet mask, when specifying the network.
Voorbeeld
router ospf 1 network 192.168.10.0 0.0.0.255 area 0
show ip ospf neighborShow OSPF neighbor adjacencies and their state. A healthy adjacency should show state FULL.
show ip ospf neighborShow OSPF neighbor adjacencies and their state. A healthy adjacency should show state FULL.A neighbor stuck in 2WAY (on a broadcast network, normal for non-DR/BDR routers) or stuck in INIT/EXSTART usually points at an MTU mismatch, area mismatch, or an authentication/timer mismatch.
Access control lists
ip access-list standard <name>
permit <network> <wildcard-mask>
deny anyA standard ACL filters only on source IP address, typically used to restrict management access (VTY lines) rather than general traffic filtering.
ip access-list standard <name>
permit <network> <wildcard-mask>
deny anyA standard ACL filters only on source IP address, typically used to restrict management access (VTY lines) rather than general traffic filtering.There is an implicit "deny any" at the end of every ACL even without writing it explicitly; writing it out makes the intent visible and is good practice.
Voorbeeld
ip access-list standard MGMT-ACCESS permit 192.168.1.0 0.0.0.255 deny any
ip access-list extended <name>
permit <protocol> <source> <source-wildcard> <destination> <destination-wildcard> [eq <port>]An extended ACL can filter on source and destination address, protocol, and port, used for general traffic filtering on an interface.
ip access-list extended <name>
permit <protocol> <source> <source-wildcard> <destination> <destination-wildcard> [eq <port>]An extended ACL can filter on source and destination address, protocol, and port, used for general traffic filtering on an interface.ACL entries are evaluated top to bottom; the first match wins, and nothing after a match is checked, so order matters as much as the rules themselves.
Voorbeeld
ip access-list extended BLOCK-TELNET deny tcp any any eq 23 permit ip any any
interface <name>
ip access-group <acl-name> <in|out>Apply an ACL to an interface, in a specific direction.
interface <name>
ip access-group <acl-name> <in|out>Apply an ACL to an interface, in a specific direction.Opties
in | Filter traffic entering the router through this interface. |
|---|---|
out | Filter traffic leaving the router through this interface. |
show access-listsShow all configured ACLs and, for each entry, a running match counter since the last clear.
show access-listsShow all configured ACLs and, for each entry, a running match counter since the last clear.The match counters are the fastest way to confirm whether a specific ACL line is actually being hit by real traffic.
Diagnose
show interfaces <name>Show detailed interface statistics: errors, drops, collisions, utilization, duplex/speed.
show interfaces <name>Show detailed interface statistics: errors, drops, collisions, utilization, duplex/speed.Check "input errors", "CRC", "collisions" and duplex mismatches here first when troubleshooting a slow or flapping link.
ping <ip-or-host>
traceroute <ip-or-host>Test reachability and trace the path to a destination from the device itself.
ping <ip-or-host>
traceroute <ip-or-host>Test reachability and trace the path to a destination from the device itself.Opties
ping <ip> source <interface-or-ip> | Source the ping from a specific local interface/IP instead of the default outgoing one. |
|---|
debug <feature>
undebug all / no debug allEnable live debug output for a specific feature or protocol, for example "debug ip ospf adj" or "debug ip packet".
debug <feature>
undebug all / no debug allEnable live debug output for a specific feature or protocol, for example "debug ip ospf adj" or "debug ip packet"."terminal monitor" is needed in an SSH/Telnet session to actually see debug output there (console sessions see it by default).
show loggingShow the device's internal log buffer: interface up/down events, configuration changes, and system messages.
show loggingShow the device's internal log buffer: interface up/down events, configuration changes, and system messages.The buffer is limited and wraps; for persistent logging across reboots, configure a remote syslog server with "logging host <ip>".
show cdp neighbors detailShow directly connected Cisco devices discovered via CDP: device ID, IP address, platform, and local/remote port.
show cdp neighbors detailShow directly connected Cisco devices discovered via CDP: device ID, IP address, platform, and local/remote port.Useful for mapping an unfamiliar topology without needing prior documentation. LLDP ("show lldp neighbors detail") is the vendor-neutral equivalent for mixed-vendor networks.
Port security & STP
interface <name>
switchport port-security
switchport port-security maximum <n>
switchport port-security violation <mode>Limit how many source MAC addresses are allowed on an access port, and what happens when that limit is exceeded.
interface <name>
switchport port-security
switchport port-security maximum <n>
switchport port-security violation <mode>Limit how many source MAC addresses are allowed on an access port, and what happens when that limit is exceeded.Voorbeeld
interface GigabitEthernet0/5 switchport mode access switchport port-security switchport port-security maximum 2 switchport port-security violation restrict
Opties
switchport port-security maximum <n> | Maximum number of learned MAC addresses allowed on the port. Default is 1. |
|---|---|
switchport port-security violation protect | Silently drop frames from addresses beyond the maximum, no log, port stays up. |
switchport port-security violation restrict | Drop frames from addresses beyond the maximum and log/count the violation, port stays up. |
switchport port-security violation shutdown | Default: put the port into err-disabled state on a violation. Requires a manual "shutdown" / "no shutdown" or errdisable auto-recovery to bring it back. |
switchport port-security mac-address sticky | Dynamically learn allowed addresses and keep them across a reboot (saved into the running config once learned). |
show port-security interface <name>Show the port security configuration and current learned MAC address count for an interface.
show port-security interface <name>Show the port security configuration and current learned MAC address count for an interface.Shows whether the port is currently in a security-violation shutdown state, and lists the actual learned MAC addresses to compare against what is expected to be plugged in.
errdisable recovery cause <cause>
errdisable recovery interval <seconds>Automatically bring a port back from err-disabled state after a delay, instead of requiring a manual shutdown/no shutdown.
errdisable recovery cause <cause>
errdisable recovery interval <seconds>Automatically bring a port back from err-disabled state after a delay, instead of requiring a manual shutdown/no shutdown.Without this, an err-disabled port (from a port-security violation, BPDU Guard, or other causes) stays down until an administrator intervenes.
Voorbeeld
errdisable recovery cause psecure-violation errdisable recovery interval 300
interface <name>
spanning-tree portfast
spanning-tree bpduguard enablePortFast skips the normal STP listening/learning delay on an access port so it forwards traffic immediately after coming up. BPDU Guard protects that assumption by disabling the port if it ever receives a BPDU.
interface <name>
spanning-tree portfast
spanning-tree bpduguard enablePortFast skips the normal STP listening/learning delay on an access port so it forwards traffic immediately after coming up. BPDU Guard protects that assumption by disabling the port if it ever receives a BPDU.PortFast is meant only for ports connecting to a single end host, never to another switch. BPDU Guard enforces that: if a switch (or a loop) is connected to a PortFast port by mistake, the port is immediately err-disabled instead of participating in (and potentially breaking) spanning tree.
show spanning-treeShow spanning tree state per VLAN: root bridge, port roles (root/designated/blocking) and costs.
show spanning-treeShow spanning tree state per VLAN: root bridge, port roles (root/designated/blocking) and costs.Unexpected topology changes (high "Topology Change" counters) or a port stuck in a blocking state that should be forwarding are the usual signs of an STP problem.
Opties
show spanning-tree vlan <id> | Limit the output to one VLAN. |
|---|---|
show spanning-tree summary | A condensed overview of the STP mode and port states across all VLANs. |
EtherChannel
interface range <name1> - <name2>
channel-group <n> mode <mode>Bundle multiple physical links into a single logical EtherChannel (port-channel) for more bandwidth and link redundancy.
interface range <name1> - <name2>
channel-group <n> mode <mode>Bundle multiple physical links into a single logical EtherChannel (port-channel) for more bandwidth and link redundancy.Voorbeeld
interface range GigabitEthernet0/1 - 2 channel-group 1 mode active
Opties
mode active | LACP (IEEE 802.3ad), actively initiates negotiation. Recommended for interoperability with non-Cisco gear. |
|---|---|
mode passive | LACP, only responds to negotiation; both ends cannot be passive or the channel never forms. |
mode on | Static EtherChannel, no negotiation protocol at all. Both ends must be manually and identically configured, and mismatches are not detected automatically. |
mode desirable / auto | Cisco-proprietary PAgP, mainly seen on older equipment; LACP is preferred for new configurations. |
show etherchannel summaryShow configured port-channels and the state of each bundled physical port.
show etherchannel summaryShow configured port-channels and the state of each bundled physical port.A port shown as "(I)" (individual) or "(D)" (down) instead of "(P)" (bundled) is not actually part of the channel yet, usually due to a configuration mismatch with the other member ports.
SNMP & management
snmp-server community <string> <RO|RW>Configure SNMPv2c read-only or read-write access using a community string.
snmp-server community <string> <RO|RW>Configure SNMPv2c read-only or read-write access using a community string.Voorbeeld
snmp-server community M0n1t0r-Only RO
snmp-server group <group> v3 priv
snmp-server user <user> <group> v3 auth sha <auth-pass> priv aes 128 <priv-pass>Configure SNMPv3 with authentication and encryption, the secure alternative to a plain community string.
snmp-server group <group> v3 priv
snmp-server user <user> <group> v3 auth sha <auth-pass> priv aes 128 <priv-pass>Configure SNMPv3 with authentication and encryption, the secure alternative to a plain community string.Opties
auth sha <pass> | Authentication algorithm and password, verifies the sender's identity. |
|---|---|
priv aes 128 <pass> | Encryption algorithm and password, encrypts the message content. |
ntp server <ip>Synchronize the device clock to an NTP server.
ntp server <ip>Synchronize the device clock to an NTP server.Accurate time matters beyond convenience: syslog timestamps, certificate validity checks and AAA/Kerberos-adjacent features all depend on it.
logging host <ip>
logging trap <level>Send system log messages to a remote syslog server, and set the minimum severity level to send.
logging host <ip>
logging trap <level>Send system log messages to a remote syslog server, and set the minimum severity level to send.The local log buffer ("show logging") wraps and is lost on reboot; a remote syslog server is what actually gives you log retention.
Opties
logging trap <level> | Minimum severity to forward: emergencies, alerts, critical, errors, warnings, notifications, informational, debugging (from most to least severe). |
|---|
NAT & PAT
ip nat inside source list <acl> interface <outside-if> overloadConfigure dynamic NAT with port translation (PAT/"NAT overload"): many inside hosts share the single outside interface IP, distinguished by source port.
ip nat inside source list <acl> interface <outside-if> overloadConfigure dynamic NAT with port translation (PAT/"NAT overload"): many inside hosts share the single outside interface IP, distinguished by source port.Also requires "ip nat inside" and "ip nat outside" configured on the respective interfaces; NAT only translates traffic crossing between an inside- and an outside-marked interface.
Voorbeeld
access-list 1 permit 192.168.1.0 0.0.0.255 interface GigabitEthernet0/0 ip nat outside interface GigabitEthernet0/1 ip nat inside ip nat inside source list 1 interface GigabitEthernet0/0 overload
Opties
overload | Enables PAT so many inside addresses can share one outside address. Without it, the pool/interface would need one outside address per simultaneous inside host. |
|---|
ip nat inside source static <inside-ip> <outside-ip>Create a permanent one-to-one NAT mapping, typically used to expose an internal server on a public address.
ip nat inside source static <inside-ip> <outside-ip>Create a permanent one-to-one NAT mapping, typically used to expose an internal server on a public address.Voorbeeld
ip nat inside source static 192.168.1.10 203.0.113.10
show ip nat translationsShow the current NAT translation table: inside/outside local and global address pairs.
show ip nat translationsShow the current NAT translation table: inside/outside local and global address pairs.Opties
show ip nat statistics | Summary counters: active translations, hits/misses, and which interfaces are marked inside/outside. |
|---|
De omschrijvingen in dit naslagwerk zijn voorlopig in het Engels.
Uitleg
Zoek of filter op groep en kopieer een commando met één klik. Open een commando voor uitleg, een voorbeeld en elke parameter die het accepteert, met waarschuwingen bij alles dat verkeer kan blokkeren of beheertoegang kan afsluiten.
🔒 Je invoer blijft in je browser en wordt nergens naartoe gestuurd.
Veelgestelde vragen
Waarom zijn mijn configuratiewijzigingen weg na een reboot?
Wijzigingen in configuratiemodus bestaan alleen in de running-config (RAM) totdat ze zijn opgeslagen. Voer "copy running-config startup-config" uit (of het oudere "write memory") om ze op te slaan in NVRAM.
Wat gebeurt er bij een port-security-violatie?
Standaard gaat de poort in err-disabled-status (violation shutdown) en volledig offline, totdat die handmatig gereset wordt of errdisable recovery hem na een wachttijd terugbrengt. De modi restrict en protect laten het extra verkeer vallen zonder de poort uit te schakelen.
Wat nu?
Een probleem gevonden of een suggestie? Laat het ons weten