10.4.2 Lab: Secure Access To A Switch

18 min read

Introduction – Why Securing Switch Access Matters

In any enterprise network, a switch is the central point where countless devices converge, making it a prime target for unauthorized access. Now, the 10. But 4. Day to day, 2 Lab: Secure Access to a Switch is designed to teach students and network professionals how to harden a switch against common attacks, enforce strong authentication, and maintain audit trails. By the end of this lab, you will be able to configure secure console, Telnet/SSH, and SNMP access, implement role‑based privileges, and verify that your changes meet industry‑best practices such as those outlined in the CIS Cisco IOS Benchmark Surprisingly effective..


Lab Objectives

  1. Configure a secure console line – set a password, enable login logging, and apply a timeout.
  2. Replace Telnet with SSH – generate RSA keys, create local user accounts, and enforce SSH version 2.
  3. Implement AAA (Authentication, Authorization, Accounting) – use local database and optional RADIUS/TACACS+ fallback.
  4. Restrict management plane access – apply VLAN‑based ACLs to limit which hosts can reach the switch’s IP address.
  5. Secure SNMP – switch from community strings to SNMPv3 with authentication and encryption.
  6. Enable logging and monitoring – send logs to a syslog server and enable privileged‑exec timestamps.
  7. Validate the configuration – test connectivity, verify that insecure protocols are blocked, and review log entries.

Required Equipment and Prerequisites

Item Minimum Specification
Cisco Catalyst switch (e.g., 2960, 3560) IOS 12.Even so, 2(55)SE or later
PC or laptop with terminal emulator (PuTTY, Tera Term) Windows/macOS/Linux
Optional: RADIUS/TACACS+ server (FreeRADIUS, Cisco ISE) For AAA fallback
Syslog server (e. g.

Not the most exciting part, but easily the most useful.

Prerequisite knowledge includes basic Cisco CLI navigation, IP addressing, and familiarity with ACL syntax Still holds up..


Step‑by‑Step Lab Procedure

1. Secure the Console Port

Switch> enable  
Switch# configure terminal  
Switch(config)# line console 0  
Switch(config-line)# password C1sco123!   ! strong, case‑sensitive password  
Switch(config-line)# login               ! require password on console login  
Switch(config-line)# exec-timeout 5 0    ! 5 minutes idle timeout  
Switch(config-line)# transport input none ! disable Telnet on console line  
Switch(config-line)# logging synchronous ! prevent log messages from corrupting input  
Switch(config-line)# exit  
Switch(config)# service password-encryption   ! encrypt all plaintext passwords  
Switch(config)# exit  
Switch# write memory  

Why it matters: The console is the “out‑of‑band” management path. If left unsecured, an attacker with physical access could gain full control. The exec-timeout reduces the window for shoulder‑surfing, while logging synchronous keeps the console readable.

2. Replace Telnet with SSH

a. Generate RSA Keys

Switch# crypto key generate rsa general-keys modulus 2048  

b. Create Local User Accounts

Switch(config)# username admin privilege 15 secret $1$z9K8$k9QbE9XhCk2OaVhZ3R2xj1  
Switch(config)# username netadmin privilege 15 secret NetAdm!2024  

c. Enable SSH and Disable Telnet

Switch(config)# ip domain-name lab.example.com  
Switch(config)# crypto key generate rsa usage-keys label SSHKey modulus 2048  
Switch(config)# ip ssh version 2  
Switch(config)# line vty 0 4  
Switch(config-line)# transport input ssh   ! only SSH allowed  
Switch(config-line)# login local  
Switch(config-line)# exit  

d. Verify SSH Connectivity

From a management PC:

ssh -l admin 192.168.1.10  

You should be prompted for the secret password and land directly in privileged EXEC mode.

3. Implement AAA

Switch(config)# aaa new-model  
Switch(config)# aaa authentication login default local  
Switch(config)# aaa authorization exec default local  
Switch(config)# aaa accounting exec default start-stop group syslog  

If you have a RADIUS server:

Switch(config)# radius server RADIUS1  
Switch(config-radius-server)# address ipv4 10.10.10.5 auth-port 1812 acct-port 1813  
Switch(config-radius-server)# key radiusSecret123  
Switch(config)# aaa authentication login default group radius local  
Switch(config)# aaa authorization exec default group radius local  

Result: All login attempts are logged, and users are authorized based on the local database unless the RADIUS server is reachable Simple, but easy to overlook..

4. Restrict Management Plane Access with ACLs

Create an ACL that permits only the management subnet (192.Plus, 168. 1.0/24) to reach the switch’s VLAN 1 IP (192.Think about it: 168. 1.10) That's the part that actually makes a difference. Worth knowing..

Switch(config)# ip access-list extended MGMT-ACL  
Switch(config-ext-nacl)# permit ip 192.168.1.0 0.0.0.255 any  
Switch(config-ext-nacl)# deny ip any any  
Switch(config-ext-nacl)# exit  
Switch(config)# interface vlan 1  
Switch(config-if)# ip address 192.168.1.10 255.255.255.0  
Switch(config-if)# ip access-group MGMT-ACL in  
Switch(config-if)# exit  

Test from a host outside the allowed subnet – the connection should be dropped.

5. Secure SNMP – Move to SNMPv3

a. Define SNMPv3 User

Switch(config)# snmp-server group SNMPv3Group v3 priv read v3view write v3view  
Switch(config)# snmp-server user snmpadmin SNMPv3Group v3 auth sha AuthPass123 priv aes 256 PrivPass123  

b. Remove Community Strings

Switch(config)# no snmp-server community public  
Switch(config)# no snmp-server community private  

c. Verify with an SNMPwalk

snmpwalk -v3 -l authPriv -u snmpadmin -a SHA -A AuthPass123 -x AES -X PrivPass123 192.168.1.10  

If the walk succeeds, SNMPv3 is correctly configured And that's really what it comes down to. Took long enough..

6. Enable Logging and Monitoring

Switch(config)# logging host 10.10.10.20 transport udp port 514  
Switch(config)# logging trap informational  
Switch(config)# service timestamps log datetime msec localtime  
Switch(config)# service timestamps debug datetime msec localtime  

On the syslog server, you should see entries such as:

May 15 10:23:45 switch01 %SYS-5-CONFIG_I: Configured from console by admin
May 15 10:24:02 switch01 %SEC-6-IPACCESSLOGP: list MGMT-ACL denied tcp 10.20.30.40(34567) -> 192.168.1.10(22), 1 packet

7. Validation Checklist

Test Expected Result
Console login with wrong password Access denied, log entry created
SSH login with correct credentials Successful privileged EXEC prompt
Telnet attempt to the switch Connection refused / timed out
SNMPv2 community query No response (blocked)
SNMPv3 walk with correct user Successful OID retrieval
Ping from unauthorized subnet ICMP echo request blocked by ACL
Syslog entry for each login/logout Visible on the syslog server with timestamps

If any test fails, revisit the corresponding configuration block and correct syntax errors.


Scientific Explanation – How These Controls Mitigate Threats

  1. Cryptographic Hardening – SSH uses asymmetric RSA keys (2048‑bit minimum) for key exchange, guaranteeing forward secrecy. By disabling Telnet, you eliminate clear‑text credential exposure, which is a frequent vector for credential harvesting.

  2. AAA Framework – Centralizes authentication, allowing you to enforce least‑privilege policies. When combined with RADIUS/TACACS+, you gain accounting capabilities that feed into SIEM solutions, enabling detection of anomalous login patterns That's the part that actually makes a difference..

  3. Access Control Lists (ACLs) – Operate at Layer 3/4, filtering traffic before it reaches the control plane. By placing the ACL inbound on the VLAN interface, you make sure only authorized IP ranges can even attempt a management session, reducing the attack surface for port scanning and brute‑force attempts.

  4. SNMPv3 Security Model – Introduces USM (User‑based Security Model), providing authentication (HMAC‑SHA) and privacy (AES‑256). This prevents snmpwalk attacks that could otherwise disclose interface counters, MAC tables, and routing information.

  5. Logging with Timestamps – Correlates events across devices. Precise timestamps enable chronological reconstruction of incidents, a key requirement for forensic analysis and compliance frameworks such as PCI‑DSS or HIPAA.


Frequently Asked Questions (FAQ)

Q1: Can I use a self‑signed certificate for SSH instead of RSA keys?
A: Cisco IOS does not support X.509 certificates for SSH server authentication; RSA keys are the standard. That said, you can generate a self‑signed certificate for HTTPS management if you enable the web‑UI.

Q2: What is the minimum acceptable password complexity?
A: Follow the NIST SP 800‑63B guidelines: at least 8 characters, mix of upper/lowercase, numbers, and special symbols. Avoid dictionary words Less friction, more output..

Q3: Is it safe to keep the default “enable secret” password?
A: Never. The enable secret should be a strong, unique secret stored in an encrypted form (service password-encryption only encrypts Type 7, which is reversible). Use a type 5 (MD5) or type 9 (scrypt) secret for better protection.

Q4: How often should I rotate RSA keys?
A: Best practice recommends key rotation every 2‑3 years or immediately after a suspected compromise. Use crypto key generate rsa with a new label to avoid service interruption.

Q5: Can I apply the same ACL to the management VLAN on multiple switches?
A: Yes, but consider using a centralized policy engine (e.g., Cisco DNA Center) to push consistent ACLs, reducing configuration drift.

Q6: What if I need remote access from a mobile device?
A: Use an SSH client app (Termius, JuiceSSH) and ensure the device is on a trusted VPN that places it within the allowed management subnet Simple, but easy to overlook. And it works..

Q7: Does enabling logging host flood the network with syslog traffic?
A: Syslog traffic is lightweight (UDP 514). Still, you can rate‑limit logs on the switch with logging rate-limit if you anticipate high‑volume events.


Conclusion – From Lab to Real‑World Deployment

The 10.4.2 Lab: Secure Access to a Switch provides a hands‑on pathway to transform a default, insecure switch configuration into a hardened, auditable device ready for production environments. By systematically applying console security, SSH‑only remote access, AAA, ACL‑based management plane restrictions, SNMPv3, and comprehensive logging, you address the most common vectors exploited by attackers.

Short version: it depends. Long version — keep reading Not complicated — just consistent..

Remember that security is a continuous process. After the lab, schedule regular reviews:

  • Quarterly password audits and rotation.
  • Annual RSA key regeneration.
  • Monthly log analysis for failed login attempts or ACL denials.
  • Bi‑annual firmware upgrades to patch IOS vulnerabilities.

Adopting these practices not only safeguards the switch itself but also protects the entire network fabric that depends on it. Whether you are a student preparing for a Cisco certification or a seasoned network engineer reinforcing a data‑center spine, mastering the steps outlined in this lab equips you with the practical expertise needed to keep network infrastructure resilient against evolving threats.


Secure your switch today, and build a foundation of trust for every device that connects tomorrow.

5️⃣ Advanced Hardening (Optional Extensions)

If you have extra time or need to meet stricter compliance frameworks (PCI‑DSS, NIST 800‑53, ISO 27001), consider adding one or more of the following layers. Each can be implemented without breaking the core lab flow; simply append the relevant commands after the basic hardening steps.

Feature Why it matters Sample configuration
Control Plane Policing (CoPP) Prevents a flood of management‑plane packets (e.SPA. router(config)# control-plane<br>router(config-cp)# service-policy input CP-INPUT-POLICY
Port‑Security on Management VLAN Guarantees that only known MAC addresses can access the management VLAN, limiting rogue plug‑ins. Plus, ```boot system flash:c1900-universalk9-mz. But
Secure Boot / Image Signing Guarantees that the IOS image has not been tampered with before the switch boots. 1.bin<br>boot integrity‑check```
NetFlow / Flexible NetFlow Provides visibility into traffic patterns on the management VLAN for anomaly detection. g., malformed SSH, SNMP, or DHCP) from exhausting CPU resources. 250<br> transport udp 2055```
Config Guard / Config Rollback Automatically revert to a known‑good configuration if a change introduces errors. M. ip arp inspection vlan 10
IP Source Guard Binds an IP address to a specific MAC/port combo, preventing IP address hijacking. Still, ```flow record MANAGEMENT-RECORD<br> flow-key destination‑ipv4 address<br> flow-key source‑ipv4 address<br>flow exporter MANAGEMENT-EXPORTER<br> destination 10. 154-3.
Dynamic ARP Inspection (DAI) Stops ARP spoofing attacks that could redirect management traffic to a malicious host. 0 cli command "configure replace flash:startup-config.

Worth pausing on this one.

Tip: Deploy these features incrementally. After each addition, verify that you can still log in via SSH and that the switch remains reachable from the management station. If you encounter a lock‑out, use the console port to roll back the offending configuration.


6️⃣ Verification Checklist

Before you close the lab, run through this quick sanity‑check list. Worth adding: capture the output of each command and store it in a text file (lab‑verification. txt) for future reference or audit purposes.

✅ Item Command Expected result
1. Console line secured show line Password required on tty0
2. And sSH only, no Telnet `show run include transport input`
3. Local user exists & secret type 9 `show running-config include username`
4. So aAA accounting enabled `show running-config include aaa new-model`
5. Management ACL applied show access-lists MGMT-ACL List matches the permit/deny statements
6. VLAN 10 interface up show ip interface brief Vlan10 shows up/up
7. SNMPv3 user active show snmp user admin listed with authpriv
8. Syslog destination reachable show logging Logging to 10.1.1.250 and last message timestamp recent
9. In practice, nTP synchronized show ntp status Clock is synchronized
10. Even so, no clear‑text passwords `show running-config include password`
11. No default accounts `show running-config include username`
12.

If any of the items fail, revisit the corresponding configuration block. The most common pitfalls are:

  • Forgetting to save the configuration (write memory).
  • Over‑restrictive ACL that blocks the management host itself.
  • Mismatch between the NTP source interface and the VLAN used for management.

7️⃣ Lab Wrap‑Up & Documentation

  1. Export the final configuration

    copy running-config flash:lab‑final.cfg  
    

    Keep a copy in your version‑control system (Git, SVN) with a meaningful commit message, e.g., feat: secure baseline for switch‑01 Worth keeping that in mind. Took long enough..

  2. Create a “run‑book”
    Summarize the steps you performed, the rationale behind each security control, and any deviations you made for your environment. Include:

    • Device hostname and serial number.
    • Management VLAN ID and IP scheme.
    • List of privileged users and their secret‑type.
    • Locations of external services (syslog, NTP, SNMP manager).
    • Backup schedule (e.g., daily copy running-config tftp://backup‑srv/...).
  3. Schedule a post‑lab review
    Set a calendar reminder for 30 days after the lab to:

    • Verify that the syslog server still receives logs.
    • Confirm that the NTP source remains reachable.
    • Rotate the enable secret if any staff member has left the organization.

Final Thoughts

Security isn’t a checkbox; it’s a habit. This lab walks you through the foundational controls every Cisco switch should have before it touches a production network. By mastering these steps you’ll:

  • Eliminate the “default‑password” risk that attackers love.
  • see to it that only authenticated, authorized personnel can touch the device, and only from approved subnets.
  • Gain visibility into every privileged‑access event, making forensic investigations possible.
  • Build a repeatable, auditable process that scales across dozens or hundreds of switches.

When you return to your real‑world environment, treat the lab’s configuration as a template. Here's the thing — customize the ACLs, usernames, and logging destinations to match your organization’s topology, but keep the core principles intact. Regularly revisit the checklist, rotate secrets, and keep the IOS up to date—these simple disciplines will keep your switching fabric resilient against both opportunistic scans and targeted attacks.

Secure your edge, protect your core, and let the data flow safely.

8️⃣ Automating Ongoing Hardening

After the lab you’ll likely have dozens of switches to bring up to the same security baseline. Manual copy‑paste is error‑prone; instead, automate the rollout with one of the following approaches:

Tool When to Use Quick Example
Cisco Prime Infrastructure / DNA Center Large, heterogeneous fleets with a central management plane. 5','username':'admin','password':'$ecret'} with ConnectHandler(**device) as net: net.Here's the thing — splitlines())```
Cisco Embedded Event Manager (EEM) Reactively enforce a rule the moment it’s violated (e. Now, 0 cli command "configure terminal" action 3. So read() device = {'device_type':'cisco_ios','host':'10. Import the “Secure Switch Baseline” template and push it to a device group named Branch‑Access. Which means , only apply NTP if the device already has a reachable time source). 0 cli command "interface $_intf" action 4.g.
Ansible Script‑friendly environments, especially when you already use Ansible for server automation. On top of that, python from netmiko import ConnectHandler cfg = open('secure-baseline. cfg provider: host: "{{ inventory_hostname }}" username: "{{ ansible_user }}" password: "{{ ansible_ssh_pass }}"
Python + Netmiko/NAPALM Need fine‑grained logic (e.On top of that, 0 cli command "shutdown" action 5. Consider this: 0 cli command "enable" action 2. 0 syslog priority warnings msg "Port‑security violation on $_intf – interface shut.

Tip: Store the baseline configuration in a version‑controlled repository (Git). Tag each release with the IOS version it targets (v1.0‑cisco‑16.12.4). When a new IOS release arrives, spin up a test switch, apply the baseline, and run the verification checklist from Section 6. This “continuous‑validation” loop catches regressions before they hit production The details matter here. Practical, not theoretical..


9️⃣ Periodic Audits & Compliance

Even a perfectly hardened switch can drift over time. Implement a quarterly audit cycle that includes:

  1. Configuration Drift Detection
    • Use show archive config differences (if archive is enabled) or pull the running‑config via SNMP/Netconf and diff it against the approved baseline stored in Git.
  2. Log Review
    • Verify that the syslog server has received at least one log entry from each switch in the last 24 hours.
    • Confirm that no “AAA authentication login failure” spikes exist, which could indicate a brute‑force attempt.
  3. Port‑Security State
    • Run show port-security interface on every access port; any port showing “Violation count > 0” must be investigated.
  4. Credential Hygiene
    • Run show run | include username and cross‑check against HR off‑boarding logs. Remove any stale accounts immediately.

Automate the audit with a lightweight script that pulls the necessary data via SSH, compares it to the baseline, and emails a report. Example using Python + Paramiko:

import paramiko, difflib, smtplib

def get_running_cfg(host):
    client = paramiko.Practically speaking, sSHClient()
    client. set_missing_host_key_policy(paramiko.That said, connect(host, username='audit', password='audit_pwd')
    stdin, stdout, _ = client. exec_command('show running-config')
    return stdout.AutoAddPolicy())
    client.read().

def compare_cfg(host, baseline_path):
    running = get_running_cfg(host).That's why read(). splitlines()
    diff = difflib.splitlines()
    with open(baseline_path) as f:
        baseline = f.unified_diff(baseline, running,
                                fromfile='baseline', tofile='running')
    return '\n'.

# Example usage for a list of devices
devices = ['10.0.1.1', '10.0.1.2']
report = ''
for dev in devices:
    diff = compare_cfg(dev, f'baselines/{dev}.cfg')
    if diff:
        report += f'=== {dev} ===\n{diff}\n\n'

if report:
    with smtplib.Now, sMTP('mail. example.com') as s:
        s.sendmail('audit@example.com', 'ops@example.

Schedule this script via cron (`0 2 * * 1` for every Monday at 02:00) and you’ll have an early‑warning system that surfaces drift before it becomes a compliance violation.

---

### 🔚 Conclusion  

By now you’ve built a **repeatable, auditable, and resilient security baseline** for Cisco IOS switches:

- **Hardening fundamentals** – disable unnecessary services, enforce strong authentication, and lock down management access to a dedicated VLAN.  
- **Layer‑2 protection** – enable port‑security, BPDU‑guard, and DHCP‑snooping to thwart rogue devices and VLAN‑hopping attacks.  
- **Visibility & accountability** – centralize logging, enable NTP synchronization, and configure AAA accounting for every privileged command.  
- **Operational rigor** – verify each step with targeted `show` commands, back up the final config, document the process, and schedule regular audits.  

When you translate this lab into production, treat the configuration as a **living artifact**. Keep it under version control, automate its distribution, and periodically re‑validate against the checklist. Security is a marathon, not a sprint; the disciplined workflow you’ve practiced here will pay dividends every time a new switch joins the network or an existing device receives a firmware upgrade.

Secure your edge, protect your core, and let the data flow safely—because a well‑hardened switch is the silent guardian of every modern enterprise network.
Just Came Out

Straight Off the Draft

More in This Space

If You Liked This

Thank you for reading about 10.4.2 Lab: Secure Access To A Switch. We hope the information has been useful. Feel free to contact us if you have any questions. See you next time — don't forget to bookmark!
⌂ Back to Home