Overview
This guide teaches how to quickly initialize Cisco routers and switches in a virtual or isolated lab while clearly separating insecure lab conveniences from proper real-world configurations. Know whether you are configuring a router, a Layer 2 switch, or a multilayer switch before you paste any block.
Telnet, shared line passwords, no idle timeout, and sample passwords such as cisco and class are acceptable only in a disposable, isolated practice environment. Never expose that configuration to an untrusted or Internet-connected network.
1. Lab Setup Versus Production Setup
| Environment | Purpose | Security expectation |
|---|---|---|
| Temporary isolated practice | Packet Tracer, GNS3, CML, or a VLAN-isolated lab VLAN | Shortcuts allowed for speed |
| Physical home lab | Hands-on cabling and console practice | Still isolated — treat like a lab unless you intentionally harden it |
| Production or Internet-connected | Real users, real data, real risk | SSH, strong secrets, timeouts, local/AAA login, banners |
Telnet sends credentials and traffic in cleartext. SSH should be used in real environments.
Sample passwords such as cisco and class must never be used in production.
RSA key generation syntax, VTY line ranges, and SSH algorithm support vary by IOS version and hardware. Use ?, show version, and Cisco documentation for your platform — do not assume Packet Tracer behavior matches every physical device.
2. Correct Common Configuration Mistakes
| Mistake | Correction |
|---|---|
Using enable password alone | Prefer enable secret — it stores an MD5/SHA hash and overrides plain enable password |
Treating service password-encryption as strong security | It is reversible obfuscation, not strong password hashing |
Putting transport input under the console line | transport input belongs under VTY lines, not line console 0 |
Teaching line vty 0 5 | Use line vty 0 4 or, when supported, line vty 0 15 |
Using exec-timeout 0 0 everywhere | Use unlimited idle time only in isolated labs |
Enabling ip routing on every device | Needed mainly to enable Layer 3 routing on a multilayer switch |
Using ip default-gateway on a router | ip default-gateway is for a Layer 2 switch when IP routing is disabled |
Using ip default-gateway on a multilayer switch with routing | After ip routing, use a default route (ip route 0.0.0.0 0.0.0.0 …) |
| Disabling timestamps in production | Timestamps may clean lab output, but enable them in real environments |
Only teaching write memory | Both write memory and copy running-config startup-config save — the copy syntax is preferred for teaching |
Students often paste transport input telnet under the console line or configure line vty 0 5 because a lab screenshot used a nonstandard range. Verify with show running-config | section line vty.
3. Fast Isolated-Lab Router Configuration
Telnet, shared passwords, and unlimited idle sessions are intentionally insecure. Never expose this configuration to an untrusted network.
enable configure terminal hostname R1 no ip domain-lookup enable secret class service password-encryption line console 0 logging synchronous exec-timeout 0 0 password cisco login exit line vty 0 4 logging synchronous exec-timeout 0 0 password cisco login transport input telnet exit end copy running-config startup-config
| Command | Purpose |
|---|---|
enable | Enters privileged EXEC mode |
configure terminal | Enters global configuration mode |
hostname R1 | Sets the device name shown in prompts and logs |
no ip domain-lookup | Disables DNS lookups for mistyped commands (lab convenience) |
enable secret class | Sets a hashed enable password (still a weak lab password) |
service password-encryption | Obfuscates line passwords in show running-config |
line console 0 / line vty 0 4 | Configures console and virtual terminal lines |
logging synchronous | Reprints interrupted CLI input after syslog messages |
exec-timeout 0 0 | Disables idle timeout — lab only |
password cisco + login | Line password authentication (insecure; lab only) |
transport input telnet | Allows Telnet to VTY lines — never in production |
exit | Leaves line configuration mode |
end | Returns to privileged EXEC |
copy running-config startup-config | Saves to NVRAM |
You may paste the whole block, including exit and end, to move cleanly between configuration modes.
Large blocks should still be pasted in manageable sections because Packet Tracer, serial consoles, and older IOS devices may drop pasted characters.
4. Devices With Additional VTY Lines
Not every device has the same number of VTY lines. Some platforms use 0–4; others support 0–15.
configure terminal line vty 5 15 logging synchronous exec-timeout 0 0 password cisco login transport input telnet exit end copy running-config startup-config
show running-config | section line vty show line
5. Optional Clean Lab Output
This subsection is optional and lab-only. Do not use it in the production baseline.
configure terminal no service timestamps debug datetime msec no service timestamps log datetime msec end
Disabling millisecond timestamps may make disposable lab output shorter, but it removes useful timing information for troubleshooting and syslog correlation.
6. Secure Real-World SSH Baseline
Use local or AAA login, SSH version 2, idle timeouts, strong secrets, and disable unused management services such as HTTP.
enable configure terminal hostname R1 no ip domain-lookup enable secret <STRONG-ENABLE-SECRET> username netadmin privilege 15 secret <STRONG-USER-SECRET> ip domain-name lab.example crypto key generate rsa modulus 2048 ip ssh version 2 service password-encryption service timestamps debug datetime msec localtime show-timezone service timestamps log datetime msec localtime show-timezone banner motd # AUTHORIZED ACCESS ONLY
line console 0 logging synchronous exec-timeout 10 0 login local exit line vty 0 4 logging synchronous exec-timeout 10 0 login local transport input ssh exit no ip http server no ip http secure-server end copy running-config startup-config
Key points:
- The device needs a hostname and domain name before RSA key generation.
- SSH support depends on the IOS image and platform. Image names containing
k9generally indicate cryptographic functionality —k9is not "IP KVM." - RSA key-size syntax varies on some releases; verify with
crypto key generate rsa ?. - Some modern platforms support stronger SSH algorithms; older lab hardware may have limitations.
show ip ssh show ssh show crypto key mypubkey rsa show running-config | section line vty
7. Layer 2 Switch Management Setup
A Layer 2 switch uses a management SVI. The management VLAN must exist, and the SVI may stay down until the VLAN has an active access port or trunk.
vlan 99 name MANAGEMENT exit
enable configure terminal hostname SW1 no ip domain-lookup interface vlan 99 ip address 192.0.2.2 255.255.255.0 no shutdown exit ip default-gateway 192.0.2.1 end copy running-config startup-config
Example to make VLAN 99 active — assign at least one access port or carry the VLAN on a trunk:
interface FastEthernet0/1 switchport mode access switchport access vlan 99 no shutdown
ip default-gateway is used because the switch is not routing IP packets between subnets.
8. Multilayer Switch Setup
After ip routing is enabled, a multilayer switch behaves like a router for inter-VLAN traffic and uses a default route, not ip default-gateway.
enable configure terminal ip routing interface vlan 99 ip address 192.0.2.2 255.255.255.0 no shutdown exit ip route 0.0.0.0 0.0.0.0 192.0.2.1 end copy running-config startup-config
9. Quick Telnet Switching Between Lab Devices
Configure host aliases for faster lab navigation:
configure terminal ip host R1 10.0.0.1 ip host R2 10.0.0.2 ip host R3 10.0.0.3 ip host R4 10.0.0.4 end
telnet R1
To suspend a Telnet session: press Ctrl-Shift-6, release, then press x.
telnet R2 show sessions
Typing 1, 2, 3, or 4 resumes active sessions by their dynamically assigned session numbers — the numbers are not permanently tied to specific routers.
disconnect 1
Use show sessions to inspect open sessions and disconnect or clear line as appropriate to close them.
10. Essential Verification Commands
| Command | What it shows |
|---|---|
show running-config | Active configuration in RAM |
show startup-config | Saved configuration in NVRAM |
show ip interface brief | Interface IP addresses and status (routers/L3) |
show interfaces status | Switchport status, VLAN, speed, duplex |
show interfaces description | Admin descriptions |
show version | IOS version, uptime, model, memory |
show inventory | Module and serial details (when supported) |
show cdp neighbors | Directly connected Cisco devices |
show cdp neighbors detail | Neighbor IP, platform, capabilities |
show users | Active console and VTY sessions |
show line | Line numbers, transport, session state |
show sessions | Suspended Telnet sessions |
show history | Recent EXEC commands |
11. Saving and Erasing Configurations
| Action | Command |
|---|---|
| Save running to startup | copy running-config startup-config |
| Alternate save syntax | write memory |
| Reset a disposable lab device | write erase then reload |
write erase and reload are for your own lab gear only. On some switches, VLAN information may persist in a separate vlan.dat file — erasing startup-config may not remove VLAN definitions.
12. Copy-and-Paste Configuration Tips
- Include
exitcommands between sections so mode changes are explicit. - Use
endbefore verification or save commands. - Paste in smaller blocks on real serial connections.
- Watch for IOS error markers beginning with
%. - Confirm every interface name before pasting — Packet Tracer names may not match physical equipment.
- Run
show running-configafterward to confirm the result. - Do not paste production secrets into screenshots, public repositories, or shared lab files.
Router setup checklist
- Hostname and
no ip domain-lookup(lab) or domain name (production SSH) -
enable secretwith a strong password in production - Console and VTY lines configured with appropriate timeout and login method
- VTY
transport input sshin production; Telnet lab only - Interfaces addressed and
no shutdownwhere needed - Default route or static routes configured
- Configuration saved with
copy running-config startup-config
Switch setup checklist
- Identify Layer 2 vs multilayer switch role
- Management VLAN and SVI configured
-
ip default-gateway(L2) orip routing+ default route (L3) - At least one port or trunk to bring the management VLAN up
- Access/trunk ports verified with
show vlan brief/show interfaces status - Configuration saved
