Category Archives: Config Files

How to set history size on routers or switches

I wanted to see more than 10 lines in time so I needed a way to have that. History can be set up on console line and/or vty lines. Here is how you will do this on a switch:

SW1>ena
SW1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#line con 0
SW1(config-line)#his
SW1(config-line)#history ?
  size  Set history buffer size
  

SW1(config-line)#history si
SW1(config-line)#history size ?
  <0-256>  Size of history buffer

SW1(config-line)#history size 256
SW1(config-line)#line vty 0 15
SW1(config-line)#hi
SW1(config-line)#history size
SW1(config-line)#history size 256
SW1(config-line)#exit
SW1(config)#exit
SW1#wr m
05:13:04: %SYS-5-CONFIG_I: Configured from console by console
SW1#wr mem
Building configuration...
[OK]
SW1#

It is the same configuration as for the switch:


R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#line con 0
R2(config-line)#his
R2(config-line)#history size 256
R2(config-line)#exit
R2(config)#line vty 0 15
R2(config-line)#hi
R2(config-line)#history si
R2(config-line)#history size 256
R2(config-line)#exit
R2(config)#exit
R2#
Jun 12 17:34:34.055: %SYS-5-CONFIG_I: Configured from console by console
R2#

It is ok when you read the commands, but if you want to copy and paste them it is difficult. So here are the commands as a script:

ena
conf t
line con 0
history size 256
exit
line vty 0 15
history size 256
exit
exit
wr mem
 

(you need to copy all, so that write memory to be executed)

Basic configuration on devices

Basic configuration on devices:

  • set hostname;
  • set secret password;
  • set banner motd;
  • encrypt passwords;
    • line console 0

    • set synchronous logging
    • set idle time
    • set password
    • use login
    • line vty 0 15

    • set password
    • use login
    • set history size

Below you have the commands. The hostname is at the end, because if you want to copy-paste them, you will have to modify the hostname:

enable
conf t
enable secret cisco
banner motd #AUTHORIZED ACCESS ONLY !#
service password-encryption
line console 0
logging synchronous
exec-time 0 0
password cisco
login
history size 256
line vty 0 15
password cisco
login
history size 256
exit
hostname