Hi everyone, so far we have always configured the router through the CLI tab or a console cable. In the real world, routers and switches usually sit in a server room or a rack cabinet, so admins reach them remotely over the network. In this article I walk through two ways to remotely access a Cisco router, Telnet and SSH, and then show why SSH is the one you should actually use.
I do every step directly in Cisco Packet Tracer 8.2.1 with the topology from my guide on setting up a DHCP server on a Cisco router in Packet Tracer. PC0, with the IP 192.168.10.11, plays the admin computer that connects remotely to router R1 at 192.168.10.1.
The Topology Used
Check the topology and cables

The topology has one Cisco 1941 router, two 2960 switches, and four PCs, with Copper Straight-Through cables on every link.
Router0 GigabitEthernet0/0 -> Switch0 GigabitEthernet0/1 (straight)
Router0 GigabitEthernet0/1 -> Switch1 GigabitEthernet0/1 (straight)
PC0 FastEthernet0 -> Switch0 FastEthernet0/1 (straight)
PC1 FastEthernet0 -> Switch0 FastEthernet0/2 (straight)
PC2 FastEthernet0 -> Switch1 FastEthernet0/1 (straight)
PC3 FastEthernet0 -> Switch1 FastEthernet0/2 (straight)Unlike a console cable, Telnet and SSH run over the regular network. The only requirement is that the admin PC can ping the router IP.
Configuring Telnet on a Cisco Router
Set the enable password and the vty lines

Open the router CLI, enter enable mode, then type the following commands.
configure terminal
enable secret cisco123
line vty 0 4
password telnet123
login
transport input telnet
endline vty 0 4 is the set of virtual lines used for remote access. The numbers 0 through 4 mean five remote sessions can be open at the same time. password and login force everyone who connects remotely to enter a password, while transport input telnet allows only the Telnet protocol.
Warning: You must set an enable secret. Without an enable password, Cisco rejects the enable command from a remote session with the message % No password set, so you cannot get into configuration mode.
Test Telnet from the PC

Open the Command Prompt on PC0 and run the following command.
telnet 192.168.10.1User Access Verification appears and asks for a Password. Enter telnet123, then type enable and enter cisco123. The R1# prompt means we are now inside the router from the PC. The show users command lists two sessions: con 0 from the console and vty 0 from 192.168.10.11, which is PC0.
The problem is that Telnet sends everything, passwords included, as plain text. Anyone sniffing the network can read that password. That is why we replace it with SSH, which is encrypted.
Configuring SSH on a Cisco Router
Create the domain name and RSA key

SSH needs an RSA encryption key, and that key is built from the hostname combined with the domain name. The router hostname is already R1, so all we need to add is a domain name.
configure terminal
ip domain-name mamangdigital.local
crypto key generate rsaWhen the prompt How many bits in the modulus [512] appears, type 1024. SSH version 2 needs a key of at least 768 bits, and 1024 is the size most people use. The [OK] message means the key has been created.
Create a user and enable SSH on the vty lines

username admin secret admin123
ip ssh version 2
line vty 0 4
login local
transport input ssh
endusername admin secret admin123 creates a local account on the router. login local makes remote logins use that local account’s username and password instead of the vty password. transport input ssh turns Telnet off and allows only SSH. The %SSH-5-ENABLED message appears as soon as the RSA key and the SSH settings are ready.
Check the SSH status

show ip sshSSH Enabled version 2.0 means SSH is up and running. Remember to save the configuration with write memory.
Testing SSH Remote Access from the PC
Telnet is now refused

Try Telnet again from PC0. The connection does open, but the router closes it right away with the message Connection to 192.168.10.1 closed by foreign host, because the vty lines now accept SSH only.
Log in over SSH

ssh -l admin 192.168.10.1The -l option is followed by the username we created earlier. Enter the password admin123, then run enable with cisco123. In show users the User column now shows admin, a sign that the login went through the local account over SSH.
Common Problems and How to Fix Them
The message % No password set appears on enable
The enable secret has not been set yet. Go into configure terminal on the router and run enable secret with a password of your choice.
SSH is refused with the message Connection refused
Usually the RSA key has not been generated, or the hostname and domain name are missing. Make sure you have run crypto key generate rsa and that show ip ssh reports SSH Enabled.
The SSH password is always wrong
If the vty lines use login local, the password you need is the username password, not the vty password. Also check how you typed the username, because it is case sensitive.
At this point the Cisco router can be managed remotely and securely over SSH, and Telnet is turned off. In the next article we will start splitting the network into VLANs on a Cisco switch. If you run into any other error while trying this, just leave a comment below.












