Telnet is a network application that allows you to establish a connection between remote devices, for example, to send commands or receive data.

Telnet was often used in the past to remotely control Linux devices, but then it was replaced by the secure SSH protocol. However, it may be the only way to interact through the CLI with embedded systems, for example, a router, because they don't have ssh.

In this article, we will look at what telnet is, how to install it, and how to use telnet to solve your problems.

What is Telnet?

As I said, this application is designed to create a connection between remote computers. It works over the TELNET protocol, but this protocol is supported by many services, so it can be used to control them. The protocol works on the basis of TCP, and allows you to send commands to another device.

Let's look at the telnet syntax:

telnet options host port

A host is a remote computer (domain or IP address), a port is the port through which the connection is made.

Once a telnet connection has been established, it can operate in two modes:

  • Line by line is the preferred mode, where a line of text is edited on the local machine and sent only when it is complete.
  • Character-by-character is when all the characters you type are immediately sent to the remote server. It will be difficult to fix anything here if you make a mistake.

Let's install Telnet.

Install Telnet on Linux

Usually, Telnet is already installed in most distros, but if it's not, then you can install it from the official repos:

Ubuntu, Debian, Linux Mint, Zorin OS:
sudo apt install telnetd
Fedora, CentOS, Red Hat:
sudo dnf install telnet
openSuse:
sudo zypper install telnetd
ArchLinux or Manjaro:
sudo pacman -S telnetd
Gentoo:
sudo emerge -a net-misc/netkit-telnetd

Once the installation is complete, you can start using the app.

How to use Telnet

Next, we'll look at how to use telnet to solve the most common tasks.

Check Host availability via Telnet

Telnet can be useful for checking host availability, just pass it an ip address or hostname:

telnet 192.168.1.123

Although, everyone has been using ping for these purposes for a long time.

Check Open Ports via Telnet

Using Telnet, we can check the availability of a port on a host:

telnet 78.140.185.141 80
Check server availability using Telnet

If you see the same result as in the screenshot, then the port is open.

Telnet Debugging

The debug mode is useful in situations where you need to see the details of telnet operation.

To do this, use the command with the -d option:

telnet -d 78.140.185.141 80

Test Website via Telnet

One common way to use telnet is to test a site from a terminal. You won't get a beautiful web page, but only text data, but you can manually collect requests and see all the data transmitted by the server.

telnet example.com 80

After connecting, just enter the /GET command

Test Website via Telnet

Why You Shouldn't Use Telnet

  • Never use telnet to connect remotely except in an emergency. This is due to the fact that the data is transmitted in clear text. Accordingly, an attacker can easily intercept the traffic and find out the connection credentials.
  • Use a modern version of the SSH protocol to connect remotely. It uses encryption and is not susceptible to hacking.
  • Deactivate telnet on all devices. This approach ensures that an attacker doesn't gain remote access to the device.
  • Use telnet in debug mode inside the local network without access to external resources.

Conclusion

In this article, we looked at examples of using telnet, although it is no longer used for its main purpose, but it can still be useful to many users and system administrators.

Still have questions? Write in the comments.