Telnet

Telnet which is a part of TCP/IP protocol suite is a virtual terminal protocol that allows you to establish connection to remote devices, gather information and run programs. When the routers and switches are configured, Telnet programs can be used to reconfigure or to check the routers and switches without using a console cable.

Note: you cannot use CDP to gather information about routers and switches that are not directly connected to your device. But you can use the Telnet application to connect to neighbor device, and then run CDP on those remote devices to gather information on them.

There is slight variation when you use Telnet on Cisco router when compared to using it on most of Catalyst switches. The telnet command can be used to open Telnet connection from the Catalyst switch. With Cisco IOS software on router, there is no need to enter the connect or telnet command to establish Telnet connection. You can just IP address or hostname of the target device from any prompt and router will assume that you want to telnet to that device.
Switch#telnet 172.16.10.2
Trying 172.19.10.2....Open
Password required, but none set
[Connection to 172.19.10.2 closed by foreign host]
Switch#
Remember that VTY ports on a router are configured as login, meaning that you need to have VTY passwords set on the router to establish connection. Passwords can be set as shown below.
Switch#config t
Enter configuration commands one per line. End with
CTRL+Z
Switch(config)#line vty 0 4
Switch(config-line)#login
Switch(config-line)#password ccna
Switch(config-line)#^Z
Switch#
Again try to connect to router from the 2950 console:
Switch#telnet 172.16.10.2
User access verification
Password:
Switch>
Remember that VTY Password is the user-mode Password, not enable-mode password. When you try to enter into privileged mode after establishing connection into router, the following output will be displayed.
Switch>
Switch>en
% No password set
Switch>
Verifying Telnet Connections
To see the Telnet connectivity made from your router to router to remote device, use show sessions command as demonstrated below:
Switch#sh sessions
Conn Host Address Byte Idle Conn. Name
1 172.19.10.2 172.19.10.2 0 0 172.19.10.2
*2 192.168.0.148 192.168.0.148 0 0 192.168.0.148
Switch#
With the help of show sessions command, you can view a list of host to which Telnet connectivity is established. Information displayed in the show sessions output are host name, the IP address, the byte count, the amount of time the device has been idle and the connection name given to the session.

When multiple sessions in progress, the asterisk sigh next to connection 2 indicates that session2 is the last session. You can return to the last session by pressing Enter twice.

Checking Telnet users 

You can view list of all active console and VTY ports in use on the router with show user command.
Switch#sh users
Line User Host(s) Idle Location
*0 and 0 172.19.10.2 00:07:52
172.19.0.148 00:07:18
In the show user output, con represent the local console. In this example, the console is connected to two remote IP address or device. If there are multiple users, the asterisk (*) represent the current terminal session from which the show user command was entered.

Suspending Telnet Sessions
Imagine Telnet session is established between Router1 and Router2. To suspend the Telnet session and to come back to your local device (router or switch), press Ctrl+Shift+6 at the same time, release the keys and press the character x. The prompt indicates that the Telnet session has been suspended.
Switch#x
Switch#sh sessions
Conn Host Address Byte Idle Conn. Name
1 10.1.1.2 10.1.1.2 0 1 10.1.1.2
Switch#resume 1
Switch#
There are various ways to re-establish a suspended telnet session
  • Press Enter key twice to return to the previous devious device prompt.
  • Enter resume command if there is only one session. Entering resume command without session number helps you enter last active session.
  • The show sessions command helps to find the session number as shown in the above example.
  • The resume session number command helps to reconnect to a specific Telnet session as shown in the example above.
Closing a Telnet session

You can end a Telnet session in a few different ways. Entering exit or disconnect is probably the easiest and quickest.
  • Use exit or logout EXEC command to end a session from a remote device.
  • Use disconnects command to close a session from a local device. If there are multiple sessions, you can use disconnect (session name) (session number) command from the local device.

0 comments:

Post a Comment