Nowadays, SSH(Secure Shell) has replaced Telnet. SSH is also a network communication protocol that lets network and system administrators connect to remote computers securely. As for Telnet, it is now predominantly used to troubleshoot and test connection issues. Learning Telnet commands can help you manage your networks better. In this article, we’ll take a closer look at telnet command, including learning how it works and how to troubleshoot connection issues. Let’s get started.
What is Telnet?
Telnet is a network protocol that stands for Teletype Network. It offers a command-line interface/interpreter to communicate with the remote server. System and network administrators use Telnet’s terminal-to-terminal communication to gain remote control and perform different actions, such as initial device setup. To facilitate Telnet protocol, you need Telnet Client. The client enables users to sign in and use applications on remote systems through TCP/IP. The Telnet client uses a Telnet server application to carry out the operations. Moreover, Telnet Client is available on all modern operating systems, such as Windows, Linux, and macOS. Note: In the article, when we mention “Telnet,” it means “Telnet Client,” if otherwise mentioned.
Is Telnet Secure?
During its inception in 1969, security was not the main concern when performing network tasks. That’s why Telnet didn’t use any encryption. As it is not secure, it is also not recommended for connecting to remote clients over TCP/IP network. If you do, you expose yourself to hackers that can interrupt unencrypted data. SSH is a great alternative protocol that offers a secure way to connect to a server remotely.
How does Telnet work?
Visually, the Telnet protocol works as below. Telnet is a text-oriented communication that creates a bidirectional(client-server protocol) interactive communication system. It utilizes an eight-byte connection to do the transmission. Also, you need a keyboard and screen connected to the terminal to use Telnet. You enter a command from your terminal to connect to a remote computer. Once connected, Telnet provides you control over the server, including its files and process. To connect to a remote server, the user should enter “Telnet” in the command prompt. The syntax is: Once successfully connected, you can use the Telnet prompt to enter more Telnet commands. The different things that you can use Telnet for are:
Check open ports Edit files, run programs Configure network devices such as switches, routers, etc.
To end the session, you need to type “Telnet” into the Telnet prompt.
How to enable Telnet Client in Windows/Linux and macOS
Telnet client is available on all the major platforms and operating systems. However, you need to install or enable it before you can use it.
#1. Windows
If you’re using Windows 7 or above (8, 10, 11) or Windows Vista, you can enable the Telnet client by following the steps below:
Go to the start menu and search for Control Panel. You can also open Control Panel by pressing Win + R and then typing “control.” It should open up the Control Panel. Now select “Programs” > “Programs and Features.” Select “Turn Windows features on or off from the left pane.” Now check the box next to “Telnet Client” and press “OK.” Now, press “Close” once Windows enables it and shows the message, “Windows completed the requested change.”
Note: You can start using Telnet Client immediately without restarting your computer.
#2. Linux
Just like Windows, Linux also doesn’t come pre-installed with Telnet. To install Telnet in Ubuntu, you need to use the following command. Note: The command differs depending on your Linux distro.
#3. macOS
MacOS also supports Telnet. To install it, you need to use Homebrew. If Homebrew is not pre-installed, you can install it by running the following command: It’ll ask you to enter the administrator password to authorize the installation. With Homebrew installed, type the following command to install Telnet on MacOS.
Using Telnet to test and troubleshoot network connections
Even though Telnet is not ideal for remote connectivity, it is still useful for testing and troubleshooting network connections. Before we proceed, let’s take a quick look at Telnet syntax. Here, the server/host IP address is the server you want to connect to. The port is the TCP port number. For example, if you want to connect to server IP address example.com with port 80, you need to type the following command. This means you must know the remote server IP address/name and port number to troubleshoot beforehand. Let’s get started.
Troubleshooting web servers
Telnet offers an easy way to test server connectivity. All you need to do is connect to the server/host IP address and the port which accepts a connection. For example, if you’re connecting to 23.45.75.22 at port 532, you need to run the following command. From here, two things can happen: Multiple reasons for failed Telnet attempts to connect to a remote server exist. Also, if Telnet is not returning any error message, it can be a firewall or antivirus blocking the connection at your end or the server. If we connect to geekflare.com at port 80, you’ll see an instant connection as it waits for further commands. Now, enter the following command. It’ll return the following: Now, look at the failed attempt to connect to a server.
Check if a port is open
If a server is accessible remotely with Telnet, you can also use it to check whether a port is open. To check if a port on your server is open, you need to use the following command. For example, your server IP address is 23.45.47.53, and the port you want to check is 532. If the command is a success, you will get a blank screen which means the port is open. If it reads as “connecting..” and then shows an error message, it means the port is not open.
Troubleshooting SMTP mail servers
Simple Mail Transfer Protocol(SMTP) manages the communication between mail servers. You can troubleshoot SMTP servers with Telnet to see if they’re receiving and sending messages. You send manual message requests to the SMTP server. If everything is fine, you’ll get a response. Telnet lets you test STMP connection in two ways: To run a sample exchange, type the following command in your terminal. Here, the two other commands typed by the user are: The ECLO command identifies the domain name before using the MAIL FROM command. The QUIT command exit the Telnet session. If you want more advanced commands, check out this article on Using Telnet to test SMTP communication on Exchange servers.
Troubleshooting FTP server
Just like SMTP and web servers, you can also troubleshoot FTP servers. All you need to do is enter the FTP server IP address and connect to port 21. You are now connected to the server if the attempt is successful. Otherwise, you’ll see an error message.
Troubleshooting SSH
SSH is the modern take on secure connections and replaces Telnet. You can use Telnet to see if the server is running SSH. To do so, use the Telnet command with the server IP address and port 22.
Final Words
Telnet is a handy tool in current times. It lets you successfully troubleshoot network connections without relying heavily on more complex tools or command lines. Using Telnet, you can check if you can access a web server, see if a port is open, and troubleshoot SSH and FTP. You may check out this article on how to resolve ‘telnet command not found’ error.