Loading...
Loading...
Every command on the CCNA 200-301 blueprint, with the mode it is typed in, what it does and a worked example. The older material is here too, marked so you can hide it.
238 commands
enableR1>Moves from user EXEC to privileged EXEC, where show and configuration commands live.
R1> enable
The first thing typed in almost every session. The prompt changes from > to #.
disableR1#Drops back from privileged EXEC to user EXEC.
R1# disable
The opposite of enable, and the exam asks which direction each one goes.
configure terminalR1#Enters global configuration mode, where the running configuration is changed.
R1# configure terminal
Everything that changes the device starts here. Often abbreviated conf t.
hostname NAMER1(config)#Sets the device name, which appears in the prompt.
Router(config)# hostname R1
Do this first: the RSA key is named after the hostname and domain name, so changing it later invalidates SSH.
endany modeLeaves configuration mode entirely and returns to privileged EXEC.
R1(config-if)# end
Faster than exiting one level at a time out of a nested mode. Ctrl+Z does the same.
exitany modeLeaves the current mode for the one above it.
R1(config-if)# exit
Steps out of interface configuration back to global configuration, one level per exit.
do COMMANDR1(config)#Runs a privileged EXEC command without leaving configuration mode.
R1(config)# do show ip interface brief
Checking your work mid configuration without losing your place.
copy running-config startup-configR1#Saves the running configuration to NVRAM so it survives a reload.
R1# copy running-config startup-config
Nothing configured is permanent until this runs. A reload without it loses the lot.
copy running-config flash:FILENAMER1#Copies the running configuration into flash under a name you choose.
R1# copy running-config flash:backup
What an engineer types before touching anything. dir shows it landed.
write memoryR1#The older spelling of copy running-config startup-config.
R1# write memory
Identical effect, shorter to type, still accepted. Often abbreviated wr.
erase startup-configR1#Deletes the saved configuration in NVRAM.
R1# erase startup-config
With a reload, returns a device to defaults. The running configuration is untouched until that reload.
reloadR1#Restarts the device.
R1# reload
Needed after erasing the startup configuration. Prompts to save first if there are unsaved changes.
show running-configR1#Prints the configuration the device is using right now.
R1# show running-config
The most useful command on the box. Anything configured but unsaved appears only here.
show startup-configR1#Prints the configuration saved in NVRAM, which is what a reload would load.
R1# show startup-config
Comparing it with the running configuration shows what a reload would throw away.
show versionR1#Prints the IOS version, uptime, hardware, serial number and configuration register.
R1# show version
Where the model, image and licence are read, and where password recovery begins.
banner motd DELIMITERR1(config)#Sets the message of the day, shown to anyone connecting.
R1(config)# banner motd # Authorised access only #
A legal notice before login. The delimiter is any character not used in the message.
clock set HH:MM:SS DAY MONTH YEARR1#Sets the software clock by hand.
R1# clock set 14:30:00 12 October 2026
A stopgap where NTP is not available. Logs and certificates both depend on the time.
no ip domain-lookupR1(config)#Stops the device treating a mistyped command as a hostname to resolve.
R1(config)# no ip domain-lookup
Without it every typo hangs the console for seconds. First thing on any lab device.
ip domain-name NAMER1(config)#Sets the domain name, which with the hostname names the RSA key pair.
R1(config)# ip domain-name example.com
Required before crypto key generate rsa will succeed, which is why it is an SSH prerequisite.
terminal length 0R1#Turns off output paging for this session, so long output scrolls unbroken.
R1# terminal length 0
Capturing a whole configuration without pressing space forty times.
terminal monitorR1#Sends log and debug output to this SSH or Telnet session.
R1# terminal monitor
Debug output goes to the console by default and is invisible over SSH until this is set.
interface TYPE NUMBERR1(config)#Enters interface configuration mode for one port.
R1(config)# interface GigabitEthernet0/0
Everything about a port is configured from inside this mode.
interface range TYPE FIRST - LASTR1(config)#Configures a block of interfaces in one go.
S1(config)# interface range FastEthernet0/1 - 12
Putting twelve access ports in the same VLAN without typing twelve blocks.
ip address ADDRESS MASKR1(config-if)#Gives the interface an IPv4 address and mask.
R1(config-if)# ip address 10.0.0.1 255.255.255.0
The address a router routes from. A switch takes this on an SVI, not a physical port.
ip address dhcpR1(config-if)#Makes the interface a DHCP client and take its address from a server.
R1(config-if)# ip address dhcp
A WAN interface facing an ISP that hands out addresses.
no shutdownR1(config-if)#Brings the interface up.
R1(config-if)# no shutdown
Router interfaces are administratively down by default. An address without this does nothing.
shutdownR1(config-if)#Administratively disables the interface.
R1(config-if)# shutdown
Taking a port out of service without unplugging it. Shows as administratively down.
description TEXTR1(config-if)#Labels the interface for whoever reads the configuration next.
R1(config-if)# description Link to S1 Gi0/1
Costs nothing and saves the next engineer tracing a cable.
duplex MODER1(config-if)#Fixes the duplex to full, half or auto.
S1(config-if)# duplex full
A duplex mismatch gives late collisions and dreadful throughput. Both ends must agree.
speed VALUER1(config-if)#Fixes the interface speed rather than negotiating it.
S1(config-if)# speed 100
Hard setting one end and leaving the other on auto is the classic cause of a mismatch.
interface vlan NUMBERR1(config)#Creates or enters the switch virtual interface for a VLAN.
S1(config)# interface vlan 1
How a switch gets a management address. It needs no shutdown as well.
interface loopback NUMBERR1(config)#Creates a virtual interface that is always up.
R1(config)# interface loopback 0
A stable OSPF router ID, and an address that does not go down when a cable does.
mdix autoR1(config-if)#Lets the port detect and correct for a straight through or crossover cable.
S1(config-if)# mdix auto
Why cable type rarely matters on modern switches. The exam still asks which cable is correct.
show ip interface briefR1#One line per interface: address, status and protocol.
R1# show ip interface brief
The fastest way to see what is up, what has an address and what is still shut down.
show interfacesR1#Everything about an interface: counters, errors, duplex, speed and load.
R1# show interfaces GigabitEthernet0/0
Where CRC errors, collisions and input drops are read when a link is up but unhappy.
show interfaces statusR1#A switch oriented summary: port, VLAN, duplex, speed and type.
S1# show interfaces status
Seeing at a glance which ports are connected and which VLAN each is in.
show interfaces descriptionR1#Interface, status and the description written on it.
R1# show interfaces description
Reading the labels without wading through the whole configuration.
show controllersR1#Hardware level detail, including which end of a serial link holds the DCE cable.
R1# show controllers Serial0/0/0
Working out which router has to supply clock rate on a back to back serial link.
vlan NUMBERR1(config)#Creates a VLAN and enters VLAN configuration mode.
S1(config)# vlan 10
A VLAN must exist before a port can be put in it, or the port goes inactive.
name TEXTR1(config-vlan)#Names the VLAN being configured.
S1(config-vlan)# name Staff
Appears in show vlan brief and tells the next person what the VLAN is for.
switchport mode accessR1(config-if)#Fixes the port as an access port, carrying one VLAN untagged.
S1(config-if)# switchport mode access
Every port a PC or printer plugs into. Stops the port negotiating a trunk by accident.
switchport access vlan NUMBERR1(config-if)#Puts the access port in a VLAN.
S1(config-if)# switchport access vlan 10
With switchport mode access, this is the whole of access port configuration.
switchport mode trunkR1(config-if)#Fixes the port as a trunk, carrying many VLANs tagged.
S1(config-if)# switchport mode trunk
Switch to switch links, and the link to a router doing inter VLAN routing.
switchport mode dynamic desirableR1(config-if)#Actively negotiates a trunk with the far end using DTP.
S1(config-if)# switchport mode dynamic desirable
Knowing the DTP outcomes is examinable. In practice trunks are set statically instead.
switchport trunk allowed vlan LISTR1(config-if)#Restricts which VLANs the trunk carries.
S1(config-if)# switchport trunk allowed vlan 10,20,30
Pruning a trunk. Without the add keyword this replaces the list rather than extending it.
switchport trunk native vlan NUMBERR1(config-if)#Sets the VLAN that crosses the trunk untagged.
S1(config-if)# switchport trunk native vlan 99
Both ends must match or traffic leaks between VLANs. A mismatch is a classic exam fault.
switchport trunk encapsulation dot1qR1(config-if)#Selects 802.1Q tagging on switches that still offer a choice.
S1(config-if)# switchport trunk encapsulation dot1q
Required before switchport mode trunk on older platforms. Newer ones reject it, having only dot1q.
switchport nonegotiateR1(config-if)#Stops the port sending DTP frames.
S1(config-if)# switchport nonegotiate
Hardening a trunk so it cannot be negotiated into something else.
switchport voice vlan NUMBERR1(config-if)#Adds a voice VLAN alongside the access VLAN on the same port.
S1(config-if)# switchport voice vlan 150
An IP phone with a PC behind it: data untagged, voice tagged.
interface TYPE NUMBER.SUBINTERFACER1(config)#Creates a subinterface for router on a stick.
R1(config)# interface GigabitEthernet0/0.10
One physical router port routing between many VLANs, one subinterface each.
encapsulation dot1q NUMBERR1(config-subif)#Tells the subinterface which VLAN tag it handles.
R1(config-subif)# encapsulation dot1q 10
Without it the subinterface has no VLAN and routes nothing. Add native for the untagged VLAN.
show vlan briefR1#Lists VLANs, their names, and which access ports are in each.
S1# show vlan brief
The first check when a PC cannot reach its gateway. A port missing here is in the wrong VLAN.
show interfaces trunkR1#Lists trunk ports with their mode, native VLAN and allowed VLANs.
S1# show interfaces trunk
Where native VLAN mismatches and over pruned allowed lists are caught.
show interfaces switchportR1#The full switching state of a port: mode, access VLAN, native VLAN, negotiation.
S1# show interfaces GigabitEthernet0/1 switchport
When the other two commands disagree, this says what the port really is.
spanning-tree mode MODER1(config)#Selects the spanning tree flavour: pvst, rapid-pvst or mst.
S1(config)# spanning-tree mode rapid-pvst
Rapid PVST converges in seconds rather than the better part of a minute.
spanning-tree vlan VLAN root primaryR1(config)#Lowers the bridge priority so this switch becomes root for that VLAN.
S1(config)# spanning-tree vlan 10 root primary
Choosing the root rather than letting the lowest MAC address choose it for you.
spanning-tree vlan VLAN root secondaryR1(config)#Sets a priority that makes this switch root if the primary fails.
S1(config)# spanning-tree vlan 10 root secondary
A deliberate backup root, so a failure does not move the tree somewhere unhelpful.
spanning-tree vlan VLAN priority VALUER1(config)#Sets the bridge priority directly, in steps of 4096.
S1(config)# spanning-tree vlan 10 priority 4096
The exam expects you to know the default is 32768 and that priority is compared before MAC address.
spanning-tree portfastR1(config-if)#Puts an access port straight into forwarding instead of walking the states.
S1(config-if)# spanning-tree portfast
Edge ports only. A PC should not wait thirty seconds for DHCP. Never on a switch to switch link.
spanning-tree portfast defaultR1(config)#Turns PortFast on for every access port at once.
S1(config)# spanning-tree portfast default
Saves repeating it on every edge port. Trunks are unaffected.
spanning-tree bpduguard enableR1(config-if)#Shuts the port down if a BPDU arrives on it.
S1(config-if)# spanning-tree bpduguard enable
Paired with PortFast: an edge port should never hear a switch, and if it does, something is wrong.
spanning-tree portfast bpduguard defaultR1(config)#Enables BPDU Guard on every PortFast port.
S1(config)# spanning-tree portfast bpduguard default
The usual pairing applied once rather than per port.
channel-group NUMBER mode MODER1(config-if)#Adds the port to an EtherChannel with LACP, PAgP or no negotiation.
S1(config-if)# channel-group 1 mode active
active and passive are LACP, desirable and auto are PAgP, on is neither. Both ends must be compatible.
interface port-channel NUMBERR1(config)#Configures the logical bundle rather than its members.
S1(config)# interface port-channel 1
Trunk settings go on the port-channel, and the members must already agree with each other.
show spanning-treeR1#Root bridge, this bridge, port roles and port states.
S1# show spanning-tree vlan 10
Reading which switch is root and which port is blocking. The heart of every STP question.
show spanning-tree summaryR1#The mode in use, PortFast and BPDU Guard defaults, and a per VLAN port count.
S1# show spanning-tree summary
A quick check of what protections are on before going port by port.
show etherchannel summaryR1#Each bundle, its protocol and the state flags of every member port.
S1# show etherchannel summary
The flags are the answer: P is bundled, I is standalone, which means it did not join.
ip route NETWORK MASK NEXTHOPR1(config)#Adds a static route to a network via a next hop address or exit interface.
R1(config)# ip route 192.168.20.0 255.255.255.0 10.0.0.2
Small networks and stub sites. Shows in the routing table with an S.
ip route 0.0.0.0 0.0.0.0 NEXTHOPR1(config)#Adds a default route, used when nothing more specific matches.
R1(config)# ip route 0.0.0.0 0.0.0.0 209.165.200.226
The gateway of last resort. Shows as S* in the routing table.
ip route NETWORK MASK NEXTHOP DISTANCER1(config)#A static route with a worse administrative distance, so it only takes over if the better route fails.
R1(config)# ip route 0.0.0.0 0.0.0.0 10.0.0.2 200
A floating static route, the standard backup for a primary link.
ip routingR1(config)#Turns on IPv4 routing, which a multilayer switch needs before it will route.
S1(config)# ip routing
Forgetting it is why a layer 3 switch with correct SVIs still will not route between them.
ip default-gateway ADDRESSR1(config)#Tells a device that is not routing where to send traffic off its subnet.
S1(config)# ip default-gateway 192.168.1.1
A layer 2 switch being managed remotely. Ignored once ip routing is on.
show ip routeR1#The routing table: every known network, how it was learned and the next hop.
R1# show ip route
The command every routing question turns on. The codes at the top explain the letters.
show ip route ADDRESSR1#The single entry that would be used for one address, with its metric and distance.
R1# show ip route 192.168.50.1
Settling longest prefix match arguments: this is the route the router would actually pick.
show ip protocolsR1#Which routing protocols are running, what they advertise and their timers.
R1# show ip protocols
Confirming a network statement matched the interface you meant.
show ip cefR1#The forwarding table the hardware actually uses.
R1# show ip cef
The distinction between the routing table and the forwarding table is examinable.
show arpR1#The ARP cache: IPv4 address to MAC address, and the interface it was learned on.
R1# show arp
Proving a neighbour has been heard from. Empty entries point at a layer 2 problem.
clear arp-cacheR1#Empties the ARP cache so entries are learned again.
R1# clear arp-cache
After renumbering, when the old mapping is cached and traffic goes to the wrong MAC.
router ospf PROCESSR1(config)#Starts an OSPF process and enters router configuration mode.
R1(config)# router ospf 1
The process number is local to the router and need not match its neighbours.
network ADDRESS WILDCARD area AREAR1(config-router)#Enables OSPF on every interface the address and wildcard match, and puts them in an area.
R1(config-router)# network 10.0.0.0 0.0.0.255 area 0
A wildcard mask, not a subnet mask. This is where most OSPF configuration marks are lost.
ip ospf AREA area AREAR1(config-if)#Enables OSPF directly on the interface, instead of using a network statement.
R1(config-if)# ip ospf 1 area 0
Clearer than wildcards and increasingly the preferred way.
router-id ADDRESSR1(config-router)#Sets the OSPF router ID by hand.
R1(config-router)# router-id 1.1.1.1
Otherwise chosen as the highest loopback, then the highest active interface. Set it so it cannot move.
passive-interface INTERFACER1(config-router)#Stops OSPF sending hellos out an interface while still advertising its network.
R1(config-router)# passive-interface GigabitEthernet0/1
LAN facing interfaces, where there are no routers to meet and hellos only leak information.
passive-interface defaultR1(config-router)#Makes every interface passive, so the active ones are named explicitly.
R1(config-router)# passive-interface default
Safer by default: say where OSPF may speak rather than where it may not.
default-information originateR1(config-router)#Advertises this router default route into OSPF.
R1(config-router)# default-information originate
The edge router telling the rest of the area where the internet is.
ip ospf cost VALUER1(config-if)#Sets the OSPF cost of the interface directly.
R1(config-if)# ip ospf cost 10
Steering traffic without changing bandwidth. Cost is reference bandwidth over interface bandwidth.
auto-cost reference-bandwidth MBPSR1(config-router)#Changes the reference bandwidth used to work out cost.
R1(config-router)# auto-cost reference-bandwidth 1000
The default of 100 makes every link above 100 Mbps cost 1. Must match on every router.
ip ospf priority VALUER1(config-if)#Influences the DR and BDR election on a multiaccess segment.
R1(config-if)# ip ospf priority 255
A priority of 0 makes a router ineligible. Highest priority wins, then highest router ID.
ip ospf hello-interval SECONDSR1(config-if)#How often hellos are sent on this interface.
R1(config-if)# ip ospf hello-interval 5
Must match the neighbour or the adjacency never forms. A classic exam fault.
ip ospf dead-interval SECONDSR1(config-if)#How long to wait without a hello before declaring a neighbour down.
R1(config-if)# ip ospf dead-interval 20
Also has to match. The default is four times the hello interval.
ip ospf network TYPER1(config-if)#Overrides the OSPF network type, for example point-to-point on an Ethernet link.
R1(config-if)# ip ospf network point-to-point
Skips the DR election on a link with only two routers, which speeds convergence.
show ip ospf neighborR1#Every OSPF neighbour, its state, its role and the interface it was found on.
R1# show ip ospf neighbor
FULL or 2WAY is healthy. Stuck in INIT or EXSTART points at a specific fault.
show ip ospf interfaceR1#Per interface OSPF detail: area, cost, timers, network type, DR and BDR.
R1# show ip ospf interface GigabitEthernet0/0
Where mismatched hello and dead intervals are found when an adjacency will not come up.
show ip ospf interface briefR1#One line per OSPF interface: area, cost, state and neighbour count.
R1# show ip ospf interface brief
A quick view of which interfaces OSPF actually came up on.
show ip ospf databaseR1#The link state database this router holds.
R1# show ip ospf database
Every router in an area must hold the same database. Differences explain odd routing.
clear ip ospf processR1#Restarts the OSPF process and rebuilds every adjacency.
R1# clear ip ospf process
After changing the router ID, which does not take effect until the process restarts.
ipv6 unicast-routingR1(config)#Turns on IPv6 routing, which is off by default.
R1(config)# ipv6 unicast-routing
Without it a router holds IPv6 addresses but forwards nothing and sends no router advertisements.
ipv6 address ADDRESS/PREFIXR1(config-if)#Gives the interface a global unicast IPv6 address.
R1(config-if)# ipv6 address 2001:db8:acad:1::1/64
The prefix length is written on the address, not as a separate mask.
ipv6 address ADDRESS/PREFIX eui-64R1(config-if)#Builds the host half of the address from the interface MAC address.
R1(config-if)# ipv6 address 2001:db8:acad:1::/64 eui-64
The exam asks you to work the EUI-64 result out by hand: split the MAC, insert FFFE, flip bit seven.
ipv6 address ADDRESS link-localR1(config-if)#Sets the link local address rather than letting it be derived.
R1(config-if)# ipv6 address fe80::1 link-local
A memorable next hop. Link local addresses are what IPv6 routing protocols actually use.
ipv6 enableR1(config-if)#Gives the interface a link local address without a global one.
R1(config-if)# ipv6 enable
Enough for a routing protocol to form an adjacency on a link that needs no global address.
ipv6 address autoconfigR1(config-if)#Builds an address from the prefix in a received router advertisement.
R1(config-if)# ipv6 address autoconfig
SLAAC from the router side. How most IPv6 hosts get addressed without DHCP.
ipv6 route PREFIX/LENGTH NEXTHOPR1(config)#Adds a static IPv6 route.
R1(config)# ipv6 route 2001:db8:acad:2::/64 2001:db8:acad:1::2
The IPv6 twin of ip route, and it behaves the same way.
ipv6 route ::/0 NEXTHOPR1(config)#Adds an IPv6 default route.
R1(config)# ipv6 route ::/0 2001:db8:acad:1::2
::/0 is the IPv6 way of writing 0.0.0.0 0.0.0.0.
show ipv6 interface briefR1#One line per interface with its IPv6 addresses and status.
R1# show ipv6 interface brief
Confirming both the link local and global addresses landed where you meant.
show ipv6 routeR1#The IPv6 routing table.
R1# show ipv6 route
Separate from the IPv4 table. A router can route one and not the other.
show ipv6 neighborsR1#The neighbour table, which is what IPv6 has instead of ARP.
R1# show ipv6 neighbors
Neighbour Discovery replaces ARP, and this is where its results are read.
ip dhcp pool NAMER1(config)#Creates a DHCP pool and enters DHCP configuration mode.
R1(config)# ip dhcp pool LAN10
A router acting as the DHCP server for a subnet.
network ADDRESS MASKR1(config)#Inside a DHCP pool, the subnet the pool hands out from.
R1(dhcp-config)# network 192.168.10.0 255.255.255.0
The pool is matched to a subnet by this, so it must match the interface address.
default-router ADDRESSR1(config)#The gateway handed to clients in this pool.
R1(dhcp-config)# default-router 192.168.10.1
Without it clients get an address and still cannot leave the subnet.
dns-server ADDRESSR1(config)#The DNS server handed to clients.
R1(dhcp-config)# dns-server 8.8.8.8
Why a client can ping an address but not a name when it is missing.
domain-name NAMER1(config)#The domain suffix handed to clients.
R1(dhcp-config)# domain-name example.com
Lets clients resolve short names.
lease DAYS HOURS MINUTESR1(config)#How long a client may keep its address.
R1(dhcp-config)# lease 7
Short leases on guest networks, long ones where addresses are plentiful.
ip dhcp excluded-address FIRST LASTR1(config)#Keeps addresses out of the pool.
R1(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10
Reserving the low addresses for the gateway, servers and printers. Set it before the pool.
ip helper-address ADDRESSR1(config-if)#Forwards broadcast client requests to a server on another subnet.
R1(config-if)# ip helper-address 192.168.50.5
DHCP relay. A router does not forward broadcasts, so without this a remote server never hears the DISCOVER.
show ip dhcp bindingR1#Which addresses have been handed out, to which clients, and until when.
R1# show ip dhcp binding
Proving the server is actually leasing rather than just configured.
show ip dhcp poolR1#Pool usage: how many addresses are leased and how many are left.
R1# show ip dhcp pool
Diagnosing an exhausted pool, which looks to users like the network being down.
show ip dhcp conflictR1#Addresses the server found already in use.
R1# show ip dhcp conflict
A static address inside the pool range shows up here.
ip name-server ADDRESSR1(config)#The DNS server the device itself uses.
R1(config)# ip name-server 8.8.8.8
For the router own lookups, which is separate from what it hands to DHCP clients.
ip nat insideR1(config-if)#Marks the interface as the inside of the translation.
R1(config-if)# ip nat inside
NAT does nothing until one interface is inside and another is outside.
ip nat outsideR1(config-if)#Marks the interface as the outside of the translation.
R1(config-if)# ip nat outside
Usually the link to the ISP.
ip nat inside source static LOCAL GLOBALR1(config)#Maps one inside address permanently to one outside address.
R1(config)# ip nat inside source static 192.168.10.5 209.165.200.5
A server that must be reachable from outside on a fixed address.
ip nat inside source list ACL pool POOLR1(config)#Translates addresses matched by an ACL to addresses from a pool, one for one.
R1(config)# ip nat inside source list 1 pool PUBLIC
Dynamic NAT. When the pool is empty, further hosts are not translated at all.
ip nat inside source list ACL interface INTERFACE overloadR1(config)#Translates many inside addresses to the one address on an interface, using ports to tell them apart.
R1(config)# ip nat inside source list 1 interface Serial0/0/0 overload
PAT, which is what almost every real network does. The overload keyword is the whole difference.
ip nat pool NAME FIRST LAST netmask MASKR1(config)#Defines the range of public addresses dynamic NAT may use.
R1(config)# ip nat pool PUBLIC 209.165.200.1 209.165.200.30 netmask 255.255.255.224
Paired with ip nat inside source list.
show ip nat translationsR1#The current translation table, inside and outside, local and global.
R1# show ip nat translations
Reading the four columns correctly is examinable, and the table proves NAT is happening.
show ip nat statisticsR1#Hits, misses, the interfaces in use and the pool state.
R1# show ip nat statistics
Misses with no hits usually means inside and outside are on the wrong interfaces.
clear ip nat translation *R1#Empties the dynamic translation table.
R1# clear ip nat translation *
After changing the configuration, so old entries do not mask the new behaviour.
access-list NUMBER permit SOURCE WILDCARDR1(config)#A numbered standard ACL entry matching on source address only.
R1(config)# access-list 10 permit 192.168.10.0 0.0.0.255
Standard lists are 1 to 99 and 1300 to 1999, and go close to the destination.
access-list NUMBER deny SOURCE WILDCARDR1(config)#A numbered standard ACL entry that denies.
R1(config)# access-list 10 deny 192.168.10.5 0.0.0.0
Order matters: the first match wins, so specific denies go above general permits.
access-list NUMBER permit PROTOCOL SOURCE WILDCARD DEST WILDCARD eq PORTR1(config)#A numbered extended ACL entry matching protocol, both addresses and a port.
R1(config)# access-list 110 permit tcp 192.168.10.0 0.0.0.255 any eq 80
Extended lists are 100 to 199 and 2000 to 2699, and go close to the source.
ip access-list standard NAMER1(config)#Creates a named standard ACL and enters its configuration mode.
R1(config)# ip access-list standard MANAGERS
Named lists can be edited by sequence number, which numbered ones cannot.
ip access-list extended NAMER1(config)#Creates a named extended ACL.
R1(config)# ip access-list extended WEB-ONLY
The modern way to write ACLs, and easier to read six months later.
permit PROTOCOL SOURCE DESTR1(config)#An entry inside a named ACL.
R1(config-ext-nacl)# permit tcp any any eq 443
Inside a named list the entries are written without the access-list prefix.
ip access-group NAME IN|OUTR1(config-if)#Applies an ACL to an interface in one direction.
R1(config-if)# ip access-group WEB-ONLY in
An ACL that is written but never applied does nothing, which is the most common fault.
access-class NAME IN|OUTR1(config-line)#Applies an ACL to the VTY lines rather than to an interface.
R1(config-line)# access-class MANAGERS in
Restricting who may even attempt an SSH session. The only place an ACL is applied to lines.
show access-listsR1#Every ACL with its entries and a match count per line.
R1# show access-lists
The match counters tell you which line is catching traffic, and which never fires.
show ip interface INTERFACER1#Among much else, which ACL is applied to the interface and in which direction.
R1# show ip interface GigabitEthernet0/0
Confirming the list is applied where you think it is.
clear access-list countersR1#Resets the per line match counters.
R1# clear access-list counters
Zero the counters, send one test packet, and see exactly which line matched.
enable secret PASSWORDR1(config)#Sets the privileged EXEC password, stored as a hash.
R1(config)# enable secret StrongPass
Always preferred over enable password, which is reversible. Secret wins if both are set.
enable password PASSWORDR1(config)#The older privileged EXEC password, stored weakly.
R1(config)# enable password WeakPass
Worth knowing only so you can say why enable secret replaces it.
service password-encryptionR1(config)#Obscures plain text passwords in the configuration with a reversible cipher.
R1(config)# service password-encryption
Stops shoulder surfing, not an attacker. Type 7 is trivially reversed.
username NAME secret PASSWORDR1(config)#Creates a local user with a hashed password.
R1(config)# username admin secret StrongPass
Required for SSH, which will not authenticate without a local user or a server.
username NAME privilege LEVEL secret PASSWORDR1(config)#Creates a user who lands at a given privilege level.
R1(config)# username admin privilege 15 secret StrongPass
Level 15 drops straight into privileged EXEC without typing enable.
line console 0R1(config)#Enters configuration for the console port.
R1(config)# line console 0
Where the console password and timeout are set.
line vty FIRST LASTR1(config)#Enters configuration for the virtual terminal lines used by Telnet and SSH.
R1(config)# line vty 0 15
Configure all sixteen or an unconfigured one becomes the way in.
password PASSWORDR1(config-line)#Sets the password for the line.
R1(config-line)# password LinePass
Used with login. Replaced by login local once there are real users.
loginR1(config-line)#Makes the line prompt for the line password.
R1(config-line)# login
The Telnet era pairing. Not enough for SSH, which needs a username.
login localR1(config-line)#Makes the line authenticate against the local user database.
R1(config-line)# login local
One of the five required steps for SSH. Without it SSH has nothing to check against.
transport input sshR1(config-line)#Restricts the lines to SSH, refusing Telnet.
R1(config-line)# transport input ssh
The VTY lines accept both by default, so without this the device still answers unencrypted Telnet.
transport input noneR1(config-line)#Refuses all remote access on those lines.
R1(config-line)# transport input none
Console only management, where remote access is not wanted at all.
crypto key generate rsaR1(config)#Generates the RSA key pair SSH encrypts with.
R1(config)# crypto key generate rsa modulus 1024
Needs a hostname and domain name first, since the key is named after them. 1024 bits or more for SSH version 2.
crypto key zeroize rsaR1(config)#Deletes the RSA keys, which disables SSH.
R1(config)# crypto key zeroize rsa
Before regenerating keys after a hostname change.
ip ssh version 2R1(config)#Refuses SSH version 1, which has known weaknesses.
R1(config)# ip ssh version 2
Version 1 should never be left available.
exec-timeout MINUTES SECONDSR1(config-line)#Closes an idle session after a set time.
R1(config-line)# exec-timeout 5 0
An unattended terminal should not stay logged in. 0 0 disables the timeout entirely.
logging synchronousR1(config-line)#Stops log messages interrupting what you are typing.
R1(config-line)# logging synchronous
Quality of life, and the first thing most engineers set on the console.
switchport port-securityR1(config-if)#Turns on port security, limiting which MAC addresses may use the port.
S1(config-if)# switchport port-security
The port must already be a static access or trunk port, not dynamic.
switchport port-security maximum NUMBERR1(config-if)#How many MAC addresses the port will accept.
S1(config-if)# switchport port-security maximum 2
Two where a PC sits behind an IP phone. The default is one.
switchport port-security mac-address stickyR1(config-if)#Learns the connected MAC address and writes it into the configuration.
S1(config-if)# switchport port-security mac-address sticky
Avoids typing addresses by hand, but it is only saved if you save the configuration.
switchport port-security violation MODER1(config-if)#What to do on a violation: protect, restrict or shutdown.
S1(config-if)# switchport port-security violation restrict
The three modes differ in whether they log and whether they disable the port. Examinable.
show port-security interface INTERFACER1#Port security state, the violation count and the last offending address.
S1# show port-security interface FastEthernet0/1
Where an err-disabled port explains itself.
ip dhcp snoopingR1(config)#Turns on DHCP snooping, which blocks rogue DHCP servers.
S1(config)# ip dhcp snooping
Every port is untrusted until told otherwise, so the uplink must be trusted or everything breaks.
ip dhcp snooping vlan LISTR1(config)#Which VLANs snooping applies to.
S1(config)# ip dhcp snooping vlan 10,20
Snooping does nothing until it is enabled on a VLAN.
ip dhcp snooping trustR1(config-if)#Marks the port as one a DHCP server may legitimately answer on.
S1(config-if)# ip dhcp snooping trust
The uplink towards the real server. Only that one, which is the point of the feature.
show ip dhcp snooping bindingR1#The table of addresses snooping has seen leased, and on which port.
S1# show ip dhcp snooping binding
Also what Dynamic ARP Inspection checks against.
ip arp inspection vlan LISTR1(config)#Inspects ARP in these VLANs against the DHCP snooping table.
S1(config)# ip arp inspection vlan 1
The answer to ARP spoofing. There is no separate on switch: naming the VLAN is how it is turned on.
ip arp inspection trustR1(config-if)#Marks the port as one whose ARP is believed without checking.
S1(config-if)# ip arp inspection trust
The uplink, and anything that was never a DHCP client. Without it inspection stops the router too.
show ip arp inspectionR1#Which VLANs are inspected and which ports are trusted.
S1# show ip arp inspection
Where to look when a host that was addressed by hand stops being able to talk.
ip verify sourceR1(config-if)#Passes only the address the snooping table says was leased on this port.
S1(config-if)# ip verify source
Stops a host using an address that is not its own. Access ports only, and never an uplink.
ip source binding MAC vlan ID IP interface IFR1(config)#Writes a binding down by hand, for a host that does not use DHCP.
S1(config)# ip source binding 00D0.BA12.3456 vlan 1 192.168.10.50 interface Fa0/2
The printer and the server. ARP inspection and source guard both read this table.
show ip verify sourceR1#Which ports are guarded and which address each one permits.
S1# show ip verify source
deny-all against a port means it has no binding to permit, so it is passing nothing.
mls qos trust dscpR1(config-if)#Accepts the DSCP marking arriving on the port rather than rewriting it.
S1(config-if)# mls qos trust dscp
A trust boundary: markings from a phone are trusted, markings from a PC are not.
class-map NAMER1(config)#Defines what traffic a QoS policy will act on.
R1(config)# class-map VOICE
The first of the three steps: classify, then mark or queue, then apply.
policy-map NAMER1(config)#Defines what to do with the traffic a class map matched.
R1(config)# policy-map WAN-OUT
Where marking, priority queuing, shaping and policing are set.
service-policy DIRECTION NAMER1(config-if)#Applies a policy map to an interface.
R1(config-if)# service-policy output WAN-OUT
Like an ACL, a policy that is never applied does nothing.
priority PERCENTR1(config)#Gives a class a strict priority queue, which is what voice needs.
R1(config-pmap-c)# priority percent 20
Low latency queuing. Voice cannot wait behind a file transfer.
bandwidth PERCENTR1(config)#Guarantees a class a share of the link when it is congested.
R1(config-pmap-c)# bandwidth percent 30
A guarantee rather than a ceiling. Unused share is available to others.
set dscp VALUER1(config)#Marks matched traffic with a DSCP value.
R1(config-pmap-c)# set dscp ef
EF is expedited forwarding, the marking voice carries. Marking should happen as close to the source as possible.
show policy-map interface INTERFACER1#What the policy is doing: matched packets, queue depth, drops.
R1# show policy-map interface Serial0/0/0
The only way to tell whether a QoS policy is actually helping.
ntp server ADDRESSR1(config)#Points the device at an NTP server for its clock.
R1(config)# ntp server 192.168.1.10
Logs across devices are only comparable if their clocks agree.
ntp master STRATUMR1(config)#Makes this device an NTP source for others.
R1(config)# ntp master 3
A lab or isolated network with no internet time source.
show ntp statusR1#Whether the clock is synchronised, to what, and at which stratum.
R1# show ntp status
Synchronised is the word to look for. Unsynchronised means the clock is still drifting.
show ntp associationsR1#The servers this device is talking to and the quality of each.
R1# show ntp associations
The asterisk marks the server actually being used.
logging host ADDRESSR1(config)#Sends syslog messages to a collector.
R1(config)# logging host 192.168.1.20
Logs that live only on the device are lost when the device is.
logging trap LEVELR1(config)#How severe a message must be before it is sent.
R1(config)# logging trap warnings
The eight levels, 0 emergency to 7 debugging, are examinable in order.
logging buffered SIZER1(config)#Keeps log messages in memory so they can be read back.
R1(config)# logging buffered 16384
Read with show logging. Without it, console messages scroll away.
service timestamps log datetime msecR1(config)#Stamps every log message with the date and time to the millisecond.
R1(config)# service timestamps log datetime msec
Without it log entries are stamped with uptime, which is useless for comparing two devices.
show loggingR1#The logging configuration and the buffered messages.
R1# show logging
The first place to look after something broke while you were not watching.
snmp-server community STRING RO|RWR1(config)#Sets an SNMP community string and whether it may write.
R1(config)# snmp-server community Monitor1 RO
Versions 1 and 2c send this in clear. Version 3 is the one with real security.
snmp-server host ADDRESS version VERSION STRINGR1(config)#Where to send SNMP traps.
R1(config)# snmp-server host 192.168.1.30 version 2c Monitor1
Traps are the device telling the manager, rather than the manager polling.
cdp runR1(config)#Turns Cisco Discovery Protocol on for the device.
R1(config)# cdp run
On by default. no cdp run turns it off everywhere, which is the usual hardening step.
no cdp enableR1(config-if)#Turns CDP off on one interface.
R1(config-if)# no cdp enable
Interfaces facing anyone outside your control should not advertise your model and IOS version.
show cdp neighborsR1#Directly connected Cisco devices, with local and remote port.
R1# show cdp neighbors
Building a topology map with no documentation. detail adds addresses and IOS versions.
show cdp neighbors detailR1#The same neighbours with their addresses, platform and IOS version.
R1# show cdp neighbors detail
Finding a neighbour management address when you have no other record of it.
lldp runR1(config)#Turns on LLDP, the vendor neutral equivalent of CDP.
R1(config)# lldp run
Off by default, unlike CDP. The one to use in a mixed vendor network.
show lldp neighborsR1#Neighbours discovered by LLDP.
R1# show lldp neighbors
Where CDP shows nothing because the neighbour is not a Cisco device.
show ap summaryR1#On a wireless controller, every access point it has joined.
WLC# show ap summary
Confirming an AP found its controller, which is most of wireless troubleshooting.
show wlan summaryR1#The WLANs configured on the controller, with their SSIDs and status.
WLC# show wlan summary
Checking an SSID is enabled and mapped to the interface you expect.
show client summaryR1#Wireless clients, which AP each is on and which WLAN.
WLC# show client summary
Where a client that says it is connected but has no address is traced from.
capwap ap controller ip address ADDRESSR1#Tells a lightweight access point where its controller is.
AP# capwap ap controller ip address 192.168.1.50
When an AP cannot find the controller by DHCP option 43 or DNS.
ping ADDRESSR1>Tests reachability and round trip time.
R1# ping 192.168.20.1
Five exclamation marks is success. A full stop is a timeout, U is unreachable.
pingR1#Extended ping, which prompts for source address, count, size and more.
R1# ping
Testing from the right source interface, which is what proves a return route exists.
traceroute ADDRESSR1>Shows the hops to a destination.
R1# traceroute 8.8.8.8
Where a path stops tells you which router has the missing route.
telnet ADDRESSR1>Opens a Telnet session.
R1# telnet 192.168.1.1
Worth knowing mainly so you can explain why SSH replaced it. Unencrypted throughout.
ssh -l USER ADDRESSR1>Opens an SSH session from the device.
R1# ssh -l admin 192.168.1.1
Testing from the device itself that SSH on another device works.
show ip sshR1#The SSH version in use and its timeouts.
R1# show ip ssh
Confirming version 2 is enforced and the keys actually generated.
show sshR1#The SSH sessions currently connected.
R1# show ssh
Seeing who is logged in over SSH right now.
show usersR1#Every connected session, console and remote.
R1# show users
Finding out you are not the only person configuring the device.
show mac address-tableR1#What the switch has learned: MAC address, VLAN, type and port.
S1# show mac address-table
Tracing which port a device is on. Dynamic entries age out, static ones do not.
clear mac address-table dynamicR1#Empties the learned entries so they are relearned.
S1# clear mac address-table dynamic
After moving a device, when the old port is still cached.
debug ip packetR1#Prints a line per packet the router handles.
R1# debug ip packet
Powerful and dangerous: on a busy router it can overwhelm the CPU. Always pair with undebug all.
undebug allR1#Turns every debug off.
R1# undebug all
The command to know before you turn a debug on. Often typed as u all.
show processes cpuR1#CPU use overall and by process.
R1# show processes cpu sorted
Finding what is loading a device that has gone slow.
show flashR1#What is stored in flash, including the IOS images.
R1# show flash
Checking there is room for a new image, and which image is present.
show COMMAND | include TEXTR1#Filters output down to the lines containing some text.
R1# show interface GigabitEthernet0/0 | include MTU
Finding one field in output that runs to four screens. The pipe works on any show command.
show COMMAND | exclude TEXTR1#Filters output down to the lines not containing some text.
R1# show ip interface brief | exclude unassigned
Hiding the interfaces with no address so the ones that matter are visible.
show COMMAND | begin TEXTR1#Starts the output at the first line containing some text.
R1# show running-config | begin interface
Jumping straight to the interfaces in a long configuration.
show COMMAND | section TEXTR1#Shows whole configuration sections whose heading matches.
R1# show running-config | section ospf
Pulling one feature out of a configuration without reading the rest.
show historyR1>The commands entered in this session.
R1# show history
Recovering the command you got right two minutes ago.
router ripR1(config)#Beyond the blueprintStarts the RIP routing process.
R1(config)# router rip
Removed from the 200-301 blueprint, but all over older question banks.
version 2R1(config-router)#Beyond the blueprintSwitches RIP to version 2, which carries subnet masks.
R1(config-router)# version 2
Version 1 is classful and cannot support VLSM. This is the line that fixes it.
no auto-summaryR1(config-router)#Beyond the blueprintStops RIP summarising to classful boundaries.
R1(config-router)# no auto-summary
Without it, discontiguous networks break even under version 2.
show ip rip databaseR1#Beyond the blueprintThe networks RIP knows and where it learned them.
R1# show ip rip database
Reading RIP behaviour in the older material.
router eigrp ASR1(config)#Beyond the blueprintStarts an EIGRP process in an autonomous system.
R1(config)# router eigrp 100
Off the current blueprint. The AS number must match between neighbours.
show ip eigrp neighborsR1#Beyond the blueprintEIGRP adjacencies.
R1# show ip eigrp neighbors
The EIGRP equivalent of show ip ospf neighbor, in older material.
show ip eigrp topologyR1#Beyond the blueprintEvery path EIGRP knows to each network, not just the ones in the routing table.
R1# show ip eigrp topology
Off the current blueprint. Successors are the paths that got installed; a feasible successor is a backup EIGRP can switch to without asking anybody, because that neighbour cost to the destination is lower than yours.
encapsulation frame-relayR1(config-if)#Beyond the blueprintSets Frame Relay encapsulation on a serial interface.
R1(config-if)# encapsulation frame-relay
Long retired in practice, and still present in this course older material.
frame-relay interface-dlci DLCIR1(config-subif)#Beyond the blueprintMaps a DLCI to a subinterface.
R1(config-subif)# frame-relay interface-dlci 201
A DLCI identifies the circuit locally, which is the detail these questions turn on.
frame-relay map ip ADDRESS DLCI broadcastR1(config-if)#Beyond the blueprintMaps a remote address to a DLCI by hand.
R1(config-if)# frame-relay map ip 10.0.0.2 201 broadcast
The broadcast keyword is what lets routing protocols work across the circuit.
show frame-relay pvcR1#Beyond the blueprintThe permanent virtual circuits, their DLCIs and status.
R1# show frame-relay pvc
ACTIVE, INACTIVE and DELETED each mean something specific and get asked about.
show frame-relay mapR1#Beyond the blueprintThe address to DLCI mappings in use.
R1# show frame-relay map
Confirming whether a mapping was learned by Inverse ARP or configured by hand.
clock rate BPSR1(config-if)#Beyond the blueprintSupplies clocking on the DCE end of a back to back serial link.
R1(config-if)# clock rate 64000
Only the DCE end needs it, and show controllers says which end that is.
bandwidth KBPSR1(config-if)#Beyond the blueprintTells routing protocols how fast the link is, without changing it.
R1(config-if)# bandwidth 64
Affects OSPF cost and EIGRP metric. It is documentation, not a throttle.
vtp mode MODER1(config)#Beyond the blueprintSets VTP to server, client or transparent.
S1(config)# vtp mode transparent
Off the current blueprint. A client with a higher revision number can still wipe a VLAN database.
vtp domain NAMER1(config)#Beyond the blueprintSets the VTP domain, which switches must share to exchange VLANs.
S1(config)# vtp domain CAMPUS
Older material, and the cause of some memorable outages.
standby GROUP ip ADDRESSR1(config-if)#Beyond the blueprintConfigures HSRP with a virtual gateway address.
R1(config-if)# standby 1 ip 192.168.1.1
First hop redundancy. 200-301 asks about the concept more than the configuration.
standby GROUP priority VALUER1(config-if)#Beyond the blueprintSets which router should be the active HSRP gateway.
R1(config-if)# standby 1 priority 110
Highest priority wins, with preempt needed for it to take over from a working router.
show standby briefR1#Beyond the blueprintHSRP groups, which router is active and which is standby.
R1# show standby brief
Confirming failover landed where it was meant to.