Earlier in the chapter you learned that you can telnet into a Cisco device running IOS to manage it. It is also possible to telnet from a Cisco IOS device to another device. This can be useful when troubleshooting across multiple devices. In this section you will learn to initiate and manage telnet connections from IOS CLI.
To telnet to another device from IOS, use the telnet command as shown below:
Remember that if the remote device is an IOS device, it should have a line password and an enabled password/secret configured. Without these, you will not be able to telnet in or get into the privilege exec mode.
When you exit the telnet session using logout or exit command on the remote device, you will be back to the prompt of the device from where the session was initiated, as shown below:
You can telnet to multiple devices simultaneously. For that, you will first need to toggle back to the local device prompt form the remote prompt using Crtl+Shift+6 followed by the X key. For example, in the output below, I first telnet to the switch like before and enter its privilege exec mode. Then I press the Ctrl+Shift+6 sequence following by X. The whole sequence will not be seen in the output but you will notice that I am back to the prompt of myRouter:
Though you are back to the first device, the telnet session to the remote device is still active, but in the background. Now you can initiate another telnet session to another device as shown below:
You can again leave this session active and go back to the prompt of the first device using the Ctrl+Shift+6 X sequence as shown below:
Now you have two telnet sessions active from the first device. You can see all active telnet sessions using the show sessions command:
The asterisk (*) sign next to a session shows the most recent session. You can return to that session by pressing Enter twice. You can return to any session by typing the number of the session and pressing Enter. In the output below, I toggle between the two sessions. Notice how pressing enter twice or just entering the session number as a command takes me back to the telnet sessions. Also notice that I can toggle between the sessions and the first device using Ctrl+Shift+6 X sequence.
You can end a telnet session from the remote device using the logout or exit command. You can also close the telnet session from the originating device using the disconnect <session_id> command.
In the output below, I close the first session using the logout command on the remote device whereas I close the second session using the disconnect command:
While managing a device, you can see who is connected to the device using the show users command as shown below:
myRouter#show users
Line User Host(s) Idle Location
*194 vty 0 admin idle 00:00:00 10.1.10.228
195 vty 1 admin idle 00:00:00 10.1.10.18
The above output shows that two users are connected to the device using Telnet. The asterisks (*) sign denotes the connection where the show users command was executed. The first connection is using line 194 and vty line 0 and the second is using line 195 and vty line 1. It is possible to disconnect someone’s session from the device using the clear line <line number> command. In the output below, I have disconnected the second connection from the first session: