How Does Telnet Work?

Telnet is a tool that can be used to open a command line on a remote computer, typically a server. You can also use it to check if a particular port is open. Telnet works as what's called a terminal emulator, using standard protocols to act like a physical terminal connected to a machine. Some modern systems allow only command line connections using Secure Shell, an encrypted tool similar to Telnet, or through a virtual private network. The file transfer protocol is often used in conjunction to send files.

How Does Telnet Work?
Image Credit: Caiaimage/Robert Daly/Caiaimage/GettyImages

What Is Telnet?

Telnet is a system for opening a text-based connection between two computers. The term is sometimes said to be a shortened form of "terminal network." The underlying protocol, or specification for how the computers communicate, was originally developed for physical terminals with keyboards and screens or printers that connected to computers in the 1960s. Nowadays, Telnet is usually implemented purely in software, and you can find Telnet software (sometimes referred to as terminal emulator software) for all modern operating systems.

By default, Telnet communicates with the computer you're connected to on port 23. That doesn't refer to the type of physical port on a computer where you might attach a keyboard or a monitor, but to a digital port number used to distinguish different services running on a computer. If someone tells you to connect to a computer using Telnet, you generally don't need to specify a port number unless you're told to do so.

Uses of Telnet

Historically, Telnet was often used to remotely log in to a remote server in order to conduct business such as editing files, running various programs or checking email on that system. Typically, you would use Telnet to connect to the system, then enter a username and password in order to access a command line on that system.

Nowadays, that use of Telnet is uncommon, because the software is unencrypted, meaning that anyone, by monitoring your connection, can access your username, password and any other private information you type. Telnet also doesn't support modern graphical user interfaces, which means it's not useful for remotely using many modern programs such as word processors, web browsers or spreadsheets that require a GUI interface.

Some servers do allow remote connections via Telnet to access public data, such as weather reports, or to play simple games. Some of these services exist out of nostalgia, as a throwback to simpler times online, and some are left in place for compatibility with older systems that need to access data.

It's also possible to connect to other software that use unencrypted text-based protocols using Telnet. This includes web servers using unencrypted connections. This can be useful for testing if ports and servers connected to them are properly configured.

Using Telnet on Windows

Telnet is included with modern versions of Microsoft Windows to connect to remote servers, but it's not enabled by default. To activate it if you haven't previously, launch the Windows command prompt while logged on as an administrator, then type "Dism /Online /Enable-feature /FeatureName:TelnetClient" to activate the software. Launch the command prompt by typing "cmd" in the search box on the Windows task bar or in the Start Menu and clicking the command prompt icon. If you're on someone else's computer, including a work computer, you may want to ask for help or ask permission before activating the software.

Once Telnet is activated, launch the command prompt and type "telnet ," where "" is the domain name or Internet protocol address of the server to which you want to connect. By default, you will connect to port 23. If you want to connect to another port, type "telnet " where "" is the number of another port.

Telnet on Mac and Linux

Telnet is typically enabled by default on Apple macOS and Linux systems. Use it from your system's command prompt in the same way you would on Windows, typing "telnet " or "telnet " to connect to a remote server, optionally specifying a nondefault port.

If you're running Linux and get an error message that Telnet can't be found, search for it and install it using your system's package manager. On Debian and Ubuntu systems, you can usually do this by typing "apt install telnet."

Telnet on Android and iOS

A variety of Telnet software is available for Android and iPhone smartphones in their respective app markets. Some of this software supports other remote connection protocols as well.

Search for a Telnet-compatible app that offers the features you want at a price you like. Be wary of apps that require what seem to be excessive numbers of permissions. Most remote terminal software on smartphones will enable you to specify a domain name or IP address and, optionally, a port to use.

Checking Ports With Telnet

It's sometimes useful to use Telnet to check if a particular port is open and accessible on a particular machine. For example, you might wish to check whether port 80, used by web servers, is open if you're having trouble connecting with your browser. You might also sometimes want to check port 25, commonly used to send email, if you're having trouble with an email program.

To do this, type "telnet" followed by the server name and desired port as you would do to log in to the machine using Telnet. See what type of response you get from the server. Often you'll just want to verify you can connect and receive a response, but in some cases you may want to enter commands manually.

If you can't connect, it may be a problem with the server or with the firewall on your network or the server's network. Contact whoever runs the server for help troubleshooting or try accessing the server from another computer or another network if you're having issues.

Using the Secure Shell

Nowadays, it's common to use a program called Secure Shell, or ssh, to connect to remote servers and open a command prompt. A big advantage of ssh is that it's encrypted, so it's harder for eavesdroppers to monitor or interfere with your connection.

On a macOS or Linux system, you can normally type "ssh " to connect to a particular server. On Windows, you may need to install an external client to use ssh. One common free one is called PuTTY. It also supports Telnet.

Normally, you will use ssh to connect to a server where someone has given you an account, and they can provide you with any additional information you need to access that server.

VNC, VPN and Remote Desktop

If you want to open a graphical connection to another server, you may be able to use a system called Virtual Network Computing, or VNC. There are a number of free and commercial VNC tools that you can use. Whoever runs the server you're trying to connect to may have advice on which tool to use.

If you're connecting to a Windows machine, you may also be able to use Microsoft's remote desktop protocol. Software to connect to a Windows computer using remote desktop is available for all modern operating systems. You'll usually need an account on the remote system to connect.

You can also use virtual private networking (VPN) to connect to a remote computer network. This is often used to connect to employer networks while working off-site. Whoever runs the network will provide you with credentials and tell you which VPN software to use.

references