Hone

Lessons · Network switches · SSH instead of telnet

Telnet sends your password across the network in the clear

SSH encrypts the session; telnet does not. Setting SSH up needs a hostname, a domain name, a key, a local user and the vty lines told to accept ssh only.

Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.

What it is for

Anybody who can see the traffic between you and the switch can read a telnet password. On a network you do not fully control, that is the whole security model gone.

How to think about it

Follow the chain and let the errors teach you: the key needs a name, the name needs a hostname and a domain. Then create a user, then tell the lines to use ssh and nothing else.

Worked example

enable
The # prompt.
configure terminal
Into configuration mode.
hostname IDF5
The key is named after the host and the domain, so this has to come first.
ip domain-name works.local
The other half of the key's name.
crypto key generate rsa modulus 2048
The key itself. 2048 bits, because the default of 512 is too small for SSH version 2.
ip ssh version 2
Version 1 has known weaknesses. Ask for 2 explicitly.
username netadmin secret Sw-2026-Rack
A named account, so the log says who did it rather than that somebody did.
line vty 0 15
The sixteen virtual lines an incoming session lands on.
login local
Ask for a username and password from this switch's own user list.
transport input ssh
And accept ssh only. This is the line that turns telnet off.
end
Out.
show running-config
Read the vty block back. transport input ssh is the setting an auditor will look for.

Your turn

Accept encrypted sessions only on the vty lines.

transport input 

The trap

Generating the key before setting a hostname and a domain. The switch refuses, and the error names what is missing, so read it rather than retyping the command.

Practise SSH instead of telnet on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.