Network Bytes · Episode 55 · CCNA 4.8
"SSH vs Telnet"
Telnet and SSH both give you a remote command line on a router or switch, but Telnet sends everything, including your password, in plain text. SSH encrypts the session on TCP port 22. Learn why, and the Cisco steps to set it up.
Managing a device from your desk
Routers and switches are usually configured from a command line. Walking to every device with a console cable doesn't scale, so you open a remote command line over the network instead. On Cisco devices, remote sessions land on the VTY lines (virtual terminal lines), which is what "the remote lines" means in the video.
Telnet: plain text on the wire
Telnet (RFC 854) is the old way to get that remote command line. It runs on TCP port 23 and works fine, but it has no encryption at all. Every character you type, including your username and password, crosses the network as readable text. Anyone who can capture traffic on the path between you and the device can read your login, letter by letter. The "shouting your PIN in a crowded room" picture is a simplification: the attacker does need to be somewhere they can capture that traffic, but on shared or compromised networks that is easier than it sounds.
SSH: the same job, encrypted
SSH, the Secure Shell (RFC 4251-4254), gives you the same remote command line, but the session is encrypted. It runs on TCP port 22. The SSH transport layer (RFC 4253) sets up encryption and lets your client check the server's identity before you log in, so an eavesdropper sees only scrambled bytes. Use SSH version 2; version 1 is outdated.
Setting up SSH on a Cisco device
To turn on SSH, a Cisco router or switch needs a few things in place:
- A hostname other than the default:
hostname R1 - A domain name:
ip domain name lab.local - An RSA key pair:
crypto key generate rsa modulus 2048(the hostname and domain name are used to name the key) - A local user to log in with:
username admin secret <password> - On the VTY lines (
line vty 0 4on many routers,line vty 0 15on many switches):login local, so they use that local user, and then allow only SSH as the input protocol.
Then turn on version 2 with ip ssh version 2. It needs an RSA key of at least 768 bits; 2048 is a sensible minimum today.
Try it yourself
On a laptop, open a terminal (Command Prompt or PowerShell on Windows, Terminal on macOS or Linux) and type ssh -V. It prints the SSH client version your computer already has built in. If you have a home server, a Raspberry Pi or a lab router, connect with ssh <user>@<address> and notice the first-time prompt asking you to trust the server's key fingerprint: that is SSH checking who it is talking to.
Good to know
- Telnet (RFC 854) uses TCP 23 and sends all data, including credentials, unencrypted.
- SSH (RFC 4251-4254) uses TCP 22 and encrypts the session.
- Use SSH version 2 (
ip ssh version 2), which needs an RSA key of at least 768 bits; 2048 is a sensible minimum today. - Cisco steps:
hostname,ip domain name,crypto key generate rsa,username ... secret ..., and on the VTY lineslogin localplus allowing only SSH. - "Remote lines" means the VTY lines.
- The PIN analogy is a simplification: an attacker needs to be able to capture traffic on the path.
- The username and password in the video are just examples.
For CCNA learners
This lines up with CCNA 200-301 exam topic 4.8, configure network devices for remote access using SSH: know why SSH replaces Telnet, that SSH uses TCP 22 and Telnet TCP 23, and the setup steps (hostname, domain name, RSA key, local user, login local and SSH-only VTY lines, version 2).
Answer to the comment question
Delete telnet. The line transport input telnet ssh allows both protocols on the VTY lines, so Telnet logins (and their plain-text passwords) still work. Removing that one word leaves transport input ssh, which allows only encrypted SSH sessions. The full VTY setup looks like this:
`` line vty 0 15 login local transport input ssh ``
Test your knowledge
Quick quiz: "SSH vs Telnet"
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- IETF, "RFC 854, Telnet Protocol Specification": remote terminal over TCP, no encryption
- IETF, "RFC 4253, The Secure Shell (SSH) Transport Layer Protocol": encryption and server authentication; TCP port 22
- Cisco, "Configure Secure Shell on Routers and Switches": hostname, domain name, RSA key, local user, SSH-only VTY lines
- Cisco, CCNA 200-301 v1.1 exam topics: 4.8 configure network devices for remote access using SSH
Video transcript
Why should you never manage a router with Telnet?
To configure a router from your desk, you open a remote command line. The old way is Telnet. It works, but sends everything in plain text.
Anyone capturing traffic on the path can read your username and password, letter by letter. It's like shouting your PIN across a crowded room.
SSH, the Secure Shell, does the same job over an encrypted connection, on TCP port 22. An eavesdropper sees only scrambled bytes.
On a Cisco device: set a hostname and domain name, generate an RSA key, create a local user, and allow only SSH on the remote lines.
A switch's remote lines say: transport input telnet ssh. Which one word should you delete? Comment your answer below!
That's your byte.
More from Network Bytes
- EP53"SNMP"
- EP54"QoS: why your video call wins"
- EP56"Threat, vulnerability, exploit"
- EP57"ACLs: the network bouncer"