Search This Blog

Saturday, May 27, 2023

Telnet: A quick overview

Overview

Telnet is a tool for administrating servers remotely. The name stands for Teletype Network and was invented pre-internet. As a consequence it is also an unencrypted way of communicating with a server. It should therefore not be used over the internet as the traffic may be intercepted, for example using Wireshark. 

Apart from servers it can also talk to other equipment such as network switches and routers. If the equipment is old, it might only be able to use Telnet instead of the encrypted tool called SSH (Secure Shell).

It is a command line tool that you can run on Windows, Mac and Linux which communicates bidirectionally. 

From a technical point of view it is a client/server type of protocol. The terminal captures keystrokes, the client converts it to a universal language that then goes through the TCP/IP protocol and through a network virtual terminal which sets a mutual standard for both machines.

It then goes through the TCP/IP stack on the receiving server side, the Telnet server converts/reverses the universal language to a language that the receiving system understands. The pseudoterminal then executes the commands and runs the applications.

Activating and deactivating Telnet Client

On a Windows machine you can activate it by going to the control panel, then select programs and features, then press "turn Windows features on or off".


Another way of activating Telnet is by using an elevated PowerShell prompt.

You can run the following commands to either activate or deactivate Telnet.

Enable-WindowsOptionalFeature -Online -FeatureName TelnetClient

Disable-WindowsOptionalFeature -Online -FeatureName TelnetClient


Using Telnet commands

If you write telnet followed by a target address followed by a space and a port number, you will use a different Telnet version. It can look like this if you try to connect to your local gateway:

telnet 192.168.0.1 23 

If you get stuck on "Connecting to 192.168.0.1..." it means that the port is closed and that Telnet won't work. Use the escape key to cancel. On a US keyboard it is Ctrl + ], on a Swedish keyboard your Telnet escape key is Ctrl + ¨.

Use telnet /? to open some the related help text.

You might experience lag when sending the commands, this is because the keystrokes has to travel back and forth over the network once you are connected via Telnet.


If only you write Telnet, you will instead open the Microsoft Telnet context.

To open a connection:
o google.com 443

To close a connection:
c google.com 443

To quit the Telnet context that you opened, simply use the command quit.

For more commands check the Microsoft page.

Summary

Telnet is an old and insecure way of communicating with servers, routers and switches. It is a text based tool run in the command prompt or PowerShell. Use SSH as a better alternative unless you work with legacy equipment that only can handle Telnet. Telnet is and should be disabled by default unless you have reasons to keep it active.


No comments:

Post a Comment