Router(config)# auto secure
To encrypt all plaintext passwords:
R1(config)# service password-encryption
To enforce a minimum password length of 8 characters:
R1(config)# security passwords min-length 8
To block login attempts for 120 seconds if there are 3 failed attempts within 60 seconds:
R1(config)# login block-for 120 attempts 3 within 60
To secure VTY lines with a password and set an exec-timeout:
R1(config)# line vty 0 4
R1(config-line)# password cisco123
R1(config-line)# exec-timeout 5 30
R1(config-line)# transport input ssh
R1(config-line)# end
To verify the VTY line configuration:
R1# show running-config | section line vty
line vty 0 4
password 7 094F471A1A0A
exec-timeout 5 30
login
transport input ssh
To configure SSH for secure remote access:
Router# configure terminal
Router(config)# hostname R1
R1(config)# ip domain name span.com
R1(config)# crypto key generate rsa general-keys modulus 1024
The name for the keys will be: R1.span.com
% The key modulus size is 1024 bits
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]
Dec 13 16:19:12.079: %SSH-5-ENABLED: SSH 1.99 has been enabled
To create a user with a secret password:
R1(config)# username Bob secret cisco
To configure VTY lines to use local login and SSH:
R1(config)# line vty 0 4
R1(config-line)# login local
R1(config-line)# transport input ssh
R1(config-line)# exit
To display all IP ports:
Router# show ip ports all
Proto Local Address Foreign Address State PID/Program Name
tcp :::443 :::* LISTEN 309/[IOS]HTTP CORE
tcp *:443 *:* LISTEN 309/[IOS]HTTP CORE
udp *:67 0.0.0.0:0 387/[IOS]DHCPD Receive
To display open ports on the control plane:
Router# show control-plane host open-ports
Active internet connections (servers and established)
Prot Local Address Foreign Address Service State
tcp *:23 *:0 Telnet LISTEN
tcp *:80 *:0 HTTP CORE LISTEN
udp *:67 *:0 DHCPD Receive LISTEN
To disable the HTTP server:
Router# configure terminal
Router(config)# no ip http server
To configure VTY lines to accept only SSH connections:
Router(config)# line vty 0 15
Router(config-line)# transport input ssh