A Cisco switch or router out of the box, or after a quick setup, is often left with Telnet, Type 7 passwords, SNMP with the community public and management open from any network. Finding such a device on the internet takes minutes, and inside the network anyone who plugs into a wall socket can take it over. Below is a basic hardening set worth applying to every device.

Passwords: not Type 7 and not enable password

A Cisco configuration stores passwords in several formats, and not all of them protect anything:

TypeWhat it looks likeHow strong
0password ciscoPlain text
7password 7 0822455D0A16Decoded instantly — this is masking, not encryption
5secret 5 $1$...MD5; weak passwords are cracked quickly
8 and 9secret 9 $9$...PBKDF2 and scrypt — use these

How easily Type 7 is revealed is shown by the Cisco Type 7 decoder. Use enable secret and username ... secret with algorithm 9:

enable algorithm-type scrypt secret ALongPassword
username admin privilege 15 algorithm-type scrypt secret ALongPassword
service password-encryption

The last line masks any remaining Type 0 passwords (for example, in old settings), but it does not replace proper hashes. Ready lines with a Type 8 or 9 hash created in the browser come from the password hashes page.

SSH instead of Telnet

hostname SW1
ip domain name corp.local
crypto key generate rsa modulus 3072
ip ssh version 2
!
line vty 0 15
 transport input ssh
 login local
 exec-timeout 10 0

Telnet sends the password in plain text, so transport input ssh is a must. Check the whole line vty 0 15 range: many models have lines 5–15, and they are often forgotten.

Management only from your own network

Even with SSH, management should not be reachable from everywhere. Limit the VTY lines with an access list:

ip access-list standard MGMT
 permit 192.168.100.0 0.0.0.255
 deny any log
!
line vty 0 15
 access-class MGMT in

Add brute-force protection: login block-for 300 attempts 5 within 60 blocks logins for 5 minutes after 5 failed attempts within a minute.

Turn off what you do not need

Logs and time

Without logs you will never know about login attempts. Turn on sending to a syslog server, NTP time synchronization and precise timestamps:

service timestamps log datetime msec localtime show-timezone
logging host 192.168.100.20
login on-failure log
login on-success log
archive
 log config
  logging enable
  hidekeys

The archive log config block records every command entered — it shows who changed what.

Check and build it as a ready block

To find problems on a working device, paste the show running-config output into the Cisco config audit: it finds Type 7 and Type 5 passwords, Telnet, SNMP public, open VTY and HTTP, and suggests fixing commands. A ready hardened configuration with users, SSH, a management ACL, AAA, NTP, syslog and a banner is built by the hardened Cisco config page.

Save a copy before changes: copy running-config startup-config and a copy on a server. Automatic copies on every save are set up by Cisco backups. For access switches, add layer 2 protection — see the article on VLANs.