Everyday IOS habits
The commands below are the ones worth typing on every lab device before anything else, and the checklists to run through when a device is new. The Technical reference lists every command the live labs run.
Make the console pleasant
line console 0
logging synchronous
exec-timeout 30 0
line vty 0 15
logging synchronous
exec-timeout 30 0
!
no ip domain-lookuplogging synchronousreprints your half-typed command after a log message, so messages never break what you type.exec-timeout 30 0logs an idle session out after 30 minutes. The default is 10 minutes;0 0never times out, which is fine in a lab and wrong in production.no ip domain-lookupstops IOS from treating a mistyped word as a host name and trying to resolve it for several seconds.terminal monitorshows log messages in an SSH or Telnet session. The console shows them already.
Find things fast
| Command | What it shows |
|---|---|
show running-config | section line vty | Only the vty lines' configuration |
show running-config | begin router ospf | The configuration from the OSPF section on |
show ip interface brief | include up | Only the interfaces that are up |
show interfaces | include line protocol|errors | Each interface's state and error counters, two lines each |
do show ip route | Any EXEC command from inside a configuration mode |
Save, wipe and start again
| Goal | Commands |
|---|---|
| Save | copy running-config startup-config, or the shorter write memory (wr) |
| Wipe a router | erase startup-config (or write erase), then reload without saving |
| Wipe a switch | The same, plus delete flash:vlan.dat: VLANs live in that file and survive an erased configuration |
Passwords, in the right strength
enable secretstores a hash;enable passworddoes not. When both are set, the secret wins. Use only the secret.username admin secret …creates a local user with a hashed password, forlogin localon the lines.service password-encryptionhides the remaining clear-text passwords (line passwords) as type 7. Type 7 is reversible in seconds, so it only stops someone reading over your shoulder.banner motd #Authorised access only#warns people before they log in. Pick a delimiter that does not appear in the text.
SSH checklist
- A hostname other than the default:
hostname SW1. - A domain name:
ip domain-name lab.local. The RSA key is named after the two. - A key of at least 768 bits for SSH version 2; use 2048:
crypto key generate rsa modulus 2048. ip ssh version 2. Without it IOS reports version 1.99, which still accepts the old, flawed version 1.- A local user:
username admin secret …. - On the vty lines:
transport input sshandlogin local. - Optional, against password guessing:
login block-for 120 attempts 4 within 60blocks new logins for 2 minutes after 4 failures within 1 minute.
A switch also needs an address to be reached: an SVI such as interface vlan 1 with ip address and no shutdown, and ip default-gateway for networks beyond its own.
Catalyst 9000: changing the licence level
A Catalyst 9300 or 9500 runs at the licence level it booted with. Moving up to Network Advantage takes a configuration line, a save and a reload.
configure terminal
license boot level network-advantage addon dna-advantage
end
write memory
reloadIOS answers with a reminder that the change takes effect at the next boot. A warning about the boot variable at reload means boot system is not set; the switch still boots the first image it finds, but set it to be sure.