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:
| Type | What it looks like | How strong |
|---|---|---|
| 0 | password cisco | Plain text |
| 7 | password 7 0822455D0A16 | Decoded instantly — this is masking, not encryption |
| 5 | secret 5 $1$... | MD5; weak passwords are cracked quickly |
| 8 and 9 | secret 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
- The web interface:
no ip http serverandno ip http secure-serverif you do not use it. - SNMP with community public/private: remove it and move to SNMPv3 with encryption — set up by Cisco SNMPv3.
- CDP and LLDP on external ports:
no cdp enableon interfaces facing the provider — otherwise neighbors learn the model and firmware version. - Unused switch ports: shut them down and move them into a separate "dead" VLAN.
- Smart Install on older switches:
no vstack— devices were taken over en masse through it.
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.