Thursday 1 June 2017

REMOTE ACCESS OF CISCO ROUTERS USING TELNET & SSH

Many have doubts on  how to get access of a Cisco router's Command Line interface through remote access protocols. Actually there are two such ways to get access remotely to a Cisco device. they are TELNET and SSH. 

TELNET stands for Teletype Network , which is a protocol used to get access to a remote device without encryption in data transfer . 

SSH  stands for Secured Shell, which is a cryptographic protocol used to get access to a remote device with encryption in data transfer . 

Among the two, the most secured way of access is SSH.

Now we are going to see a short and simplified tutorial on how to do these things. 





See the above topology, In that we have two routers R1 and R2. Among these we are going to access  R2 router from R1, using remote access protocols like TELNET and SSH.


Assign IP address for the interfaces Fa 0/0 of R1 with 10.0.0.1/8 and Fa 0/0 of R2 with 10.0.0.2 . Then proceed as directed below,
R2#conf t
R2(config)#hostname vignesh

You must also configure a domain name:

vignesh(config)#ip domain-name internetworkershub

Generate an RSA keypair with a key length of 1024 bits using the following sequence of commands:

vignesh(config)#crypto key generate rsa
The name for the keys will be: vignesh.internetworkershub (where vignesh is R2's hostname)Choose the size of the key modulus in the range of 360 to 2048 for your  General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes.How many bits in the modulus [512]: 512% Generating 512 bit RSA keys ...[OK]

Create a username in the router’s local database for SSH authentication using the following command

vignesh(config)#username admin secret p@ssword

Enable login authentication against the local database when logging in to a terminal line using SSH and TELNET with the following commands:

vignesh(config)#line vty 0 4vignesh(config)#transport input ssh telnetvignesh(config-line)#login local

Enable SSHv2 and the previously configured keypair with the following commands:

vignesh(config)#ip ssh version 2vignesh(config)#ip ssh rsa keypair-name vignesh.internetworkershub (where vignesh is your R2's hostname)

Attempt to login using SSH from other router R1 ,

R2# ssh -l admin -v 2 10.0.0.2 (where -l is login name, -v is version)
password : p@ssword
vignesh>
Now you got the access using SSH for R2 router which has hostname of vignesh.
Don't close the session instead press CTRL+SHIFT+6 ~ x to go to your router R1 again, now try accessing using TELNET

R1# telnet 10.0.0.2

User access verfication

Username :adminpassword:p@ssword
vignesh>

Now you got the access using TELNET for R2 router which has hostname of vignesh.
Don't close the session instead press CTRL+SHIFT+6 ~ x to go to your router R1 again.

R1# show sessions
Conn Host           Address       Byte  Idle Conn Name
   1 10.0.0.2      10.0.0.2         0     6 10.0.0.2
*  2 10.0.0.2       10.0.0.2         0     0



Telnet command will be supported by windows cmd . But,ssh will not be supported by cmd. so , you need tools like Putty to access using SSH from windows. In linux there is no problem both will work fine.

I believe, Now you guys know how to remotely access Cisco routers using telnet and ssh.










 

No comments:

Post a Comment