// Lesson 41 of 49 · Security fundamentals
Hardening device access
Secrets and password types, local users, login protection, SSH-only management, banners, unused ports and a hardening checklist.
2 min read#hardening#passwords#security
A router or switch with weak access controls gives an attacker control of every packet that crosses it.
Passwords and secrets
| Command | Storage |
|---|---|
enable password |
Clear text (or weak type 7 with encryption service) — do not use |
enable secret |
Hashed — use this |
username X password |
Clear/type 7 — do not use |
username X secret |
Hashed — use this |
Modern IOS hashes secrets with type 8 (PBKDF2) or type 9 (scrypt):
R1(config)# enable algorithm-type scrypt secret <STRONG-SECRET>
R1(config)# username netadmin privilege 15 algorithm-type scrypt secret <STRONG-SECRET>
R1(config)# service password-encryption ! hides remaining clear-text passwords (weak, type 7)
R1(config)# security passwords min-length 12
Type 7 is reversible — treat it as obfuscation, not protection.
Protect logins
R1(config)# login block-for 120 attempts 5 within 60
R1(config)# login on-failure log
R1(config)# line vty 0 15
R1(config-line)# transport input ssh
R1(config-line)# login local
R1(config-line)# access-class 5 in
R1(config-line)# exec-timeout 10 0
R1(config)# line console 0
R1(config-line)# login local
R1(config-line)# exec-timeout 10 0
login block-for stops brute-force attempts for 120 seconds after 5 failures within 60 seconds.
Banner
R1(config)# banner motd ^
Authorised access only. Activity is logged and monitored.
^
Never put device names, locations or "welcome" wording in a banner.
Switch edge hygiene
SW1(config)# interface range GigabitEthernet1/0/30 - 48
SW1(config-if-range)# switchport mode access
SW1(config-if-range)# switchport access vlan 998 ! unused "parking" VLAN
SW1(config-if-range)# shutdown
SW1(config)# interface range GigabitEthernet1/0/1 - 29
SW1(config-if-range)# switchport nonegotiate
SW1(config-if-range)# no cdp enable
Turn off what you do not use
R1(config)# no ip http server
R1(config)# ip http secure-server ! only if the GUI is needed
R1(config)# no ip source-route
R1(config)# no service pad
Hardening checklist
enable secretand local users withsecret, strong and unique.- SSH v2 only; Telnet disabled; VTY ACL; timeouts.
- AAA with a central server (next lessons) and a local fallback account.
- Unused ports shut and parked in an unused VLAN; DTP off.
- Unused services off; HTTPS only if a GUI is needed.
- NTP, syslog and SNMPv3 configured; time-stamped logs.
- Configuration backed up off the device.
- Software kept up to date with vendor security advisories.
Key points
- Always
secret, neverpassword; type 7 is reversible. - Block brute force with
login block-for; restrict VTY withaccess-class. - Shut and park unused ports; disable DTP and unnecessary services.
Sign in to save your lesson progress across devices. You can read every published lesson without an account.