Cisco CCNA Master Reference
Cisco IOS and IOS XE • CCNA 200-301 v1.1 study manual

CLI Configuration Use Cases

Ordered tutorials for building a Cisco lab or small routed and switched network.

Procedure order: Configure the smallest required scope, verify the expected result, test forwarding, then save. Use the Troubleshooting page when a verification step fails.
Stage 1: Prepare the device and protect management accessStart with identity, credentials, SSH, and a rollback plan.

1. Create a safe baseline on a new lab switch

Use when: Use this before normal switching configuration.

Before you start: Console access and a planned hostname, domain name, and local administrator secret.

Warning: Replace every placeholder. Do not use shared or weak lab secrets on production equipment.
StepCommandWhy you use it
1enableEnter privileged EXEC mode.
2configure terminalEnter global configuration mode.
3hostname SW1Set the hostname and prompt.
4no ip domain-lookupPrevent lab typos from causing long DNS lookup delays.
5enable secret <ENABLE-SECRET>Protect privileged EXEC mode.
6username netadmin privilege 15 secret <ADMIN-SECRET>Create a local administrator.
7service password-encryptionObscure remaining plaintext line passwords in the configuration.
8banner motd #Authorized access only.#Display an access warning.
9ip domain name lab.exampleSet the domain needed for RSA key generation.
10line console 0Enter console-line configuration.
11logging synchronousRedraw commands after console log messages.
12exec-timeout 10 0Disconnect an idle console session after ten minutes.
13endReturn to privileged EXEC mode.
14copy running-config startup-configSave the verified baseline.

Verification

  • show running-config | include hostname|username|domain
  • show startup-config
Stage 2: Build the Layer 2 networkCreate VLANs, access ports, trunks, STP behavior, and EtherChannels.

2. Configure a user access port

Use when: Use this for one workstation, printer, camera, or other endpoint in a single data VLAN.

Before you start: The VLAN ID and endpoint port are known. The port does not connect to another switch or bridge.

Warning: Do not enable PortFast and BPDU Guard on a normal switch-to-switch link.
StepCommandWhy you use it
1vlan 20Create VLAN 20 if it does not already exist.
2name USERSGive the VLAN a clear name.
3interface gigabitEthernet1/0/10Select the endpoint port.
4description USER-PC-23Document the connection.
5switchport mode accessForce static access mode.
6switchport access vlan 20Assign untagged data traffic to VLAN 20.
7spanning-tree portfastMove an edge port to forwarding quickly.
8spanning-tree bpduguard enableError-disable the port if it receives a BPDU.
9no shutdownEnable the port.

Verification

  • show interfaces gi1/0/10 switchport
  • show vlan brief
  • show spanning-tree interface gi1/0/10 detail
  • show mac address-table interface gi1/0/10

Rollback: default interface gigabitEthernet1/0/10

3. Configure a phone and attached PC port

Use when: Use this when an IP phone tags voice traffic and passes untagged PC traffic.

Before you start: Data VLAN 20 and voice VLAN 30 exist or are approved.

StepCommandWhy you use it
1vlan 20Create the data VLAN.
2name USERSName the data VLAN.
3vlan 30Create the voice VLAN.
4name VOICEName the voice VLAN.
5interface gigabitEthernet1/0/11Select the phone port.
6switchport mode accessUse access mode for endpoint operation.
7switchport access vlan 20Assign untagged PC traffic to VLAN 20.
8switchport voice vlan 30Advertise VLAN 30 to the supported phone.
9spanning-tree portfastAllow quick edge convergence.
10spanning-tree bpduguard enableProtect the edge from unexpected BPDUs.

Verification

  • show interfaces gi1/0/11 switchport
  • show cdp neighbors detail
  • show lldp neighbors detail

Rollback: default interface gigabitEthernet1/0/11

4. Configure a static 802.1Q trunk

Use when: Use this between managed switches or between a switch and a router, firewall, access point, or hypervisor that expects tagged VLANs.

Before you start: Both ends agree on the native VLAN and allowed VLAN list.

Warning: The allowed-vlan command replaces the existing list unless you use the add keyword.
StepCommandWhy you use it
1interface gigabitEthernet1/0/48Select the uplink.
2description TRUNK-TO-SW2Document the neighbor.
3switchport mode trunkForce trunk operation.
4switchport trunk native vlan 999Place untagged traffic in VLAN 999.
5switchport trunk allowed vlan 10,20,30,999Limit the trunk to required VLANs.
6switchport nonegotiateDisable DTP after configuring a static trunk.
7no shutdownEnable the link.

Verification

  • show interfaces trunk
  • show interfaces gi1/0/48 switchport
  • show cdp neighbors detail

Rollback: default interface gigabitEthernet1/0/48

5. Enable Rapid PVST+ and set root placement

Use when: Use this to make STP behavior intentional instead of relying on default bridge priorities.

Before you start: Identify the primary and secondary distribution switches. Confirm all switches support Rapid PVST+.

Warning: Changing STP mode or root placement affects the entire Layer 2 topology. Make the change during a controlled window.
StepCommandWhy you use it
1spanning-tree mode rapid-pvstEnable Rapid PVST+ globally.
2spanning-tree vlan 10,20,30 root primaryMake this switch the likely root for the listed VLANs.
3spanning-tree portfast defaultEnable PortFast by default on nontrunking access ports.
4spanning-tree portfast bpduguard defaultEnable BPDU Guard on PortFast-enabled ports.
5interface gigabitEthernet1/0/48Select a downstream switch-facing port when root protection is required.
6spanning-tree guard rootPrevent the downstream device from becoming root through this port.

Verification

  • show spanning-tree summary
  • show spanning-tree vlan 10
  • show spanning-tree inconsistentports

Rollback: Remove the specific spanning-tree commands with their no forms. Do not change STP mode during an outage without a planned migration.

6. Build an LACP EtherChannel trunk

Use when: Use this to combine parallel switch links into one logical link with negotiation.

Before you start: Member ports have matching speed, duplex, VLAN, trunk, and MTU settings on both switches.

Warning: Do not configure mismatched members. A static mode on bundle can create loops when the other side is not bundled.
StepCommandWhy you use it
1interface range gigabitEthernet1/0/47-48Select both physical members.
2channel-group 1 mode activeCreate Port-channel1 and actively negotiate LACP.
3interface port-channel 1Configure the logical bundle.
4switchport mode trunkMake the bundle a trunk.
5switchport trunk native vlan 999Set the shared native VLAN.
6switchport trunk allowed vlan 10,20,30,999Set the shared allowed VLANs.

Verification

  • show etherchannel summary
  • show lacp neighbor
  • show interfaces port-channel 1
  • show interfaces trunk

Rollback: Remove channel-group 1 from each member, then use no interface port-channel 1.

Stage 3: Add Layer 3 gateways and routingConfigure management addressing, SVIs, router-on-a-stick, static routes, and OSPF.

7. Configure a management SVI on a Layer 2 switch

Use when: Use this to give a Layer 2 switch an IP address for SSH, NTP, SNMP, and syslog.

Before you start: Management VLAN 99 reaches the management gateway. IP routing remains disabled on the switch.

Warning: An SVI stays down until its VLAN exists and at least one Layer 2 port in the VLAN is operational.
StepCommandWhy you use it
1vlan 99Create the management VLAN.
2name MANAGEMENTName the management VLAN.
3interface vlan 99Create or select the SVI.
4ip address 10.99.0.11 255.255.255.0Assign the switch management address.
5no shutdownAdministratively enable the SVI.
6ip default-gateway 10.99.0.1Set the gateway used by a non-routing switch.

Verification

  • show ip interface brief
  • show vlan brief
  • ping 10.99.0.1
  • show ip arp

8. Configure inter-VLAN routing on a multilayer switch

Use when: Use this when the switch should route between VLANs using SVIs.

Before you start: The switch model and license support Layer 3 routing.

Warning: Enabling routing changes how the switch handles its default gateway. Use a default route instead of ip default-gateway after ip routing is enabled.
StepCommandWhy you use it
1ip routingEnable IPv4 packet forwarding.
2vlan 10Create the server VLAN.
3vlan 20Create the user VLAN.
4interface vlan 10Select the VLAN 10 SVI.
5ip address 10.10.0.1 255.255.255.0Set the VLAN 10 default gateway.
6no shutdownEnable the SVI.
7interface vlan 20Select the VLAN 20 SVI.
8ip address 10.20.0.1 255.255.255.0Set the VLAN 20 default gateway.
9no shutdownEnable the SVI.

Verification

  • show ip interface brief
  • show ip route connected
  • show vlan brief
  • ping between test hosts in the two VLANs

Rollback: Remove ip routing only after confirming no routed functions depend on it.

9. Configure router-on-a-stick

Use when: Use this when one router interface routes several switch VLANs through 802.1Q subinterfaces.

Before you start: The switch-facing port is a trunk and permits VLANs 10 and 20.

StepCommandWhy you use it
1interface gigabitEthernet0/0/0Select the physical router link.
2no shutdownEnable the physical interface.
3interface gigabitEthernet0/0/0.10Create the VLAN 10 subinterface.
4encapsulation dot1Q 10Associate the subinterface with VLAN 10.
5ip address 10.10.0.1 255.255.255.0Set the VLAN 10 gateway.
6interface gigabitEthernet0/0/0.20Create the VLAN 20 subinterface.
7encapsulation dot1Q 20Associate the subinterface with VLAN 20.
8ip address 10.20.0.1 255.255.255.0Set the VLAN 20 gateway.

Verification

  • show ip interface brief
  • show interfaces gi0/0/0.10
  • show ip route connected
  • show interfaces trunk on the switch

Rollback: Use no interface gigabitEthernet0/0/0.10 and no interface gigabitEthernet0/0/0.20.

10. Configure a default route and floating backup

Use when: Use this when the router has a primary default next hop and a less-preferred backup.

Before you start: Both next hops are reachable on directly connected networks.

Warning: A next-hop route can stay installed when a failure occurs farther upstream. Use IP SLA and object tracking for stronger failover detection.
StepCommandWhy you use it
1ip route 0.0.0.0 0.0.0.0 203.0.113.1Install the primary default route with the default administrative distance.
2ip route 0.0.0.0 0.0.0.0 198.51.100.1 200Install a floating backup with a higher administrative distance.

Verification

  • show ip route 0.0.0.0
  • ping each next hop
  • traceroute a remote test address

Rollback: Use the no form of each exact ip route command.

11. Configure single-area OSPF

Use when: Use this to exchange routes between routers in area 0 while keeping user LANs passive.

Before you start: Transit addressing works and each router has a unique router ID.

Warning: Changing a router ID on a live process can require clear ip ospf process, which drops all adjacencies.
StepCommandWhy you use it
1router ospf 1Create or enter OSPF process 1.
2router-id 1.1.1.1Set a stable unique router ID.
3passive-interface defaultStop OSPF hellos on all interfaces by default.
4no passive-interface gigabitEthernet0/0/1Allow neighbor formation only on the transit interface.
5network 10.12.0.0 0.0.0.3 area 0Enable OSPF on the transit /30.
6network 10.10.0.0 0.0.0.255 area 0Advertise and enable OSPF on the user LAN interface, which remains passive.

Verification

  • show ip ospf neighbor
  • show ip ospf interface brief
  • show ip route ospf
  • show ip protocols

Rollback: Use no router ospf 1 only when you intend to remove the entire process.

Stage 4: Add IP services and traffic policyConfigure DHCP, relay, NAT, ACLs, and Layer 2 security.

12. Configure a Cisco IOS DHCP server scope

Use when: Use this in a small branch or lab where the router provides DHCP.

Before you start: The gateway interface is configured and all static addresses are known.

StepCommandWhy you use it
1ip dhcp excluded-address 10.20.0.1 10.20.0.20Reserve the gateway and static-address range.
2ip dhcp pool VLAN20-USERSCreate and enter the DHCP pool.
3network 10.20.0.0 255.255.255.0Define the served subnet.
4default-router 10.20.0.1Provide DHCP option 3.
5dns-server 10.0.0.53 1.1.1.1Provide DHCP option 6.
6domain-name lab.exampleProvide the client DNS suffix.
7lease 7Set a seven-day lease.

Verification

  • show ip dhcp pool
  • show ip dhcp binding
  • show ip dhcp conflict

Rollback: Use no ip dhcp pool VLAN20-USERS and remove the exclusion if no other pool needs it.

13. Configure DHCP relay

Use when: Use this when clients and the DHCP server are on different IP networks.

Before you start: Routing works between the client gateway and DHCP server 10.0.0.50.

Warning: Place the helper on the client gateway interface, not the server-facing interface.
StepCommandWhy you use it
1interface vlan 20Select the client-facing Layer 3 interface.
2ip helper-address 10.0.0.50Relay supported UDP broadcasts, including DHCP, to the server.

Verification

  • show running-config interface vlan 20
  • ping 10.0.0.50 source vlan 20
  • review DHCP server logs during a client renewal

Rollback: no ip helper-address 10.0.0.50

14. Configure Internet PAT using the WAN interface address

Use when: Use this when many inside hosts share one public interface address.

Before you start: Inside and outside interfaces are correctly identified and a default route exists.

Warning: Clearing translations breaks active sessions. Verify the inside and outside directions before troubleshooting the ACL.
StepCommandWhy you use it
1access-list 1 permit 10.0.0.0 0.255.255.255Match inside addresses that should be translated.
2interface gigabitEthernet0/0/1Select the LAN interface.
3ip nat insideMark the LAN side of the NAT boundary.
4interface gigabitEthernet0/0/0Select the WAN interface.
5ip nat outsideMark the WAN side of the NAT boundary.
6ip nat inside source list 1 interface gigabitEthernet0/0/0 overloadTranslate matched sources through the WAN address and use ports to keep sessions unique.

Verification

  • show ip nat translations
  • show ip nat statistics
  • show access-lists 1

Rollback: Remove the NAT rule, then remove ip nat inside and ip nat outside from the interfaces.

15. Build and apply an extended IPv4 ACL

Use when: Use this to allow HTTPS from VLAN 20 to one server, block other server-subnet access, and allow other destinations.

Before you start: The intended traffic matrix and application ports are documented.

Warning: Always account for the implicit deny at the end of every ACL. Keep an existing management session open during remote policy changes.
StepCommandWhy you use it
1ip access-list extended VLAN20-INCreate and enter a named extended ACL.
210 permit tcp 10.20.0.0 0.0.0.255 host 10.50.0.10 eq 443Allow HTTPS to the application server.
320 deny ip 10.20.0.0 0.0.0.255 10.50.0.0 0.0.0.255 logBlock and log other access to the server subnet.
430 permit ip 10.20.0.0 0.0.0.255 anyAllow the remaining traffic. This avoids the implicit deny for other destinations.
5interface vlan 20Select the source VLAN gateway.
6ip access-group VLAN20-IN inFilter packets as they enter the SVI from VLAN 20.

Verification

  • show access-lists VLAN20-IN
  • show ip interface vlan 20
  • test both an allowed and denied connection

Rollback: Remove the interface ip access-group first, then remove the ACL.

16. Enable SSH-only management

Use when: Use this to replace Telnet and authenticate against the local user database.

Before you start: A reachable management IP, hostname, domain name, local user, and secure source subnet are known.

Warning: A wrong ACL, AAA rule, or VTY command can lock out remote administrators.
StepCommandWhy you use it
1hostname R1Set the hostname used in RSA key identity.
2ip domain name lab.exampleSet the domain required by common RSA key-generation syntax.
3username netadmin privilege 15 secret <ADMIN-SECRET>Create a local administrator.
4crypto key generate rsa modulus 2048Generate RSA keys and start the SSH server.
5ip ssh version 2Require SSH version 2.
6ip access-list standard MGMT-SOURCESCreate an ACL for approved management sources.
710 permit 10.99.0.0 0.0.0.255Allow the management subnet.
8line vty 0 15Select remote-access lines.
9login localAuthenticate with the local user database.
10transport input sshAllow SSH and block inbound Telnet.
11access-class MGMT-SOURCES inRestrict VTY connection sources.
12exec-timeout 10 0Disconnect idle sessions.

Verification

  • show ip ssh
  • show ssh
  • show users
  • open a second SSH session before ending the first

Rollback: Remove the VTY access-class or transport restriction only through a working console or verified alternate session.

17. Configure sticky port security

Use when: Use this on a stable access port where a small known number of endpoint MAC addresses is expected.

Before you start: The port is a static access port and the device-move process is understood.

Warning: Sticky entries can block replacement devices, docks, phones, or virtualized workloads until you remove or update the learned addresses.
StepCommandWhy you use it
1interface gigabitEthernet1/0/10Select the endpoint port.
2switchport mode accessPort security requires an eligible Layer 2 switchport.
3switchport port-securityEnable port security.
4switchport port-security maximum 2Allow two secure MAC addresses, such as a phone and PC.
5switchport port-security mac-address stickyLearn secure MAC addresses into running-config.
6switchport port-security violation restrictDrop violating traffic and record the violation without shutting the port.

Verification

  • show port-security interface gi1/0/10
  • show port-security address
  • show logging

Rollback: Remove port-security commands or use default interface gi1/0/10.

18. Enable DHCP snooping and Dynamic ARP Inspection

Use when: Use this to block rogue DHCP replies and ARP spoofing in an access VLAN.

Before you start: The trusted path toward the legitimate DHCP server is known. Valid snooping bindings will exist for clients.

Warning: DAI can block valid traffic when bindings are missing, such as statically addressed hosts without an ARP ACL.
StepCommandWhy you use it
1ip dhcp snoopingEnable DHCP snooping globally.
2ip dhcp snooping vlan 20Enable snooping in VLAN 20.
3interface gigabitEthernet1/0/48Select the trusted uplink.
4ip dhcp snooping trustAllow DHCP server replies on the uplink.
5ip arp inspection trustTrust ARP on the uplink.
6interface range gigabitEthernet1/0/1-47Select untrusted access ports.
7ip dhcp snooping limit rate 15Rate-limit DHCP messages on access ports.
8ip arp inspection vlan 20Enable DAI using snooping bindings in VLAN 20.

Verification

  • show ip dhcp snooping
  • show ip dhcp snooping binding
  • show ip arp inspection
  • show logging

Rollback: Disable DAI first if legitimate ARP is blocked, then review snooping trust and bindings.

Stage 5: Validate, save, back up, and resetUse safe change controls and preserve a known-good configuration.

20. Use a timed reload as a remote-change safety net

Use when: Use this before a remote change that could break routing, ACL, AAA, VLAN, or management access.

Before you start: The startup-config contains a known-good state and the device can reload safely if access is lost.

Warning: Do not save an unverified broken configuration before the scheduled reload. Confirm the platform supports the planned rollback behavior.
StepCommandWhy you use it
1copy running-config startup-configSave the known-good pre-change state.
2copy running-config flash:prechange.cfgCreate an extra local backup.
3reload in 10Schedule a reload in ten minutes.
4configure terminalMake the intended change.
5reload cancelCancel the reload only after all verification succeeds.
6copy running-config startup-configSave the verified new state.

Verification

  • show reload
  • open a second management session
  • verify routing, management, and required application paths

21. Save and back up the configuration

Use when: Use this after successful verification.

Before you start: The change is approved and no rollback timer remains active.

Warning: TFTP is unencrypted. Prefer SCP or another protected management path.
StepCommandWhy you use it
1show running-configReview the active state.
2copy running-config startup-configSave for the next boot.
3copy running-config flash:postchange.cfgKeep a local named copy.
4copy running-config scp:Send an encrypted off-device backup where supported.

Verification

  • show startup-config
  • dir flash:
  • verify the remote backup exists

22. Reset a lab switch

Use when: Use this only to return an isolated lab switch to an unconfigured state.

Before you start: The device is disconnected from production and no configuration or VLAN data must be preserved.

Warning: Destructive. Platform reset steps vary. Stack members, install mode, licenses, and provisioning files can require additional procedures.
StepCommandWhy you use it
1erase startup-configDelete the saved startup configuration.
2delete flash:vlan.datDelete the persistent VLAN database on platforms that use vlan.dat.
3reloadRestart the switch.
4noDecline to save when the reload prompt asks about the current configuration.

Verification

  • After reload, confirm the initial configuration dialog or an empty startup configuration.