4.8 Configure and verify remote device access with SSH

CCNA 200-301 v1.1 · 4.0 IP Services

Managing a device over the network needs an encrypted session: SSH replaces Telnet, which sends passwords in clear text. For the CCNA you configure SSH version 2 on a router or switch from scratch (hostname, domain, keys, local user, VTY lines) and verify that Telnet is refused.

What you must know

Configure SSH step by step

hostname SW1
ip domain-name example.local
crypto key generate rsa modulus 2048
ip ssh version 2
username admin secret Str0ngPass!
!
line vty 0 15
 login local
 transport input ssh
 exec-timeout 10 0
  1. Set a hostname other than the default and an ip domain-name: the key is named after both.
  2. Generate the RSA key; 2048 bits is a good choice, and SSHv2 needs at least 768.
  3. Create a local user with secret (hashed) rather than password.
  4. On the VTY lines use the local user database and allow only SSH.

Management address on a switch

A Layer 2 switch has no routed ports, so it is managed through an SVI in a management VLAN and needs a default gateway to answer from other subnets.

interface Vlan99
 ip address 10.99.0.11 255.255.255.0
 no shutdown
ip default-gateway 10.99.0.1

The admin's SSH session reaches SW1 through R1 (1); without ip default-gateway the switch could not answer it.

Restrict and verify

ip access-list standard MGMT
 permit 10.10.0.0 0.0.0.255
line vty 0 15
 access-class MGMT in

Commands

show ip sshWhether SSH is enabled, its version and timeouts.
show sshCurrent SSH sessions.
show usersWho is logged in on which line.
ssh -l admin 10.99.0.11Open an SSH session from IOS (or any client).

Exam traps

Check yourself

What two settings must exist before you can generate the RSA key?
A hostname and an IP domain name.
How do you make sure Telnet is refused on the VTY lines?
transport input ssh.
SSH works from the switch's own VLAN but not from other subnets. What is missing?
ip default-gateway on the Layer 2 switch.

Labs

Try it live: Secure device access: passwords, SSH, CDP and LLDP

More topics in 4.0 IP Services