Free tech learning for everyone, from basics to pro

Networking LabsLabsBeginner

Lab: basic switch configuration and SSH access

In short: A new switch works out of the box but is completely unprotected. In this lab you give it a name, passwords, a warning banner and a management address, then replace Telnet with SSH version 2 and local user accounts.

Aim and what you need

The aim is to take a switch from factory defaults to a secured, remotely manageable device. This is the first thing you do with any switch at work, and it appears in almost every CCNA practical.

  • Packet Tracer (or a real Cisco 2960/9200 switch in your own lab, with a console cable).
  • One switch, one router (optional, for the gateway) and one PC.
  • The template from the first Packet Tracer lab is a good starting point.

Topology and plan

Switch management labSwitch S1SVI 192.168.10.2Admin PC192.168.10.10Consolefirst accessRouter R1gateway .1SSH clientvty 0 15
Figure 1. S1 is managed in-band over SSH through its VLAN 1 interface, with the console cable used only for initial setup.

The switch itself does not need an IP address to forward frames. It needs one only so that you can manage it remotely. On a Layer 2 switch that address lives on a switched virtual interface (SVI), here VLAN 1. In real networks you would use a dedicated management VLAN instead of VLAN 1; the VLAN lab shows how.

Securing management accessConsole linepassword, timeoutPrivileged modeenable secretLocal usersusername secretSSH version 2RSA 2048 keysVTY linesSSH only, login local
Figure 2. Each layer of management access gets its own protection, ending with SSH-only remote lines.

Steps

  1. Connect the PC's RS-232 port to the switch console port with a console cable, open Desktop, Terminal and accept the defaults (9600 baud).
  2. Enter the basic settings: hostname, privileged password, console password and banner.
  3. Give VLAN 1 an address and set the default gateway so the switch can reply to other subnets.
  4. Create a local user, generate RSA keys and turn on SSH version 2.
  5. Lock the VTY lines to SSH only and save.
enable
configure terminal
hostname S1
no ip domain-lookup
enable secret <choose-a-strong-secret>
service password-encryption
banner motd # Authorised access only. Activity is logged. #
line console 0
 password <console-password>
 login
 exec-timeout 5 0
 logging synchronous
exit
interface vlan 1
 ip address 192.168.10.2 255.255.255.0
 no shutdown
exit
ip default-gateway 192.168.10.1
ip domain-name lab.example.com
username admin privilege 15 secret <admin-password>
crypto key generate rsa general-keys modulus 2048
ip ssh version 2
ip ssh time-out 60
ip ssh authentication-retries 3
line vty 0 15
 transport input ssh
 login local
 exec-timeout 10 0
end
copy running-config startup-config

Tip: a hostname and a domain name must exist before the RSA key can be generated. If the simulator asks for the key size instead of accepting it on the command line, enter 2048.

Verify

From the switch, check that SSH is enabled at version 2 and that VLAN 1 is up/up. From the PC command prompt, connect over SSH; success is a login prompt, the banner, and the S1# prompt after you enter the admin password. A Telnet attempt to the same address should be refused.

show ip ssh
show ip interface brief
show running-config | section line vty
show ssh
ping 192.168.10.2
ssh -l admin 192.168.10.2
telnet 192.168.10.2

Troubleshooting and clean-up

  • SSH refused: check show ip ssh. If it says disabled, the RSA key was not created; set the domain name and generate it again.
  • Cannot ping the switch: VLAN 1 may be administratively down, or the PC is in a different subnet with no gateway set on the switch.
  • Login fails on VTY: login local uses the username database, not the line password. Check the username exists.
  • Locked out of a real switch: use the password recovery procedure for your model, which needs physical console access.

To reset a lab switch to defaults, erase the startup configuration and the VLAN database, then reload. In Packet Tracer you can also just keep a saved copy of the clean file.

write erase
delete flash:vlan.dat
reload

Practice

Why does a Layer 2 switch need an IP address at all?
Only for management: SSH, SNMP, syslog and similar traffic to and from the switch itself. Frame forwarding does not need it.
What is the difference between enable password and enable secret?
enable secret stores a strong hash of the password; enable password is stored in plain text or with weak type 7 encoding. Always use secret.
Which two settings must exist before crypto key generate rsa works?
A hostname other than the default, and an IP domain name.

Key takeaways

  • Secure the console, privileged mode and VTY lines separately.
  • The management IP sits on an SVI, with ip default-gateway for other subnets.
  • SSH needs a hostname, domain name, RSA key of 2048 bits and a local user.
  • Use transport input ssh so Telnet cannot be used.
  • Save with copy running-config startup-config, and know how to reset a lab switch.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.